зеркало из https://github.com/mozilla/pjs.git
Bug 392252 need new APIs for converting AppUnits to gfx usable pixels r=sharparrow1, sr+a=roc
This commit is contained in:
Родитель
486571c119
Коммит
5cf046b40d
|
@ -50,6 +50,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -54,6 +54,7 @@ REQUIRES = appshell \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
intl \
|
||||
locale \
|
||||
string \
|
||||
|
|
|
@ -50,6 +50,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
htmlparser \
|
||||
intl \
|
||||
layout \
|
||||
|
|
|
@ -50,6 +50,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
htmlparser \
|
||||
intl \
|
||||
layout \
|
||||
|
|
|
@ -52,6 +52,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -52,6 +52,7 @@ REQUIRES = content \
|
|||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
locale \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
widget \
|
||||
caps \
|
||||
|
|
|
@ -49,6 +49,7 @@ LIBXUL_LIBRARY = 1
|
|||
REQUIRES = xpcom \
|
||||
string \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
widget \
|
||||
dom \
|
||||
|
|
|
@ -49,6 +49,7 @@ LIBXUL_LIBRARY = 1
|
|||
REQUIRES = xpcom \
|
||||
string \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
widget \
|
||||
dom \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = content \
|
|||
xpcom \
|
||||
string \
|
||||
gfx \
|
||||
thebes \
|
||||
dom \
|
||||
webshell \
|
||||
htmlparser \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
xultmpl \
|
||||
widget \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
widget \
|
||||
necko \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
widget \
|
||||
caps \
|
||||
|
|
|
@ -50,6 +50,7 @@ REQUIRES = xpcom \
|
|||
layout \
|
||||
widget \
|
||||
gfx \
|
||||
thebes \
|
||||
dom \
|
||||
js \
|
||||
locale \
|
||||
|
|
|
@ -52,6 +52,7 @@ endif
|
|||
REQUIRES = xpcom \
|
||||
string \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
exthandler \
|
||||
mimetype \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
|
|
|
@ -52,6 +52,7 @@ REQUIRES = xpcom \
|
|||
xpconnect \
|
||||
caps \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
pref \
|
||||
|
|
|
@ -56,6 +56,7 @@ REQUIRES = xpcom \
|
|||
caps \
|
||||
necko \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
dom \
|
||||
|
|
|
@ -62,6 +62,7 @@ REQUIRES = xpcom \
|
|||
necko \
|
||||
nkcache \
|
||||
gfx \
|
||||
thebes \
|
||||
content \
|
||||
layout \
|
||||
webshell \
|
||||
|
|
|
@ -53,6 +53,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
widget \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
caps \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
content \
|
||||
caps \
|
||||
gfx \
|
||||
thebes \
|
||||
js \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
|||
content \
|
||||
caps \
|
||||
gfx \
|
||||
thebes \
|
||||
js \
|
||||
layout \
|
||||
locale \
|
||||
|
|
|
@ -65,6 +65,7 @@ REQUIRES = xpcom \
|
|||
webshell \
|
||||
docshell \
|
||||
gfx \
|
||||
thebes \
|
||||
widget \
|
||||
xuldoc \
|
||||
txtsvc \
|
||||
|
|
|
@ -59,6 +59,7 @@ REQUIRES = xpcom \
|
|||
pref \
|
||||
view \
|
||||
gfx \
|
||||
thebes \
|
||||
widget \
|
||||
unicharutil \
|
||||
commandhandler \
|
||||
|
|
|
@ -59,6 +59,7 @@ REQUIRES = xpcom \
|
|||
pref \
|
||||
lwbrk \
|
||||
gfx \
|
||||
thebes \
|
||||
widget \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
|
|
|
@ -52,6 +52,7 @@ REQUIRES = xpcom \
|
|||
string \
|
||||
editor \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
dom \
|
||||
|
|
|
@ -54,6 +54,7 @@ REQUIRES = xpcom \
|
|||
docshell \
|
||||
widget \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
dom \
|
||||
|
|
|
@ -51,6 +51,7 @@ REQUIRES = string \
|
|||
dom \
|
||||
docshell \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
editor \
|
||||
locale \
|
||||
|
|
|
@ -55,6 +55,7 @@ REQUIRES = xpcom \
|
|||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
content \
|
||||
necko \
|
||||
layout \
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include "nsRect.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
// XXX we need only gfxTypes.h, but we cannot include it directly.
|
||||
#include "gfxPoint.h"
|
||||
|
||||
class nsIView;
|
||||
class nsIFontMetrics;
|
||||
|
@ -166,10 +168,10 @@ const PRUint8 kUseAltDCFor_CREATERC_PAINT = 0x04; // Use when creating Renderin
|
|||
const PRUint8 kUseAltDCFor_SURFACE_DIM = 0x08; // Use it for getting the Surface Dimensions
|
||||
#endif
|
||||
|
||||
// 7353cfdf-964f-4c20-8729-b11729cc0000
|
||||
// 4dd372b6-ef19-4995-a7ac-ba3efd3f656f
|
||||
#define NS_IDEVICE_CONTEXT_IID \
|
||||
{ 0x7353cfdf, 0x964f, 0x4c20, \
|
||||
{ 0x87, 0x29, 0xb1, 0x17, 0x29, 0xcc, 0x00, 0x00 } }
|
||||
{ 0x4dd372b6, 0xef19, 0x4995, \
|
||||
{ 0xa7, 0xac, 0xba, 0x3e, 0xfd, 0x3f, 0x65, 0x6f } }
|
||||
|
||||
//a cross platform way of specifying a native palette handle
|
||||
typedef void * nsPalette;
|
||||
|
@ -280,12 +282,24 @@ public:
|
|||
*/
|
||||
static PRInt32 AppUnitsPerCSSPixel() { return 60; }
|
||||
|
||||
/**
|
||||
* Convert app units to CSS pixels which is used in gfx/thebes.
|
||||
*/
|
||||
static gfxFloat AppUnitsToGfxCSSPixels(nscoord aAppUnits)
|
||||
{ return gfxFloat(aAppUnits) / AppUnitsPerCSSPixel(); }
|
||||
|
||||
/**
|
||||
* Gets the number of app units in one device pixel; this number is usually
|
||||
* a factor of AppUnitsPerCSSPixel(), although that is not guaranteed.
|
||||
*/
|
||||
PRInt32 AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
|
||||
|
||||
/**
|
||||
* Convert app units to device pixels which is used in gfx/thebes.
|
||||
*/
|
||||
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
|
||||
{ return gfxFloat(aAppUnits) / AppUnitsPerDevPixel(); }
|
||||
|
||||
/**
|
||||
* Gets the number of app units in one inch; this is the device's DPI
|
||||
* times AppUnitsPerDevPixel().
|
||||
|
|
|
@ -59,6 +59,7 @@ REQUIRES = xpcom \
|
|||
view \
|
||||
pref \
|
||||
unicharutil \
|
||||
thebes \
|
||||
$(NULL)
|
||||
|
||||
DIRS = shared
|
||||
|
|
|
@ -73,7 +73,7 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
mTextRunRTL = PR_FALSE;
|
||||
|
||||
// work around layout giving us 0 sized fonts...
|
||||
double size = NSAppUnitsToFloatPixels(aFont.size, mP2A);
|
||||
gfxFloat size = gfxFloat(aFont.size) / mP2A;
|
||||
if (size == 0.0)
|
||||
size = 1.0;
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function for painting the decoration lines for the text.
|
||||
* NOTE: aPt, aLineSize, aAscent, aOffset and aReferredHeight are non-rounded
|
||||
* NOTE: aPt, aLineSize, aAscent, aOffset and aPreferredHeight are non-rounded
|
||||
* device pixels, not app units.
|
||||
* input:
|
||||
* @param aGfxContext
|
||||
|
|
|
@ -2141,11 +2141,10 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
|||
// of the image)
|
||||
gfxRect pxSrc;
|
||||
if (aSourceRect) {
|
||||
PRInt32 p2a = nsIDeviceContext::AppUnitsPerCSSPixel();
|
||||
pxSrc.pos.x = NSAppUnitsToFloatPixels(aSourceRect->x, p2a);
|
||||
pxSrc.pos.y = NSAppUnitsToFloatPixels(aSourceRect->y, p2a);
|
||||
pxSrc.size.width = NSAppUnitsToFloatPixels(aSourceRect->width, p2a);
|
||||
pxSrc.size.height = NSAppUnitsToFloatPixels(aSourceRect->height, p2a);
|
||||
pxSrc.pos.x = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->x);
|
||||
pxSrc.pos.y = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->y);
|
||||
pxSrc.size.width = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->width);
|
||||
pxSrc.size.height = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->height);
|
||||
} else {
|
||||
pxSrc.pos.x = pxSrc.pos.y = 0.0;
|
||||
PRInt32 w = 0, h = 0;
|
||||
|
@ -2157,7 +2156,6 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
|||
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
aRenderingContext->GetDeviceContext(*getter_AddRefs(dc));
|
||||
PRInt32 d2a = dc->AppUnitsPerDevPixel();
|
||||
|
||||
nsRefPtr<gfxContext> ctx = static_cast<gfxContext*>
|
||||
(aRenderingContext->GetNativeGraphicData(
|
||||
|
@ -2170,10 +2168,10 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
|||
// pixel, but then convert back to gfxFloats for the rest of the math.
|
||||
gfxRect pxDest;
|
||||
{
|
||||
pxDest.pos.x = NSAppUnitsToFloatPixels(aDestRect.x, d2a);
|
||||
pxDest.pos.y = NSAppUnitsToFloatPixels(aDestRect.y, d2a);
|
||||
pxDest.size.width = NSAppUnitsToFloatPixels(aDestRect.width, d2a);
|
||||
pxDest.size.height = NSAppUnitsToFloatPixels(aDestRect.height, d2a);
|
||||
pxDest.pos.x = dc->AppUnitsToGfxUnits(aDestRect.x);
|
||||
pxDest.pos.y = dc->AppUnitsToGfxUnits(aDestRect.y);
|
||||
pxDest.size.width = dc->AppUnitsToGfxUnits(aDestRect.width);
|
||||
pxDest.size.height = dc->AppUnitsToGfxUnits(aDestRect.height);
|
||||
if (ctx->UserToDevicePixelSnapped(pxDest))
|
||||
pxDest = ctx->DeviceToUser(pxDest);
|
||||
}
|
||||
|
@ -2184,10 +2182,10 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
|||
// been intersected with, and we should be rounding those consistently.)
|
||||
gfxRect pxDirty;
|
||||
{
|
||||
pxDirty.pos.x = NSAppUnitsToFloatPixels(dirtyRect.x, d2a);
|
||||
pxDirty.pos.y = NSAppUnitsToFloatPixels(dirtyRect.y, d2a);
|
||||
pxDirty.size.width = NSAppUnitsToFloatPixels(dirtyRect.width, d2a);
|
||||
pxDirty.size.height = NSAppUnitsToFloatPixels(dirtyRect.height, d2a);
|
||||
pxDirty.pos.x = dc->AppUnitsToGfxUnits(dirtyRect.x);
|
||||
pxDirty.pos.y = dc->AppUnitsToGfxUnits(dirtyRect.y);
|
||||
pxDirty.size.width = dc->AppUnitsToGfxUnits(dirtyRect.width);
|
||||
pxDirty.size.height = dc->AppUnitsToGfxUnits(dirtyRect.height);
|
||||
if (ctx->UserToDevicePixelSnapped(pxDirty))
|
||||
pxDirty = ctx->DeviceToUser(pxDirty);
|
||||
}
|
||||
|
|
|
@ -660,10 +660,10 @@ public:
|
|||
|
||||
/**
|
||||
* Draw a single image.
|
||||
* @param aImage The image.
|
||||
* @param aRenderingContext Where to draw the image, set up with an
|
||||
* appropriate scale and transform for drawing in
|
||||
* app units (aDestRect).
|
||||
* @param aImage The image.
|
||||
* @param aDestRect Where to draw the image (app units).
|
||||
* @param aDirtyRect Draw only within this region (rounded to the
|
||||
* nearest pixel); the intersection of
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
// XXX we need only gfxTypes.h, but we cannot include it directly.
|
||||
#include "gfxPoint.h"
|
||||
class nsImageLoader;
|
||||
#ifdef IBMBIDI
|
||||
class nsBidiPresUtils;
|
||||
|
@ -496,6 +498,9 @@ public:
|
|||
{ return NSAppUnitsToFloatPixels(aAppUnits,
|
||||
nsIDeviceContext::AppUnitsPerCSSPixel()); }
|
||||
|
||||
static gfxFloat AppUnitsToGfxCSSPixels(nscoord aAppUnits)
|
||||
{ return nsIDeviceContext::AppUnitsToGfxCSSPixels(aAppUnits); }
|
||||
|
||||
nscoord DevPixelsToAppUnits(PRInt32 aPixels) const
|
||||
{ return NSIntPixelsToAppUnits(aPixels,
|
||||
mDeviceContext->AppUnitsPerDevPixel()); }
|
||||
|
@ -504,6 +509,9 @@ public:
|
|||
{ return NSAppUnitsToIntPixels(aAppUnits,
|
||||
mDeviceContext->AppUnitsPerDevPixel()); }
|
||||
|
||||
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
|
||||
{ return mDeviceContext->AppUnitsToGfxUnits(aAppUnits); }
|
||||
|
||||
nscoord TwipsToAppUnits(PRInt32 aTwips) const
|
||||
{ return NSToCoordRound(NS_TWIPS_TO_INCHES(aTwips) *
|
||||
mDeviceContext->AppUnitsPerInch()); }
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Steve Clark <buster@netscape.com>
|
||||
* Håkan Waara <hwaara@chello.se>
|
||||
* Håkan Waara <hwaara@chello.se>
|
||||
* Dan Rosen <dr@netscape.com>
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
* Mats Palmgren <mats.palmgren@bredband.net>
|
||||
|
@ -4771,11 +4771,10 @@ PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
|
|||
builder.LeavePresShell(rootFrame, rect);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nscoord appUnitsPerDevPixel = mPresContext->AppUnitsPerDevPixel();
|
||||
// Ensure that r.x,r.y gets drawn at (0,0)
|
||||
aThebesContext->Save();
|
||||
aThebesContext->Translate(gfxPoint(-NSAppUnitsToFloatPixels(rect.x,appUnitsPerDevPixel),
|
||||
-NSAppUnitsToFloatPixels(rect.y,appUnitsPerDevPixel)));
|
||||
aThebesContext->Translate(gfxPoint(-mPresContext->AppUnitsToGfxUnits(rect.x),
|
||||
-mPresContext->AppUnitsToGfxUnits(rect.y)));
|
||||
|
||||
nsIDeviceContext* devCtx = mPresContext->DeviceContext();
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
|
|
|
@ -5779,14 +5779,17 @@ nsBlockFrame::PaintTextDecorationLine(nsIRenderingContext& aRenderingContext,
|
|||
PRBool isRTL = visibility->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
nsRefPtr<gfxContext> ctx = (gfxContext*)
|
||||
aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
|
||||
gfxFloat a2p = 1.0 / PresContext()->AppUnitsPerDevPixel();
|
||||
gfxPoint pt((start + aPt.x) * a2p, (aLine->mBounds.y + aPt.y) * a2p);
|
||||
gfxSize size(width * a2p, aSize * a2p);
|
||||
nsCSSRendering::PaintDecorationLine(ctx, aColor, pt, size,
|
||||
aLine->GetAscent() * a2p, aOffset * a2p,
|
||||
aSize * a2p, aDecoration,
|
||||
NS_STYLE_BORDER_STYLE_SOLID,
|
||||
isRTL);
|
||||
PRInt32 app = PresContext()->AppUnitsPerDevPixel();
|
||||
gfxPoint pt(PresContext()->AppUnitsToGfxUnits(start + aPt.x),
|
||||
PresContext()->AppUnitsToGfxUnits(aLine->mBounds.y + aPt.y));
|
||||
gfxSize size(PresContext()->AppUnitsToGfxUnits(width),
|
||||
PresContext()->AppUnitsToGfxUnits(aSize));
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
ctx, aColor, pt, size,
|
||||
PresContext()->AppUnitsToGfxUnits(aLine->GetAscent()),
|
||||
PresContext()->AppUnitsToGfxUnits(aOffset),
|
||||
PresContext()->AppUnitsToGfxUnits(aSize),
|
||||
aDecoration, NS_STYLE_BORDER_STYLE_SOLID, isRTL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -214,12 +214,15 @@ nsHTMLContainerFrame::PaintTextDecorationLine(
|
|||
nscoord innerWidth = mRect.width - bp.left - bp.right;
|
||||
nsRefPtr<gfxContext> ctx = (gfxContext*)
|
||||
aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
|
||||
gfxFloat a2p = 1.0 / PresContext()->AppUnitsPerDevPixel();
|
||||
gfxPoint pt((bp.left + aPt.x) * a2p, (bp.top + aPt.y) * a2p);
|
||||
gfxSize size(innerWidth * a2p, aSize * a2p);
|
||||
nsCSSRendering::PaintDecorationLine(ctx, aColor, pt, size, aAscent * a2p,
|
||||
aOffset * a2p, aSize * a2p, aDecoration,
|
||||
NS_STYLE_BORDER_STYLE_SOLID, isRTL);
|
||||
gfxPoint pt(PresContext()->AppUnitsToGfxUnits(bp.left + aPt.x),
|
||||
PresContext()->AppUnitsToGfxUnits(bp.top + aPt.y));
|
||||
gfxSize size(PresContext()->AppUnitsToGfxUnits(innerWidth),
|
||||
PresContext()->AppUnitsToGfxUnits(aSize));
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
ctx, aColor, pt, size, PresContext()->AppUnitsToGfxUnits(aAscent),
|
||||
PresContext()->AppUnitsToGfxUnits(aOffset),
|
||||
PresContext()->AppUnitsToGfxUnits(aSize),
|
||||
aDecoration, NS_STYLE_BORDER_STYLE_SOLID, isRTL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -560,7 +560,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
fm->GetMaxAscent(aMetrics.ascent);
|
||||
fm->GetHeight(aMetrics.height);
|
||||
// Include the text-decoration lines to the height.
|
||||
// Currently, only undeline is overflowable.
|
||||
// Currently, only underline is overflowable.
|
||||
nscoord offset, size;
|
||||
fm->GetUnderline(offset, size);
|
||||
nscoord ascentAndUnderline =
|
||||
|
|
|
@ -3716,10 +3716,11 @@ FillClippedRect(gfxContext* aCtx, nsPresContext* aPresContext,
|
|||
{
|
||||
gfxRect r = aRect.Intersect(aDirtyRect);
|
||||
// For now, we need to put this in pixel coordinates
|
||||
float t2p = 1.0f / aPresContext->AppUnitsPerDevPixel();
|
||||
PRInt32 app = aPresContext->AppUnitsPerDevPixel();
|
||||
aCtx->NewPath();
|
||||
// pixel-snap
|
||||
aCtx->Rectangle(gfxRect(r.X()*t2p, r.Y()*t2p, r.Width()*t2p, r.Height()*t2p), PR_TRUE);
|
||||
aCtx->Rectangle(gfxRect(r.X() / app, r.Y() / app,
|
||||
r.Width() / app, r.Height() / app), PR_TRUE);
|
||||
aCtx->SetColor(gfxRGBA(aColor));
|
||||
aCtx->Fill();
|
||||
}
|
||||
|
@ -3790,12 +3791,12 @@ nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
|
|||
return;
|
||||
|
||||
gfxFont::Metrics fontMetrics = GetFontMetrics(aProvider.GetFontGroup());
|
||||
gfxFloat a2p = 1.0 / aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 app = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
// XXX aFramePt is in AppUnits, shouldn't it be nsFloatPoint?
|
||||
gfxPoint pt(aFramePt.x * a2p, aFramePt.y * a2p);
|
||||
gfxSize size(GetRect().width * a2p, 0);
|
||||
gfxFloat ascent = mAscent * a2p;
|
||||
gfxPoint pt(aFramePt.x / app, aFramePt.y / app);
|
||||
gfxSize size(GetRect().width / app, 0);
|
||||
gfxFloat ascent = mAscent / app;
|
||||
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE) {
|
||||
size.height = fontMetrics.underlineSize;
|
||||
|
@ -4174,13 +4175,13 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx,
|
|||
gfxFloat advance = hyphenWidth +
|
||||
mTextRun->GetAdvanceWidth(offset, length, &aProvider);
|
||||
if (type == aSelectionType) {
|
||||
gfxFloat a2p = 1.0 / aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 app = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
|
||||
// XXX aTextBaselinePt is in AppUnits, shouldn't it be nsFloatPoint?
|
||||
gfxPoint pt((aTextBaselinePt.x + xOffset) * a2p,
|
||||
(aTextBaselinePt.y - mAscent) * a2p);
|
||||
gfxFloat width = PR_ABS(advance) * a2p;
|
||||
gfxPoint pt((aTextBaselinePt.x + xOffset) / app,
|
||||
(aTextBaselinePt.y - mAscent) / app);
|
||||
gfxFloat width = PR_ABS(advance) / app;
|
||||
DrawSelectionDecorations(aCtx, aSelectionType, aTextPaintStyle,
|
||||
pt, width, mAscent * a2p, decorationMetrics,
|
||||
pt, width, mAscent / app, decorationMetrics,
|
||||
mTextRun->IsRightToLeft());
|
||||
}
|
||||
iterator.UpdateWithAdvance(advance);
|
||||
|
|
|
@ -50,6 +50,7 @@ REQUIRES = xpcom \
|
|||
string \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
|
|
|
@ -53,6 +53,7 @@ REQUIRES = xpcom \
|
|||
dom \
|
||||
widget \
|
||||
gfx \
|
||||
thebes \
|
||||
view \
|
||||
necko \
|
||||
webshell \
|
||||
|
|
|
@ -56,6 +56,7 @@ REQUIRES = xpcom \
|
|||
dom \
|
||||
content \
|
||||
gfx \
|
||||
thebes \
|
||||
widget \
|
||||
caps \
|
||||
locale \
|
||||
|
|
|
@ -452,14 +452,14 @@ nsTextBoxFrame::PaintTitle(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
nsRefPtr<gfxContext> ctx = (gfxContext*)
|
||||
aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
|
||||
gfxFloat a2p = 1.0 / presContext->AppUnitsPerDevPixel();
|
||||
gfxPoint pt(textRect.x * a2p, textRect.y * a2p);
|
||||
gfxFloat width = textRect.width * a2p;
|
||||
gfxFloat baselinePixel = baseline * a2p;
|
||||
gfxPoint pt(presContext->AppUnitsToGfxUnits(textRect.x),
|
||||
presContext->AppUnitsToGfxUnits(textRect.y));
|
||||
gfxFloat width = presContext->AppUnitsToGfxUnits(textRect.width);
|
||||
gfxFloat baselinePixel = presContext->AppUnitsToGfxUnits(baseline);
|
||||
if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
|
||||
fontMet->GetUnderline(offset, size);
|
||||
gfxFloat offsetPixel = offset * a2p;
|
||||
gfxFloat sizePixel = size * a2p;
|
||||
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
|
||||
gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE) {
|
||||
nsCSSRendering::PaintDecorationLine(ctx, overColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
|
@ -481,8 +481,8 @@ nsTextBoxFrame::PaintTitle(nsIRenderingContext& aRenderingContext,
|
|||
}
|
||||
if (decorations & NS_FONT_DECORATION_LINE_THROUGH) {
|
||||
fontMet->GetStrikeout(offset, size);
|
||||
gfxFloat offsetPixel = offset * a2p;
|
||||
gfxFloat sizePixel = size * a2p;
|
||||
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
|
||||
gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
|
||||
nsCSSRendering::PaintDecorationLine(ctx, underColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
baselinePixel, offsetPixel,
|
||||
|
|
|
@ -64,6 +64,7 @@ REQUIRES = xpcom \
|
|||
xpconnect \
|
||||
windowwatcher \
|
||||
gfx \
|
||||
thebes \
|
||||
content \
|
||||
layout \
|
||||
docshell \
|
||||
|
|
|
@ -66,6 +66,7 @@ REQUIRES = xpcom \
|
|||
unicharutil \
|
||||
dom \
|
||||
gfx \
|
||||
thebes \
|
||||
content \
|
||||
widget \
|
||||
mimetype \
|
||||
|
|
|
@ -61,6 +61,7 @@ REQUIRES = xpcom \
|
|||
content \
|
||||
view \
|
||||
gfx \
|
||||
thebes \
|
||||
locale \
|
||||
necko \
|
||||
$(NULL)
|
||||
|
|
|
@ -81,6 +81,7 @@ REQUIRES = \
|
|||
content \
|
||||
find \
|
||||
gfx \
|
||||
thebes \
|
||||
locale \
|
||||
unicharutil \
|
||||
xuldoc \
|
||||
|
|
|
@ -59,6 +59,7 @@ REQUIRES = \
|
|||
layout \
|
||||
docshell \
|
||||
gfx \
|
||||
thebes \
|
||||
necko \
|
||||
widget \
|
||||
content \
|
||||
|
|
|
@ -55,6 +55,7 @@ REQUIRES = content \
|
|||
editor \
|
||||
find \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
|
|
|
@ -55,6 +55,7 @@ REQUIRES = xpcom \
|
|||
js \
|
||||
docshell \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
|
|
|
@ -59,6 +59,7 @@ REQUIRES = xpcom \
|
|||
docshell \
|
||||
webshell \
|
||||
gfx \
|
||||
thebes \
|
||||
layout \
|
||||
content \
|
||||
dom \
|
||||
|
|
|
@ -64,6 +64,7 @@ REQUIRES = \
|
|||
widget \
|
||||
imglib2 \
|
||||
gfx \
|
||||
thebes \
|
||||
locale \
|
||||
xulapp \
|
||||
embed_base \
|
||||
|
|
Загрузка…
Ссылка в новой задаче