зеркало из https://github.com/mozilla/gecko-dev.git
bug 112516 move shared gtk files to x11shared
Makefile.in changes r=cls the files were moved but not otherwise changed
This commit is contained in:
Родитель
994a3ddb6a
Коммит
017c2bee2b
|
@ -17,6 +17,7 @@
|
|||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
@ -46,8 +47,16 @@ REQUIRES = xpcom \
|
|||
|
||||
CSRCS = nsPrintdGTK.c
|
||||
|
||||
CPPSRCS = \
|
||||
# Code shared between GTK+, Xlib and Xprint gfx modules
|
||||
X11SHARED_LCPPSRCS = \
|
||||
nsAntiAliasedGlyph.cpp \
|
||||
nsX11AlphaBlend.cpp \
|
||||
nsXFontAAScaledBitmap.cpp \
|
||||
nsXFontNormal.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
$(X11SHARED_LCPPSRCS) \
|
||||
nsDeviceContextGTK.cpp \
|
||||
nsDeviceContextSpecFactoryG.cpp \
|
||||
nsDeviceContextSpecG.cpp \
|
||||
|
@ -62,9 +71,6 @@ CPPSRCS = \
|
|||
nsScreenGtk.cpp \
|
||||
nsScreenManagerGtk.cpp \
|
||||
nsPrintOptionsGTK.cpp \
|
||||
nsX11AlphaBlend.cpp \
|
||||
nsXFontAAScaledBitmap.cpp \
|
||||
nsXFontNormal.cpp \
|
||||
$(NULL)
|
||||
|
||||
# If not primary toolkit, install in secondary path
|
||||
|
@ -77,7 +83,7 @@ XPU_LCSRCS = xprintutil.c
|
|||
CSRCS += $(XPU_LCSRCS)
|
||||
endif
|
||||
|
||||
GARBAGE += $(XPU_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
GARBAGE += $(X11SHARED_LCPPSRCS) $(XPU_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -120,10 +126,14 @@ endif
|
|||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/. \
|
||||
-I$(srcdir)/.. \
|
||||
-I$(srcdir)/../x11shared \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_ENABLE_XPRINT
|
||||
export:: $(addprefix $(srcdir)/../xprint/,$(XPU_LCSRCS))
|
||||
export:: $(addprefix $(srcdir)/../xprint/,$(XPU_LCSRCS)) $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
|
||||
$(INSTALL) $^ .
|
||||
else
|
||||
export:: $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
|
||||
$(INSTALL) $^ .
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsAntiAliasedGlyph.h"
|
||||
|
||||
nsAntiAliasedGlyph::nsAntiAliasedGlyph(PRUint32 aMaxWidth, PRUint32 aMaxHeight,
|
||||
PRUint32 aBorder)
|
||||
{
|
||||
mMaxWidth = aMaxWidth;
|
||||
mMaxHeight = aMaxHeight;
|
||||
mBorder = aBorder;
|
||||
mBufferWidth = mBorder + mMaxWidth + mBorder;
|
||||
mBufferHeight = mBorder + mMaxHeight + mBorder;
|
||||
|
||||
mAscent = 0;
|
||||
mDescent = 0;
|
||||
mLBearing = 0;
|
||||
mRBearing = 0;
|
||||
mWidth = 0;
|
||||
mAdvance = 0;
|
||||
mOwnBuffer = PR_FALSE;
|
||||
mBuffer = nsnull;
|
||||
mBufferLen = 0;
|
||||
}
|
||||
|
||||
nsAntiAliasedGlyph::~nsAntiAliasedGlyph()
|
||||
{
|
||||
if (mOwnBuffer)
|
||||
nsMemory::Free(mBuffer);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAntiAliasedGlyph::Init()
|
||||
{
|
||||
return Init(nsnull, 0);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAntiAliasedGlyph::Init(PRUint8 *aBuffer, PRUint32 aBufferLen)
|
||||
{
|
||||
mBufferLen = mBufferWidth * mBufferHeight;
|
||||
if (aBufferLen >= mBufferLen) {
|
||||
mBuffer = aBuffer;
|
||||
mOwnBuffer = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
mBuffer = (PRUint8 *)nsMemory::Alloc(mBufferLen);
|
||||
if (!mBuffer) {
|
||||
mBufferLen = 0;
|
||||
return PR_FALSE;
|
||||
}
|
||||
mOwnBuffer = PR_TRUE;
|
||||
}
|
||||
memset(mBuffer, 0, mBufferLen);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAntiAliasedGlyph::SetImage(XCharStruct *aCharStruct, XImage *aXImage)
|
||||
{
|
||||
NS_ASSERTION(mBuffer, "null buffer (was Init called?)");
|
||||
if (!mBuffer)
|
||||
return PR_FALSE;
|
||||
PRUint32 src_width = GLYPH_RIGHT_EDGE(aCharStruct)
|
||||
- GLYPH_LEFT_EDGE(aCharStruct);
|
||||
PRUint32 src_height = aXImage->height;
|
||||
if ((src_width > mMaxWidth) || (src_height > mMaxHeight)) {
|
||||
NS_ASSERTION(src_width<=mMaxWidth,"unexpected width");
|
||||
NS_ASSERTION(src_height<=mMaxHeight,"unexpected height");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mAscent = aCharStruct->ascent;
|
||||
mDescent = aCharStruct->descent;
|
||||
mLBearing = aCharStruct->lbearing;
|
||||
mRBearing = aCharStruct->rbearing;
|
||||
mWidth = src_width;
|
||||
mHeight = src_height;
|
||||
mAdvance = aCharStruct->width;
|
||||
|
||||
NS_ASSERTION(aXImage->format==ZPixmap,"unexpected image format");
|
||||
if (aXImage->format != ZPixmap)
|
||||
return PR_FALSE;
|
||||
|
||||
int bits_per_pixel = aXImage->bits_per_pixel;
|
||||
memset((char*)mBuffer, 0, mBufferLen);
|
||||
|
||||
PRUint32 x, y;
|
||||
PRUint32 src_index = 0;
|
||||
PRUint32 dst_index = mBorder + (mBorder*mBufferWidth);
|
||||
PRInt32 delta_dst_row = -src_width + mBufferWidth;
|
||||
PRUint8 *pSrcLineStart = (PRUint8 *)aXImage->data;
|
||||
if (bits_per_pixel == 16) {
|
||||
for (y=0; y<src_height; y++) {
|
||||
PRUint16 *src = (PRUint16*)pSrcLineStart;
|
||||
for (x=0; x<src_width; x++,src++,dst_index++) {
|
||||
if (*src & 0x1)
|
||||
mBuffer[dst_index] = 0xFF;
|
||||
}
|
||||
// move to the next row
|
||||
dst_index += delta_dst_row;
|
||||
pSrcLineStart += aXImage->bytes_per_line;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (bits_per_pixel == 24) {
|
||||
PRUint8 *src = (PRUint8*)aXImage->data;
|
||||
for (y=0; y<src_height; y++) {
|
||||
for (x=0; x<src_width; x++,src_index+=3,dst_index++) {
|
||||
if (src[src_index] & 0x1)
|
||||
mBuffer[dst_index] = 0xFF;
|
||||
}
|
||||
// move to the next row
|
||||
dst_index += delta_dst_row;
|
||||
src_index += -3*src_width + aXImage->bytes_per_line;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (bits_per_pixel == 32) {
|
||||
for (y=0; y<src_height; y++) {
|
||||
PRUint32 *src = (PRUint32*)pSrcLineStart;
|
||||
for (x=0; x<src_width; x++,src++,dst_index++) {
|
||||
if (*src & 0x100)
|
||||
mBuffer[dst_index] = 0xFF;
|
||||
}
|
||||
// move to the next row
|
||||
dst_index += delta_dst_row;
|
||||
pSrcLineStart += aXImage->bytes_per_line;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(0, "do not support current bits_per_pixel");
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAntiAliasedGlyph::SetSize(GlyphMetrics *aGlyphMetrics)
|
||||
{
|
||||
mAscent = aGlyphMetrics->ascent;
|
||||
mDescent = aGlyphMetrics->descent;
|
||||
mLBearing = aGlyphMetrics->lbearing;
|
||||
mRBearing = aGlyphMetrics->rbearing;
|
||||
mWidth = aGlyphMetrics->width;
|
||||
mHeight = aGlyphMetrics->height;
|
||||
mAdvance = aGlyphMetrics->advance;
|
||||
return PR_TRUE;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,153 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ex: set tabstop=8 softtabstop=2 shiftwidth=2 expandtab: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Stell <bstell@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsXFontNormal.h"
|
||||
#include "nsRenderingContextGTK.h"
|
||||
|
||||
void
|
||||
nsXFontNormal::DrawText8(GdkDrawable *aDrawable, GdkGC *aGC,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
const char *aString, PRUint32 aLength)
|
||||
{
|
||||
nsRenderingContextGTK::my_gdk_draw_text(aDrawable, mGdkFont, aGC,
|
||||
aX, aY, aString, aLength);
|
||||
}
|
||||
|
||||
void
|
||||
nsXFontNormal::DrawText16(GdkDrawable *aDrawable, GdkGC *aGC,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
const XChar2b *aString, PRUint32 aLength)
|
||||
{
|
||||
nsRenderingContextGTK::my_gdk_draw_text(aDrawable, mGdkFont, aGC,
|
||||
aX, aY,
|
||||
(const char *)aString, aLength*2);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXFontNormal::GetXFontProperty(Atom aAtom, unsigned long *aValue)
|
||||
{
|
||||
NS_ASSERTION(mGdkFont, "GetXFontProperty called before font loaded");
|
||||
if (mGdkFont==nsnull)
|
||||
return PR_FALSE;
|
||||
|
||||
XFontStruct *fontInfo = (XFontStruct *)GDK_FONT_XFONT(mGdkFont);
|
||||
|
||||
return ::XGetFontProperty(fontInfo, aAtom, aValue);
|
||||
}
|
||||
|
||||
XFontStruct *
|
||||
nsXFontNormal::GetXFontStruct()
|
||||
{
|
||||
NS_ASSERTION(mGdkFont, "GetXFontStruct called before font loaded");
|
||||
if (mGdkFont==nsnull)
|
||||
return nsnull;
|
||||
|
||||
return (XFontStruct *)GDK_FONT_XFONT(mGdkFont);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXFontNormal::LoadFont()
|
||||
{
|
||||
if (!mGdkFont)
|
||||
return PR_FALSE;
|
||||
XFontStruct *fontInfo = (XFontStruct *)GDK_FONT_XFONT(mGdkFont);
|
||||
mIsSingleByte = (fontInfo->min_byte1 == 0) && (fontInfo->max_byte1 == 0);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsXFontNormal::nsXFontNormal(GdkFont *aGdkFont)
|
||||
{
|
||||
mGdkFont = ::gdk_font_ref(aGdkFont);
|
||||
}
|
||||
|
||||
void
|
||||
nsXFontNormal::TextExtents8(const char *aString, PRUint32 aLength,
|
||||
PRInt32* aLBearing, PRInt32* aRBearing,
|
||||
PRInt32* aWidth, PRInt32* aAscent,
|
||||
PRInt32* aDescent)
|
||||
{
|
||||
gdk_text_extents(mGdkFont, aString, aLength,
|
||||
aLBearing, aRBearing, aWidth, aAscent, aDescent);
|
||||
}
|
||||
|
||||
void
|
||||
nsXFontNormal::TextExtents16(const XChar2b *aString, PRUint32 aLength,
|
||||
PRInt32* aLBearing, PRInt32* aRBearing,
|
||||
PRInt32* aWidth, PRInt32* aAscent,
|
||||
PRInt32* aDescent)
|
||||
{
|
||||
gdk_text_extents(mGdkFont, (const char *)aString, aLength*2,
|
||||
aLBearing, aRBearing, aWidth, aAscent, aDescent);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXFontNormal::TextWidth8(const char *aString, PRUint32 aLength)
|
||||
{
|
||||
NS_ASSERTION(mGdkFont, "TextWidth8 called before font loaded");
|
||||
if (mGdkFont==nsnull)
|
||||
return 0;
|
||||
PRInt32 width = gdk_text_width(mGdkFont, aString, aLength);
|
||||
return width;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsXFontNormal::TextWidth16(const XChar2b *aString, PRUint32 aLength)
|
||||
{
|
||||
NS_ASSERTION(mGdkFont, "TextWidth16 called before font loaded");
|
||||
if (mGdkFont==nsnull)
|
||||
return 0;
|
||||
PRInt32 width = gdk_text_width(mGdkFont, (const char *)aString, aLength*2);
|
||||
return width;
|
||||
}
|
||||
|
||||
void
|
||||
nsXFontNormal::UnloadFont()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
nsXFontNormal::~nsXFontNormal()
|
||||
{
|
||||
if (mGdkFont) {
|
||||
::gdk_font_unref(mGdkFont);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
@ -56,7 +57,13 @@ REQUIRES = xpcom \
|
|||
intl \
|
||||
$(NULL)
|
||||
|
||||
# Code shared between GTK+, Xlib and Xprint gfx modules
|
||||
# (empty for now - but this will be filled soon...)
|
||||
X11SHARED_LCPPSRCS = \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
$(X11SHARED_LCPPSRCS) \
|
||||
nsDeviceContextSpecFactoryX.cpp \
|
||||
nsDeviceContextSpecXlib.cpp \
|
||||
nsDeviceContextXlib.cpp \
|
||||
|
@ -86,7 +93,7 @@ XPU_LCSRCS = xprintutil.c
|
|||
CSRCS += $(XPU_LCSRCS)
|
||||
endif
|
||||
|
||||
GARBAGE += $(XPU_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
GARBAGE += $(X11SHARED_LCPPSRCS) $(XPU_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -117,12 +124,17 @@ INCLUDES += -I$(srcdir)/../xprint
|
|||
EXTRA_DSO_LDOPTS += $(MOZ_XPRINT_LDFLAGS)
|
||||
endif
|
||||
|
||||
INCLUDES += \
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/. \
|
||||
-I$(srcdir)/.. \
|
||||
-I$(srcdir)/../x11shared \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_ENABLE_XPRINT
|
||||
export:: $(addprefix $(srcdir)/../xprint/,$(XPU_LCSRCS))
|
||||
export:: $(addprefix $(srcdir)/../xprint/,$(XPU_LCSRCS)) $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
|
||||
$(INSTALL) $^ .
|
||||
else
|
||||
export:: $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
|
||||
$(INSTALL) $^ .
|
||||
endif
|
||||
|
||||
|
|
|
@ -51,6 +51,11 @@ CSRCS = \
|
|||
xprintutil_printtofile.c \
|
||||
$(NULL)
|
||||
|
||||
# Code shared between GTK+, Xlib and Xprint gfx modules
|
||||
# (empty for now - but this will be filled soon...)
|
||||
X11SHARED_LCPPSRCS = \
|
||||
$(NULL)
|
||||
|
||||
# nsDrawingSurfaceXlib only required for staticbuild
|
||||
XLIB_LCPPSRCS = \
|
||||
nsDrawingSurfaceXlib.cpp \
|
||||
|
@ -61,6 +66,7 @@ XLIB_LCPPSRCS = \
|
|||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
$(X11SHARED_LCPPSRCS) \
|
||||
$(XLIB_LCPPSRCS) \
|
||||
nsDeviceContextXP.cpp \
|
||||
nsGfxFactoryXP.cpp \
|
||||
|
@ -80,7 +86,7 @@ CXXFLAGS += $(MOZ_XPRINT_CFLAGS)
|
|||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE += $(XLIB_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
GARBAGE += $(X11SHARED_LCPPSRCS) $(XLIB_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -103,8 +109,9 @@ LOCAL_INCLUDES = \
|
|||
-I$(srcdir) \
|
||||
-I$(srcdir)/../xlib \
|
||||
-I$(srcdir)/../xlibrgb \
|
||||
-I$(srcdir)/../x11shared \
|
||||
-I$(srcdir)/.. \
|
||||
$(NULL)
|
||||
|
||||
export:: $(addprefix $(srcdir)/../xlib/,$(XLIB_LCPPSRCS))
|
||||
export:: $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS)) $(addprefix $(srcdir)/../xlib/,$(XLIB_LCPPSRCS))
|
||||
$(INSTALL) $^ .
|
||||
|
|
Загрузка…
Ссылка в новой задаче