зеркало из https://github.com/mozilla/gecko-dev.git
Bug 641426. Part 2: Remove a bunch of direct gfxRect::pos/size usage. r=joe
This commit is contained in:
Родитель
3c866720cc
Коммит
629c1b7e18
|
@ -1965,7 +1965,7 @@ nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
||||||
nsresult
|
nsresult
|
||||||
nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
|
nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
|
||||||
{
|
{
|
||||||
if (!FloatValidate(rect.pos.x, rect.pos.y, rect.size.width, rect.size.height))
|
if (!FloatValidate(rect.X(), rect.Y(), rect.Width(), rect.Height()))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
PathAutoSaveRestore pathSR(this);
|
PathAutoSaveRestore pathSR(this);
|
||||||
|
|
|
@ -2812,7 +2812,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||||
nsRefPtr<gfxImageSurface> blackImage;
|
nsRefPtr<gfxImageSurface> blackImage;
|
||||||
gfxRect targetRect(rect.x, rect.y, rect.width, rect.height);
|
gfxRect targetRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
gfxIntSize targetSize(rect.width, rect.height);
|
gfxIntSize targetSize(rect.width, rect.height);
|
||||||
gfxPoint deviceOffset = -targetRect.pos;
|
gfxPoint deviceOffset = -targetRect.TopLeft();
|
||||||
|
|
||||||
// We always use a temporary "white image"
|
// We always use a temporary "white image"
|
||||||
whiteImage = new gfxImageSurface(targetSize, gfxASurface::ImageFormatRGB24);
|
whiteImage = new gfxImageSurface(targetSize, gfxASurface::ImageFormatRGB24);
|
||||||
|
@ -2831,7 +2831,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||||
// background and copy the result
|
// background and copy the result
|
||||||
PaintRectToSurface(rect, aSurface, gfxRGBA(1.0, 1.0, 1.0));
|
PaintRectToSurface(rect, aSurface, gfxRGBA(1.0, 1.0, 1.0));
|
||||||
{
|
{
|
||||||
gfxRect copyRect(gfxPoint(0, 0), targetRect.size);
|
gfxRect copyRect(gfxPoint(0, 0), targetRect.Size());
|
||||||
nsRefPtr<gfxContext> ctx = new gfxContext(whiteImage);
|
nsRefPtr<gfxContext> ctx = new gfxContext(whiteImage);
|
||||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||||
ctx->SetSource(aSurface, deviceOffset);
|
ctx->SetSource(aSurface, deviceOffset);
|
||||||
|
|
|
@ -290,8 +290,8 @@ Layer::SnapTransform(const gfx3DMatrix& aTransform,
|
||||||
}
|
}
|
||||||
// compute translation factors that will move aSnapRect to the snapped rect
|
// compute translation factors that will move aSnapRect to the snapped rect
|
||||||
// given those scale factors
|
// given those scale factors
|
||||||
snappedMatrix.x0 = topLeft.x - aSnapRect.pos.x*snappedMatrix.xx;
|
snappedMatrix.x0 = topLeft.x - aSnapRect.X()*snappedMatrix.xx;
|
||||||
snappedMatrix.y0 = topLeft.y - aSnapRect.pos.y*snappedMatrix.yy;
|
snappedMatrix.y0 = topLeft.y - aSnapRect.Y()*snappedMatrix.yy;
|
||||||
result = gfx3DMatrix::From2D(snappedMatrix);
|
result = gfx3DMatrix::From2D(snappedMatrix);
|
||||||
if (aResidualTransform && !snappedMatrix.IsSingular()) {
|
if (aResidualTransform && !snappedMatrix.IsSingular()) {
|
||||||
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
|
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
|
||||||
|
|
|
@ -55,7 +55,7 @@ ScaledSize(const nsIntSize& aSize, float aXScale, float aYScale)
|
||||||
gfxRect rect(0, 0, aSize.width, aSize.height);
|
gfxRect rect(0, 0, aSize.width, aSize.height);
|
||||||
rect.Scale(aXScale, aYScale);
|
rect.Scale(aXScale, aYScale);
|
||||||
rect.RoundOut();
|
rect.RoundOut();
|
||||||
return nsIntSize(rect.size.width, rect.size.height);
|
return nsIntSize(rect.Width(), rect.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect
|
nsIntRect
|
||||||
|
@ -201,9 +201,9 @@ MovePixels(gfxASurface* aBuffer,
|
||||||
src.Round();
|
src.Round();
|
||||||
dest.Round();
|
dest.Round();
|
||||||
|
|
||||||
aBuffer->MovePixels(nsIntRect(src.pos.x, src.pos.y,
|
aBuffer->MovePixels(nsIntRect(src.X(), src.Y(),
|
||||||
src.size.width, src.size.height),
|
src.Width(), src.Height()),
|
||||||
nsIntPoint(dest.pos.x, dest.pos.y));
|
nsIntPoint(dest.X(), dest.Y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ ToOutsideIntRect(const gfxRect &aRect)
|
||||||
{
|
{
|
||||||
gfxRect r = aRect;
|
gfxRect r = aRect;
|
||||||
r.RoundOut();
|
r.RoundOut();
|
||||||
return nsIntRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
|
return nsIntRect(r.X(), r.Y(), r.Width(), r.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsIntRect
|
static nsIntRect
|
||||||
|
@ -1067,7 +1067,7 @@ ToInsideIntRect(const gfxRect& aRect)
|
||||||
{
|
{
|
||||||
gfxRect r = aRect;
|
gfxRect r = aRect;
|
||||||
r.RoundIn();
|
r.RoundIn();
|
||||||
return nsIntRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
|
return nsIntRect(r.X(), r.Y(), r.Width(), r.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1194,11 +1194,11 @@ BasicLayerManager::PushGroupWithCachedSurface(gfxContext *aTarget,
|
||||||
|
|
||||||
nsRefPtr<gfxContext> ctx =
|
nsRefPtr<gfxContext> ctx =
|
||||||
mCachedSurface.Get(aContent,
|
mCachedSurface.Get(aContent,
|
||||||
gfxIntSize(clip.size.width, clip.size.height),
|
gfxIntSize(clip.Width(), clip.Height()),
|
||||||
currentSurf);
|
currentSurf);
|
||||||
/* Align our buffer for the original surface */
|
/* Align our buffer for the original surface */
|
||||||
ctx->Translate(-clip.pos);
|
ctx->Translate(-clip.TopLeft());
|
||||||
*aSavedOffset = clip.pos;
|
*aSavedOffset = clip.TopLeft();
|
||||||
ctx->Multiply(saveMatrix.Matrix());
|
ctx->Multiply(saveMatrix.Matrix());
|
||||||
return ctx.forget();
|
return ctx.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -712,7 +712,7 @@ LayerManagerOGL::WorldTransformRect(nsIntRect& aRect)
|
||||||
{
|
{
|
||||||
gfxRect grect(aRect.x, aRect.y, aRect.width, aRect.height);
|
gfxRect grect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
grect = mWorldMatrix.TransformBounds(grect);
|
grect = mWorldMatrix.TransformBounds(grect);
|
||||||
aRect.SetRect(grect.pos.x, grect.pos.y, grect.size.width, grect.size.height);
|
aRect.SetRect(grect.X(), grect.Y(), grect.Width(), grect.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -918,8 +918,8 @@ ShadowBufferOGL::Upload(gfxASurface* aUpdate, const nsIntRegion& aUpdated,
|
||||||
destRect.RoundOut();
|
destRect.RoundOut();
|
||||||
|
|
||||||
// NB: this gfxContext must not escape EndUpdate() below
|
// NB: this gfxContext must not escape EndUpdate() below
|
||||||
nsIntRegion scaledDestRegion(nsIntRect(destRect.pos.x, destRect.pos.y,
|
nsIntRegion scaledDestRegion(nsIntRect(destRect.X(), destRect.Y(),
|
||||||
destRect.size.width, destRect.size.height));
|
destRect.Width(), destRect.Height()));
|
||||||
mTexImage->DirectUpdate(aUpdate, scaledDestRegion);
|
mTexImage->DirectUpdate(aUpdate, scaledDestRegion);
|
||||||
|
|
||||||
mBufferRect = aRect;
|
mBufferRect = aRect;
|
||||||
|
|
|
@ -304,30 +304,30 @@ static PRBool
|
||||||
ConditionRect(gfxRect& r) {
|
ConditionRect(gfxRect& r) {
|
||||||
// if either x or y is way out of bounds;
|
// if either x or y is way out of bounds;
|
||||||
// note that we don't handle negative w/h here
|
// note that we don't handle negative w/h here
|
||||||
if (r.pos.x > CAIRO_COORD_MAX || r.pos.y > CAIRO_COORD_MAX)
|
if (r.X() > CAIRO_COORD_MAX || r.Y() > CAIRO_COORD_MAX)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
if (r.pos.x < 0.0) {
|
if (r.X() < 0.0) {
|
||||||
r.size.width += r.pos.x;
|
r.size.width += r.X();
|
||||||
if (r.size.width < 0.0)
|
if (r.size.width < 0.0)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
r.pos.x = 0.0;
|
r.pos.x = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.pos.x + r.size.width > CAIRO_COORD_MAX) {
|
if (r.XMost() > CAIRO_COORD_MAX) {
|
||||||
r.size.width = CAIRO_COORD_MAX - r.pos.x;
|
r.size.width = CAIRO_COORD_MAX - r.X();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.pos.y < 0.0) {
|
if (r.Y() < 0.0) {
|
||||||
r.size.height += r.pos.y;
|
r.size.height += r.Y();
|
||||||
if (r.size.height < 0.0)
|
if (r.Height() < 0.0)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
r.pos.y = 0.0;
|
r.pos.y = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.pos.y + r.size.height > CAIRO_COORD_MAX) {
|
if (r.YMost() > CAIRO_COORD_MAX) {
|
||||||
r.size.height = CAIRO_COORD_MAX - r.pos.y;
|
r.size.height = CAIRO_COORD_MAX - r.Y();
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,8 +290,8 @@ void
|
||||||
gfxASurface::MarkDirty(const gfxRect& r)
|
gfxASurface::MarkDirty(const gfxRect& r)
|
||||||
{
|
{
|
||||||
cairo_surface_mark_dirty_rectangle(mSurface,
|
cairo_surface_mark_dirty_rectangle(mSurface,
|
||||||
(int) r.pos.x, (int) r.pos.y,
|
(int) r.X(), (int) r.Y(),
|
||||||
(int) r.size.width, (int) r.size.height);
|
(int) r.Width(), (int) r.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -247,7 +247,7 @@ gfxContext::Rectangle(const gfxRect& rect, PRBool snapToPixels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_rectangle(mCairo, rect.pos.x, rect.pos.y, rect.size.width, rect.size.height);
|
cairo_rectangle(mCairo, rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -386,11 +386,7 @@ gfxContext::UserToDevice(const gfxSize& size) const
|
||||||
gfxRect
|
gfxRect
|
||||||
gfxContext::UserToDevice(const gfxRect& rect) const
|
gfxContext::UserToDevice(const gfxRect& rect) const
|
||||||
{
|
{
|
||||||
double xmin, ymin, xmax, ymax;
|
double xmin = rect.X(), ymin = rect.Y(), xmax = rect.XMost(), ymax = rect.YMost();
|
||||||
xmin = rect.pos.x;
|
|
||||||
ymin = rect.pos.y;
|
|
||||||
xmax = rect.pos.x + rect.size.width;
|
|
||||||
ymax = rect.pos.y + rect.size.height;
|
|
||||||
|
|
||||||
double x[3], y[3];
|
double x[3], y[3];
|
||||||
x[0] = xmin; y[0] = ymax;
|
x[0] = xmin; y[0] = ymax;
|
||||||
|
@ -444,9 +440,9 @@ gfxContext::UserToDevicePixelSnapped(gfxRect& rect, PRBool ignoreScale) const
|
||||||
p1.Round();
|
p1.Round();
|
||||||
p3.Round();
|
p3.Round();
|
||||||
|
|
||||||
rect.pos = gfxPoint(NS_MIN(p1.x, p3.x), NS_MIN(p1.y, p3.y));
|
rect.MoveTo(gfxPoint(NS_MIN(p1.x, p3.x), NS_MIN(p1.y, p3.y)));
|
||||||
rect.size = gfxSize(NS_MAX(p1.x, p3.x) - rect.pos.x,
|
rect.SizeTo(gfxSize(NS_MAX(p1.x, p3.x) - rect.X(),
|
||||||
NS_MAX(p1.y, p3.y) - rect.pos.y);
|
NS_MAX(p1.y, p3.y) - rect.Y()));
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,8 +493,8 @@ gfxContext::PixelSnappedRectangleAndSetPattern(const gfxRect& rect,
|
||||||
IdentityMatrix();
|
IdentityMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
Translate(r.pos);
|
Translate(r.TopLeft());
|
||||||
r.pos.x = r.pos.y = 0;
|
r.MoveTo(gfxPoint(0, 0));
|
||||||
Rectangle(r);
|
Rectangle(r);
|
||||||
SetPattern(pattern);
|
SetPattern(pattern);
|
||||||
|
|
||||||
|
@ -635,7 +631,7 @@ void
|
||||||
gfxContext::Clip(const gfxRect& rect)
|
gfxContext::Clip(const gfxRect& rect)
|
||||||
{
|
{
|
||||||
cairo_new_path(mCairo);
|
cairo_new_path(mCairo);
|
||||||
cairo_rectangle(mCairo, rect.pos.x, rect.pos.y, rect.size.width, rect.size.height);
|
cairo_rectangle(mCairo, rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||||
cairo_clip(mCairo);
|
cairo_clip(mCairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,9 +973,9 @@ gfxContext::RoundedRectangle(const gfxRect& rect,
|
||||||
gfxPoint pc, p0, p1, p2, p3;
|
gfxPoint pc, p0, p1, p2, p3;
|
||||||
|
|
||||||
if (draw_clockwise)
|
if (draw_clockwise)
|
||||||
cairo_move_to(mCairo, rect.pos.x + corners[NS_CORNER_TOP_LEFT].width, rect.pos.y);
|
cairo_move_to(mCairo, rect.X() + corners[NS_CORNER_TOP_LEFT].width, rect.Y());
|
||||||
else
|
else
|
||||||
cairo_move_to(mCairo, rect.pos.x + rect.size.width - corners[NS_CORNER_TOP_RIGHT].width, rect.pos.y);
|
cairo_move_to(mCairo, rect.X() + rect.Width() - corners[NS_CORNER_TOP_RIGHT].width, rect.Y());
|
||||||
|
|
||||||
NS_FOR_CSS_CORNERS(i) {
|
NS_FOR_CSS_CORNERS(i) {
|
||||||
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
|
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
|
||||||
|
|
|
@ -1360,9 +1360,9 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||||
advance, metrics.mBoundingBox.Height());
|
advance, metrics.mBoundingBox.Height());
|
||||||
}
|
}
|
||||||
if (isRTL) {
|
if (isRTL) {
|
||||||
glyphRect.pos.x -= advance;
|
glyphRect -= gfxPoint(advance, 0);
|
||||||
}
|
}
|
||||||
glyphRect.pos.x += x;
|
glyphRect += gfxPoint(x, 0);
|
||||||
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1389,9 +1389,9 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||||
advance, metrics.mAscent + metrics.mDescent);
|
advance, metrics.mAscent + metrics.mDescent);
|
||||||
}
|
}
|
||||||
if (isRTL) {
|
if (isRTL) {
|
||||||
glyphRect.pos.x -= advance;
|
glyphRect -= gfxPoint(advance, 0);
|
||||||
}
|
}
|
||||||
glyphRect.pos.x += x;
|
glyphRect += gfxPoint(x, 0);
|
||||||
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
||||||
x += direction*advance;
|
x += direction*advance;
|
||||||
}
|
}
|
||||||
|
@ -1414,7 +1414,7 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||||
metrics.mBoundingBox = metrics.mBoundingBox.Union(fontBox);
|
metrics.mBoundingBox = metrics.mBoundingBox.Union(fontBox);
|
||||||
}
|
}
|
||||||
if (isRTL) {
|
if (isRTL) {
|
||||||
metrics.mBoundingBox.pos.x -= x;
|
metrics.mBoundingBox -= gfxPoint(x, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.mAdvanceWidth = x*direction;
|
metrics.mAdvanceWidth = x*direction;
|
||||||
|
@ -1943,10 +1943,10 @@ gfxGlyphExtents::SetTightGlyphExtents(PRUint32 aGlyphID, const gfxRect& aExtents
|
||||||
HashEntry *entry = mTightGlyphExtents.PutEntry(aGlyphID);
|
HashEntry *entry = mTightGlyphExtents.PutEntry(aGlyphID);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return;
|
return;
|
||||||
entry->x = aExtentsAppUnits.pos.x;
|
entry->x = aExtentsAppUnits.X();
|
||||||
entry->y = aExtentsAppUnits.pos.y;
|
entry->y = aExtentsAppUnits.Y();
|
||||||
entry->width = aExtentsAppUnits.size.width;
|
entry->width = aExtentsAppUnits.Width();
|
||||||
entry->height = aExtentsAppUnits.size.height;
|
entry->height = aExtentsAppUnits.Height();
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFontGroup::gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyle, gfxUserFontSet *aUserFontSet)
|
gfxFontGroup::gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyle, gfxUserFontSet *aUserFontSet)
|
||||||
|
|
|
@ -110,7 +110,7 @@ gfxMatrix::Transform(const gfxSize& size) const
|
||||||
gfxRect
|
gfxRect
|
||||||
gfxMatrix::Transform(const gfxRect& rect) const
|
gfxMatrix::Transform(const gfxRect& rect) const
|
||||||
{
|
{
|
||||||
return gfxRect(Transform(rect.pos), Transform(rect.size));
|
return gfxRect(Transform(rect.TopLeft()), Transform(rect.Size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxRect
|
gfxRect
|
||||||
|
@ -122,20 +122,20 @@ gfxMatrix::TransformBounds(const gfxRect& rect) const
|
||||||
double min_x, max_x;
|
double min_x, max_x;
|
||||||
double min_y, max_y;
|
double min_y, max_y;
|
||||||
|
|
||||||
quad_x[0] = rect.pos.x;
|
quad_x[0] = rect.X();
|
||||||
quad_y[0] = rect.pos.y;
|
quad_y[0] = rect.Y();
|
||||||
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[0], &quad_y[0]);
|
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[0], &quad_y[0]);
|
||||||
|
|
||||||
quad_x[1] = rect.pos.x + rect.size.width;
|
quad_x[1] = rect.XMost();
|
||||||
quad_y[1] = rect.pos.y;
|
quad_y[1] = rect.Y();
|
||||||
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[1], &quad_y[1]);
|
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[1], &quad_y[1]);
|
||||||
|
|
||||||
quad_x[2] = rect.pos.x;
|
quad_x[2] = rect.X();
|
||||||
quad_y[2] = rect.pos.y + rect.size.height;
|
quad_y[2] = rect.YMost();
|
||||||
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[2], &quad_y[2]);
|
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[2], &quad_y[2]);
|
||||||
|
|
||||||
quad_x[3] = rect.pos.x + rect.size.width;
|
quad_x[3] = rect.XMost();
|
||||||
quad_y[3] = rect.pos.y + rect.size.height;
|
quad_y[3] = rect.YMost();
|
||||||
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[3], &quad_y[3]);
|
cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[3], &quad_y[3]);
|
||||||
|
|
||||||
min_x = max_x = quad_x[0];
|
min_x = max_x = quad_x[0];
|
||||||
|
@ -153,24 +153,6 @@ gfxMatrix::TransformBounds(const gfxRect& rect) const
|
||||||
max_y = quad_y[i];
|
max_y = quad_y[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't compute this now
|
|
||||||
#if 0
|
|
||||||
if (is_tight) {
|
|
||||||
/* it's tight if and only if the four corner points form an axis-aligned
|
|
||||||
rectangle.
|
|
||||||
And that's true if and only if we can derive corners 0 and 3 from
|
|
||||||
corners 1 and 2 in one of two straightforward ways...
|
|
||||||
We could use a tolerance here but for now we'll fall back to FALSE in the case
|
|
||||||
of floating point error.
|
|
||||||
*/
|
|
||||||
*is_tight =
|
|
||||||
(quad_x[1] == quad_x[0] && quad_y[1] == quad_y[3] &&
|
|
||||||
quad_x[2] == quad_x[3] && quad_y[2] == quad_y[0]) ||
|
|
||||||
(quad_x[1] == quad_x[3] && quad_y[1] == quad_y[0] &&
|
|
||||||
quad_x[2] == quad_x[0] && quad_y[2] == quad_y[3]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return gfxRect(min_x, min_y, max_x - min_x, max_y - min_y);
|
return gfxRect(min_x, min_y, max_x - min_x, max_y - min_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
|
||||||
// bug 382049 - need to explicity set the composite operation to sourceOver
|
// bug 382049 - need to explicity set the composite operation to sourceOver
|
||||||
CGContextSetCompositeOperation(mCGContext, kPrivateCGCompositeSourceOver);
|
CGContextSetCompositeOperation(mCGContext, kPrivateCGCompositeSourceOver);
|
||||||
} else {
|
} else {
|
||||||
mQuartzSurface = new gfxQuartzSurface(mNativeRect.size,
|
mQuartzSurface = new gfxQuartzSurface(mNativeRect.Size(),
|
||||||
gfxASurface::ImageFormatARGB32);
|
gfxASurface::ImageFormatARGB32);
|
||||||
if (mQuartzSurface->CairoStatus())
|
if (mQuartzSurface->CairoStatus())
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
@ -133,6 +133,6 @@ gfxQuartzNativeDrawing::EndNativeDrawing()
|
||||||
|
|
||||||
// Copy back to destination
|
// Copy back to destination
|
||||||
mContext->Translate(mNativeRect.TopLeft());
|
mContext->Translate(mNativeRect.TopLeft());
|
||||||
mContext->DrawSurface(mQuartzSurface, mNativeRect.size);
|
mContext->DrawSurface(mQuartzSurface, mNativeRect.Size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,16 +90,45 @@ struct THEBES_API gfxRect {
|
||||||
return (pos != s.pos) || (size != s.size);
|
return (pos != s.pos) || (size != s.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveTo(const gfxPoint& aPt) { pos = aPt; }
|
||||||
const gfxRect& MoveBy(const gfxPoint& aPt) {
|
const gfxRect& MoveBy(const gfxPoint& aPt) {
|
||||||
pos = pos + aPt;
|
pos = pos + aPt;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
void SizeTo(const gfxSize& aSize) { size = aSize; }
|
||||||
|
|
||||||
gfxRect operator+(const gfxPoint& aPt) const {
|
gfxRect operator+(const gfxPoint& aPt) const {
|
||||||
return gfxRect(pos + aPt, size);
|
return gfxRect(pos + aPt, size);
|
||||||
}
|
}
|
||||||
gfxRect operator-(const gfxPoint& aPt) const {
|
gfxRect operator-(const gfxPoint& aPt) const {
|
||||||
return gfxRect(pos - aPt, size);
|
return gfxRect(pos - aPt, size);
|
||||||
}
|
}
|
||||||
|
gfxRect operator+(const gfxSize& aSize) const {
|
||||||
|
return gfxRect(pos + gfxPoint(aSize.width, aSize.height), size);
|
||||||
|
}
|
||||||
|
gfxRect operator-(const gfxSize& aSize) const {
|
||||||
|
return gfxRect(pos - gfxPoint(aSize.width, aSize.height), size);
|
||||||
|
}
|
||||||
|
gfxRect operator*(const gfxFloat aScale) const {
|
||||||
|
return gfxRect(pos * aScale, size * aScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
const gfxRect& operator+=(const gfxPoint& aPt) {
|
||||||
|
pos += aPt;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
const gfxRect& operator-=(const gfxPoint& aPt) {
|
||||||
|
pos -= aPt;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
const gfxRect& operator+=(const gfxSize& aSize) {
|
||||||
|
pos += gfxPoint(aSize.width, aSize.height);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
const gfxRect& operator-=(const gfxSize& aSize) {
|
||||||
|
pos -= gfxPoint(aSize.width, aSize.height);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
gfxFloat Width() const { return size.width; }
|
gfxFloat Width() const { return size.width; }
|
||||||
gfxFloat Height() const { return size.height; }
|
gfxFloat Height() const { return size.height; }
|
||||||
|
@ -122,8 +151,7 @@ struct THEBES_API gfxRect {
|
||||||
*/
|
*/
|
||||||
PRBool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
|
PRBool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
|
||||||
|
|
||||||
gfxPoint TopLeft() { return pos; }
|
gfxSize Size() const { return size; }
|
||||||
gfxPoint BottomRight() { return gfxPoint(XMost(), YMost()); }
|
|
||||||
|
|
||||||
void Inset(gfxFloat k) {
|
void Inset(gfxFloat k) {
|
||||||
pos.x += k;
|
pos.x += k;
|
||||||
|
|
|
@ -272,15 +272,15 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
|
||||||
|
|
||||||
nsRefPtr<gfxContext> tmpCtx = new gfxContext(temp);
|
nsRefPtr<gfxContext> tmpCtx = new gfxContext(temp);
|
||||||
tmpCtx->SetOperator(OptimalFillOperator());
|
tmpCtx->SetOperator(OptimalFillOperator());
|
||||||
aDrawable->Draw(tmpCtx, needed - needed.pos, PR_TRUE,
|
aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), PR_TRUE,
|
||||||
gfxPattern::FILTER_FAST, gfxMatrix().Translate(needed.pos));
|
gfxPattern::FILTER_FAST, gfxMatrix().Translate(needed.TopLeft()));
|
||||||
|
|
||||||
nsRefPtr<gfxPattern> resultPattern = new gfxPattern(temp);
|
nsRefPtr<gfxPattern> resultPattern = new gfxPattern(temp);
|
||||||
if (!resultPattern)
|
if (!resultPattern)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
nsRefPtr<gfxDrawable> drawable =
|
nsRefPtr<gfxDrawable> drawable =
|
||||||
new gfxSurfaceDrawable(temp, size, gfxMatrix().Translate(-needed.pos));
|
new gfxSurfaceDrawable(temp, size, gfxMatrix().Translate(-needed.TopLeft()));
|
||||||
return drawable.forget();
|
return drawable.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,9 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
||||||
// and it fixes bug 382458
|
// and it fixes bug 382458
|
||||||
// There's probably a better fix, but I haven't figured out
|
// There's probably a better fix, but I haven't figured out
|
||||||
// the root cause of the problem.
|
// the root cause of the problem.
|
||||||
mTempSurfaceSize.width = (PRInt32) NS_ceil(mNativeRect.size.width + 1);
|
mTempSurfaceSize =
|
||||||
mTempSurfaceSize.height = (PRInt32) NS_ceil(mNativeRect.size.height + 1);
|
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() + 1),
|
||||||
|
(PRInt32) NS_ceil(mNativeRect.Height() + 1));
|
||||||
} else {
|
} else {
|
||||||
// figure out the scale factors
|
// figure out the scale factors
|
||||||
mScale = m.ScaleFactors(PR_TRUE);
|
mScale = m.ScaleFactors(PR_TRUE);
|
||||||
|
@ -151,8 +152,9 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
||||||
mWorldTransform.eDy = 0.0f;
|
mWorldTransform.eDy = 0.0f;
|
||||||
|
|
||||||
// See comment above about "+1"
|
// See comment above about "+1"
|
||||||
mTempSurfaceSize.width = (PRInt32) NS_ceil(mNativeRect.size.width * mScale.width + 1);
|
mTempSurfaceSize =
|
||||||
mTempSurfaceSize.height = (PRInt32) NS_ceil(mNativeRect.size.height * mScale.height + 1);
|
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() * mScale.width + 1),
|
||||||
|
(PRInt32) NS_ceil(mNativeRect.Height() * mScale.height + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,9 +296,9 @@ gfxWindowsNativeDrawing::PaintToContext()
|
||||||
gfxASurface::ImageFormatARGB32);
|
gfxASurface::ImageFormatARGB32);
|
||||||
|
|
||||||
mContext->Save();
|
mContext->Save();
|
||||||
mContext->Translate(mNativeRect.pos);
|
mContext->Translate(mNativeRect.TopLeft());
|
||||||
mContext->NewPath();
|
mContext->NewPath();
|
||||||
mContext->Rectangle(gfxRect(gfxPoint(0.0, 0.0), mNativeRect.size));
|
mContext->Rectangle(gfxRect(gfxPoint(0.0, 0.0), mNativeRect.Size()));
|
||||||
|
|
||||||
nsRefPtr<gfxPattern> pat = new gfxPattern(alphaSurface);
|
nsRefPtr<gfxPattern> pat = new gfxPattern(alphaSurface);
|
||||||
|
|
||||||
|
@ -334,7 +336,7 @@ gfxWindowsNativeDrawing::TransformToNativeRect(const gfxRect& r,
|
||||||
roundedRect.MoveBy(mTranslation);
|
roundedRect.MoveBy(mTranslation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
roundedRect.MoveBy(- mNativeRect.pos);
|
roundedRect.MoveBy(-mNativeRect.TopLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
roundedRect.Round();
|
roundedRect.Round();
|
||||||
|
|
|
@ -1617,7 +1617,7 @@ SetupBackgroundClip(BackgroundClipState& aClipState, gfxContext *aCtx,
|
||||||
// http://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
|
// http://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
|
||||||
NS_WARNING("converted background area should not be empty");
|
NS_WARNING("converted background area should not be empty");
|
||||||
// Make our caller not do anything.
|
// Make our caller not do anything.
|
||||||
aClipState.mDirtyRectGfx.size.SizeTo(0.0, 0.0);
|
aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1657,7 +1657,7 @@ DrawBackgroundColor(BackgroundClipState& aClipState, gfxContext *aCtx,
|
||||||
// http://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
|
// http://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
|
||||||
NS_WARNING("converted background area should not be empty");
|
NS_WARNING("converted background area should not be empty");
|
||||||
// Make our caller not do anything.
|
// Make our caller not do anything.
|
||||||
aClipState.mDirtyRectGfx.size.SizeTo(0.0, 0.0);
|
aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1942,10 +1942,10 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
||||||
gfxPoint lineStart, lineEnd;
|
gfxPoint lineStart, lineEnd;
|
||||||
double radiusX = 0, radiusY = 0; // for radial gradients only
|
double radiusX = 0, radiusY = 0; // for radial gradients only
|
||||||
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
|
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
|
||||||
ComputeLinearGradientLine(aPresContext, aGradient, oneCellArea.size,
|
ComputeLinearGradientLine(aPresContext, aGradient, oneCellArea.Size(),
|
||||||
&lineStart, &lineEnd);
|
&lineStart, &lineEnd);
|
||||||
} else {
|
} else {
|
||||||
ComputeRadialGradientLine(aPresContext, aGradient, oneCellArea.size,
|
ComputeRadialGradientLine(aPresContext, aGradient, oneCellArea.Size(),
|
||||||
&lineStart, &lineEnd, &radiusX, &radiusY);
|
&lineStart, &lineEnd, &radiusX, &radiusY);
|
||||||
}
|
}
|
||||||
gfxFloat lineLength = NS_hypot(lineEnd.x - lineStart.x,
|
gfxFloat lineLength = NS_hypot(lineEnd.x - lineStart.x,
|
||||||
|
@ -2192,9 +2192,9 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
||||||
// tile with the overall area we're supposed to be filling
|
// tile with the overall area we're supposed to be filling
|
||||||
gfxRect fillRect = tileRect.Intersect(areaToFill);
|
gfxRect fillRect = tileRect.Intersect(areaToFill);
|
||||||
ctx->NewPath();
|
ctx->NewPath();
|
||||||
ctx->Translate(tileRect.pos);
|
ctx->Translate(tileRect.TopLeft());
|
||||||
ctx->SetPattern(gradientPattern);
|
ctx->SetPattern(gradientPattern);
|
||||||
ctx->Rectangle(fillRect - tileRect.pos, PR_TRUE);
|
ctx->Rectangle(fillRect - tileRect.TopLeft(), PR_TRUE);
|
||||||
ctx->Fill();
|
ctx->Fill();
|
||||||
ctx->SetMatrix(ctm);
|
ctx->SetMatrix(ctm);
|
||||||
}
|
}
|
||||||
|
@ -3560,7 +3560,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
||||||
rect.pos.x += lineHeight / 2.0;
|
rect.pos.x += lineHeight / 2.0;
|
||||||
aGfxContext->NewPath();
|
aGfxContext->NewPath();
|
||||||
|
|
||||||
gfxPoint pt(rect.pos);
|
gfxPoint pt(rect.TopLeft());
|
||||||
gfxFloat rightMost = pt.x + rect.Width() + lineHeight;
|
gfxFloat rightMost = pt.x + rect.Width() + lineHeight;
|
||||||
gfxFloat adv = rect.Height() - lineHeight;
|
gfxFloat adv = rect.Height() - lineHeight;
|
||||||
gfxFloat flatLengthAtVertex = NS_MAX((lineHeight - 1.0) * 2.0, 1.0);
|
gfxFloat flatLengthAtVertex = NS_MAX((lineHeight - 1.0) * 2.0, 1.0);
|
||||||
|
@ -3568,7 +3568,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
||||||
pt.x -= lineHeight;
|
pt.x -= lineHeight;
|
||||||
aGfxContext->MoveTo(pt); // 1
|
aGfxContext->MoveTo(pt); // 1
|
||||||
|
|
||||||
pt.x = rect.pos.x;
|
pt.x = rect.X();
|
||||||
aGfxContext->LineTo(pt); // 2
|
aGfxContext->LineTo(pt); // 2
|
||||||
|
|
||||||
PRBool goDown = PR_TRUE;
|
PRBool goDown = PR_TRUE;
|
||||||
|
@ -3640,9 +3640,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
||||||
|
|
||||||
PRBool canLiftUnderline = aDescentLimit >= 0.0;
|
PRBool canLiftUnderline = aDescentLimit >= 0.0;
|
||||||
|
|
||||||
gfxRect r;
|
gfxRect r(NS_floor(aPt.x + 0.5), 0, NS_round(aLineSize.width), 0);
|
||||||
r.pos.x = NS_floor(aPt.x + 0.5);
|
|
||||||
r.size.width = NS_round(aLineSize.width);
|
|
||||||
|
|
||||||
gfxFloat lineHeight = NS_round(aLineSize.height);
|
gfxFloat lineHeight = NS_round(aLineSize.height);
|
||||||
lineHeight = NS_MAX(lineHeight, 1.0);
|
lineHeight = NS_MAX(lineHeight, 1.0);
|
||||||
|
|
|
@ -225,10 +225,10 @@ ComputeBorderCornerDimensions(const gfxRect& aOuterRect,
|
||||||
const gfxCornerSizes& aRadii,
|
const gfxCornerSizes& aRadii,
|
||||||
gfxCornerSizes *aDimsRet)
|
gfxCornerSizes *aDimsRet)
|
||||||
{
|
{
|
||||||
gfxFloat topWidth = aInnerRect.pos.y - aOuterRect.pos.y;
|
gfxFloat leftWidth = aInnerRect.X() - aOuterRect.X();
|
||||||
gfxFloat leftWidth = aInnerRect.pos.x - aOuterRect.pos.x;
|
gfxFloat topWidth = aInnerRect.Y() - aOuterRect.Y();
|
||||||
gfxFloat rightWidth = aOuterRect.size.width - aInnerRect.size.width - leftWidth;
|
gfxFloat rightWidth = aOuterRect.Width() - aInnerRect.Width() - leftWidth;
|
||||||
gfxFloat bottomWidth = aOuterRect.size.height - aInnerRect.size.height - topWidth;
|
gfxFloat bottomWidth = aOuterRect.Height() - aInnerRect.Height() - topWidth;
|
||||||
|
|
||||||
if (AllCornersZeroSize(aRadii)) {
|
if (AllCornersZeroSize(aRadii)) {
|
||||||
// These will always be in pixel units from CSS
|
// These will always be in pixel units from CSS
|
||||||
|
@ -354,11 +354,11 @@ nsCSSBorderRenderer::DoCornerSubPath(mozilla::css::Corner aCorner)
|
||||||
gfxPoint offset(0.0, 0.0);
|
gfxPoint offset(0.0, 0.0);
|
||||||
|
|
||||||
if (aCorner == C_TR || aCorner == C_BR)
|
if (aCorner == C_TR || aCorner == C_BR)
|
||||||
offset.x = mOuterRect.size.width - mBorderCornerDimensions[aCorner].width;
|
offset.x = mOuterRect.Width() - mBorderCornerDimensions[aCorner].width;
|
||||||
if (aCorner == C_BR || aCorner == C_BL)
|
if (aCorner == C_BR || aCorner == C_BL)
|
||||||
offset.y = mOuterRect.size.height - mBorderCornerDimensions[aCorner].height;
|
offset.y = mOuterRect.Height() - mBorderCornerDimensions[aCorner].height;
|
||||||
|
|
||||||
mContext->Rectangle(gfxRect(mOuterRect.pos + offset,
|
mContext->Rectangle(gfxRect(mOuterRect.TopLeft() + offset,
|
||||||
mBorderCornerDimensions[aCorner]));
|
mBorderCornerDimensions[aCorner]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,11 +375,11 @@ nsCSSBorderRenderer::DoSideClipWithoutCornersSubPath(mozilla::css::Side aSide)
|
||||||
if (aSide == NS_SIDE_TOP) {
|
if (aSide == NS_SIDE_TOP) {
|
||||||
offset.x = mBorderCornerDimensions[C_TL].width;
|
offset.x = mBorderCornerDimensions[C_TL].width;
|
||||||
} else if (aSide == NS_SIDE_RIGHT) {
|
} else if (aSide == NS_SIDE_RIGHT) {
|
||||||
offset.x = mOuterRect.size.width - mBorderWidths[NS_SIDE_RIGHT];
|
offset.x = mOuterRect.Width() - mBorderWidths[NS_SIDE_RIGHT];
|
||||||
offset.y = mBorderCornerDimensions[C_TR].height;
|
offset.y = mBorderCornerDimensions[C_TR].height;
|
||||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||||
offset.x = mBorderCornerDimensions[C_BL].width;
|
offset.x = mBorderCornerDimensions[C_BL].width;
|
||||||
offset.y = mOuterRect.size.height - mBorderWidths[NS_SIDE_BOTTOM];
|
offset.y = mOuterRect.Height() - mBorderWidths[NS_SIDE_BOTTOM];
|
||||||
} else if (aSide == NS_SIDE_LEFT) {
|
} else if (aSide == NS_SIDE_LEFT) {
|
||||||
offset.y = mBorderCornerDimensions[C_TL].height;
|
offset.y = mBorderCornerDimensions[C_TL].height;
|
||||||
}
|
}
|
||||||
|
@ -390,8 +390,8 @@ nsCSSBorderRenderer::DoSideClipWithoutCornersSubPath(mozilla::css::Side aSide)
|
||||||
// with both proceeding clockwise.
|
// with both proceeding clockwise.
|
||||||
gfxSize sideCornerSum = mBorderCornerDimensions[mozilla::css::Corner(aSide)]
|
gfxSize sideCornerSum = mBorderCornerDimensions[mozilla::css::Corner(aSide)]
|
||||||
+ mBorderCornerDimensions[mozilla::css::Corner(NEXT_SIDE(aSide))];
|
+ mBorderCornerDimensions[mozilla::css::Corner(NEXT_SIDE(aSide))];
|
||||||
gfxRect rect(mOuterRect.pos + offset,
|
gfxRect rect(mOuterRect.TopLeft() + offset,
|
||||||
mOuterRect.size - sideCornerSum);
|
mOuterRect.Size() - sideCornerSum);
|
||||||
|
|
||||||
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
|
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
|
||||||
rect.size.height = mBorderWidths[aSide];
|
rect.size.height = mBorderWidths[aSide];
|
||||||
|
@ -581,29 +581,27 @@ nsCSSBorderRenderer::FillSolidBorder(const gfxRect& aOuterRect,
|
||||||
|
|
||||||
// compute base rects for each side
|
// compute base rects for each side
|
||||||
if (aSides & SIDE_BIT_TOP) {
|
if (aSides & SIDE_BIT_TOP) {
|
||||||
r[NS_SIDE_TOP].pos = aOuterRect.TopLeft();
|
r[NS_SIDE_TOP] =
|
||||||
r[NS_SIDE_TOP].size.width = aOuterRect.size.width;
|
gfxRect(aOuterRect.X(), aOuterRect.Y(),
|
||||||
r[NS_SIDE_TOP].size.height = aBorderSizes[NS_SIDE_TOP];
|
aOuterRect.Width(), aBorderSizes[NS_SIDE_TOP]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSides & SIDE_BIT_BOTTOM) {
|
if (aSides & SIDE_BIT_BOTTOM) {
|
||||||
r[NS_SIDE_BOTTOM].pos = aOuterRect.BottomLeft();
|
r[NS_SIDE_BOTTOM] =
|
||||||
r[NS_SIDE_BOTTOM].pos.y -= aBorderSizes[NS_SIDE_BOTTOM];
|
gfxRect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[NS_SIDE_BOTTOM],
|
||||||
r[NS_SIDE_BOTTOM].size.width = aOuterRect.size.width;
|
aOuterRect.Width(), aBorderSizes[NS_SIDE_BOTTOM]);
|
||||||
r[NS_SIDE_BOTTOM].size.height = aBorderSizes[NS_SIDE_BOTTOM];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSides & SIDE_BIT_LEFT) {
|
if (aSides & SIDE_BIT_LEFT) {
|
||||||
r[NS_SIDE_LEFT].pos = aOuterRect.TopLeft();
|
r[NS_SIDE_LEFT] =
|
||||||
r[NS_SIDE_LEFT].size.width = aBorderSizes[NS_SIDE_LEFT];
|
gfxRect(aOuterRect.X(), aOuterRect.Y(),
|
||||||
r[NS_SIDE_LEFT].size.height = aOuterRect.size.height;
|
aBorderSizes[NS_SIDE_LEFT], aOuterRect.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSides & SIDE_BIT_RIGHT) {
|
if (aSides & SIDE_BIT_RIGHT) {
|
||||||
r[NS_SIDE_RIGHT].pos = aOuterRect.TopRight();
|
r[NS_SIDE_RIGHT] =
|
||||||
r[NS_SIDE_RIGHT].pos.x -= aBorderSizes[NS_SIDE_RIGHT];
|
gfxRect(aOuterRect.XMost() - aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Y(),
|
||||||
r[NS_SIDE_RIGHT].size.width = aBorderSizes[NS_SIDE_RIGHT];
|
aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Height());
|
||||||
r[NS_SIDE_RIGHT].size.height = aOuterRect.size.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If two sides meet at a corner that we're rendering, then
|
// If two sides meet at a corner that we're rendering, then
|
||||||
|
@ -695,7 +693,6 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorde
|
||||||
|
|
||||||
// the generic composite colors path; each border is 1px in size
|
// the generic composite colors path; each border is 1px in size
|
||||||
gfxRect soRect = mOuterRect;
|
gfxRect soRect = mOuterRect;
|
||||||
gfxRect siRect;
|
|
||||||
gfxFloat maxBorderWidth = 0;
|
gfxFloat maxBorderWidth = 0;
|
||||||
NS_FOR_CSS_SIDES (i) {
|
NS_FOR_CSS_SIDES (i) {
|
||||||
maxBorderWidth = NS_MAX(maxBorderWidth, mBorderWidths[i]);
|
maxBorderWidth = NS_MAX(maxBorderWidth, mBorderWidths[i]);
|
||||||
|
@ -703,21 +700,18 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorde
|
||||||
|
|
||||||
gfxFloat fakeBorderSizes[4];
|
gfxFloat fakeBorderSizes[4];
|
||||||
|
|
||||||
gfxRGBA lineColor;
|
|
||||||
gfxPoint tl, br;
|
|
||||||
|
|
||||||
gfxPoint itl = mInnerRect.TopLeft();
|
gfxPoint itl = mInnerRect.TopLeft();
|
||||||
gfxPoint ibr = mInnerRect.BottomRight();
|
gfxPoint ibr = mInnerRect.BottomRight();
|
||||||
|
|
||||||
for (PRUint32 i = 0; i < PRUint32(maxBorderWidth); i++) {
|
for (PRUint32 i = 0; i < PRUint32(maxBorderWidth); i++) {
|
||||||
lineColor = ComputeCompositeColorForLine(i, aCompositeColors);
|
gfxRGBA lineColor = ComputeCompositeColorForLine(i, aCompositeColors);
|
||||||
|
|
||||||
siRect = soRect;
|
gfxRect siRect = soRect;
|
||||||
siRect.Inset(1.0, 1.0, 1.0, 1.0);
|
siRect.Inset(1.0, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
// now cap the rects to the real mInnerRect
|
// now cap the rects to the real mInnerRect
|
||||||
tl = siRect.TopLeft();
|
gfxPoint tl = siRect.TopLeft();
|
||||||
br = siRect.BottomRight();
|
gfxPoint br = siRect.BottomRight();
|
||||||
|
|
||||||
tl.x = NS_MIN(tl.x, itl.x);
|
tl.x = NS_MIN(tl.x, itl.x);
|
||||||
tl.y = NS_MIN(tl.y, itl.y);
|
tl.y = NS_MIN(tl.y, itl.y);
|
||||||
|
@ -725,9 +719,7 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorde
|
||||||
br.x = NS_MAX(br.x, ibr.x);
|
br.x = NS_MAX(br.x, ibr.x);
|
||||||
br.y = NS_MAX(br.y, ibr.y);
|
br.y = NS_MAX(br.y, ibr.y);
|
||||||
|
|
||||||
siRect.pos = tl;
|
siRect = gfxRect(tl.x, tl.y, br.x - tl.x , br.y - tl.y);
|
||||||
siRect.size.width = br.x - tl.x;
|
|
||||||
siRect.size.height = br.y - tl.y;
|
|
||||||
|
|
||||||
fakeBorderSizes[NS_SIDE_TOP] = siRect.TopLeft().y - soRect.TopLeft().y;
|
fakeBorderSizes[NS_SIDE_TOP] = siRect.TopLeft().y - soRect.TopLeft().y;
|
||||||
fakeBorderSizes[NS_SIDE_RIGHT] = soRect.TopRight().x - siRect.TopRight().x;
|
fakeBorderSizes[NS_SIDE_RIGHT] = soRect.TopRight().x - siRect.TopRight().x;
|
||||||
|
|
|
@ -1009,9 +1009,7 @@ nsRect
|
||||||
nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor)
|
nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor)
|
||||||
{
|
{
|
||||||
/* Get a new gfxRect whose units are app units by scaling by the specified factor. */
|
/* Get a new gfxRect whose units are app units by scaling by the specified factor. */
|
||||||
gfxRect scaledRect(aRect.pos.x * aFactor, aRect.pos.y * aFactor,
|
gfxRect scaledRect = aRect * aFactor;
|
||||||
aRect.size.width * aFactor,
|
|
||||||
aRect.size.height * aFactor);
|
|
||||||
|
|
||||||
/* Round outward. */
|
/* Round outward. */
|
||||||
scaledRect.RoundOut();
|
scaledRect.RoundOut();
|
||||||
|
@ -1023,8 +1021,8 @@ nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor)
|
||||||
ConstrainToCoordValues(scaledRect.size.height);
|
ConstrainToCoordValues(scaledRect.size.height);
|
||||||
|
|
||||||
/* Now typecast everything back. This is guaranteed to be safe. */
|
/* Now typecast everything back. This is guaranteed to be safe. */
|
||||||
return nsRect(nscoord(scaledRect.pos.x), nscoord(scaledRect.pos.y),
|
return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()),
|
||||||
nscoord(scaledRect.size.width), nscoord(scaledRect.size.height));
|
nscoord(scaledRect.Width()), nscoord(scaledRect.Height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3088,8 +3086,8 @@ static gfxPoint
|
||||||
MapToFloatImagePixels(const gfxSize& aSize,
|
MapToFloatImagePixels(const gfxSize& aSize,
|
||||||
const gfxRect& aDest, const gfxPoint& aPt)
|
const gfxRect& aDest, const gfxPoint& aPt)
|
||||||
{
|
{
|
||||||
return gfxPoint(((aPt.x - aDest.pos.x)*aSize.width)/aDest.size.width,
|
return gfxPoint(((aPt.x - aDest.X())*aSize.width)/aDest.Width(),
|
||||||
((aPt.y - aDest.pos.y)*aSize.height)/aDest.size.height);
|
((aPt.y - aDest.Y())*aSize.height)/aDest.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3104,8 +3102,8 @@ static gfxPoint
|
||||||
MapToFloatUserPixels(const gfxSize& aSize,
|
MapToFloatUserPixels(const gfxSize& aSize,
|
||||||
const gfxRect& aDest, const gfxPoint& aPt)
|
const gfxRect& aDest, const gfxPoint& aPt)
|
||||||
{
|
{
|
||||||
return gfxPoint(aPt.x*aDest.size.width/aSize.width + aDest.pos.x,
|
return gfxPoint(aPt.x*aDest.Width()/aSize.width + aDest.X(),
|
||||||
aPt.y*aDest.size.height/aSize.height + aDest.pos.y);
|
aPt.y*aDest.Height()/aSize.height + aDest.Y());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ gfxRect
|
/* static */ gfxRect
|
||||||
|
|
|
@ -287,7 +287,7 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
// Transform the canvas into the right place
|
// Transform the canvas into the right place
|
||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.pos);
|
transform.Translate(r.TopLeft());
|
||||||
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
||||||
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
||||||
|
|
|
@ -1223,9 +1223,9 @@ nsDisplayImage::ConfigureLayer(ImageLayer* aLayer)
|
||||||
mImage->GetHeight(&imageHeight);
|
mImage->GetHeight(&imageHeight);
|
||||||
|
|
||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(destRect.pos);
|
transform.Translate(destRect.TopLeft());
|
||||||
transform.Scale(destRect.size.width/imageWidth,
|
transform.Scale(destRect.Width()/imageWidth,
|
||||||
destRect.size.height/imageHeight);
|
destRect.Height()/imageHeight);
|
||||||
aLayer->SetTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetTransform(gfx3DMatrix::From2D(transform));
|
||||||
|
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
||||||
|
|
|
@ -2185,7 +2185,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
// Set a transform on the layer to draw the plugin in the right place
|
// Set a transform on the layer to draw the plugin in the right place
|
||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.pos);
|
transform.Translate(r.TopLeft());
|
||||||
|
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
||||||
layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
|
layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
|
||||||
|
|
|
@ -5050,7 +5050,7 @@ nsTextFrame::GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY)
|
||||||
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
|
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
|
||||||
if (!aContext->UserToDevicePixelSnapped(putativeRect))
|
if (!aContext->UserToDevicePixelSnapped(putativeRect))
|
||||||
return baseline;
|
return baseline;
|
||||||
return aContext->DeviceToUser(putativeRect.pos).y*appUnitsPerDevUnit;
|
return aContext->DeviceToUser(putativeRect.TopLeft()).y*appUnitsPerDevUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -278,7 +278,7 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
layer->SetContentFlags(Layer::CONTENT_OPAQUE);
|
layer->SetContentFlags(Layer::CONTENT_OPAQUE);
|
||||||
// Set a transform on the layer to draw the video in the right place
|
// Set a transform on the layer to draw the video in the right place
|
||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.pos);
|
transform.Translate(r.TopLeft());
|
||||||
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
||||||
layer->SetVisibleRegion(nsIntRect(0, 0, videoSize.width, videoSize.height));
|
layer->SetVisibleRegion(nsIntRect(0, 0, videoSize.width, videoSize.height));
|
||||||
|
|
|
@ -488,8 +488,8 @@ BuildBackgroundPatternFor(ContainerLayer* aContainer,
|
||||||
gfxRect localContentVis(t.Transform(contentVis));
|
gfxRect localContentVis(t.Transform(contentVis));
|
||||||
// Round *in* here because this area is punched out of the background
|
// Round *in* here because this area is punched out of the background
|
||||||
localContentVis.RoundIn();
|
localContentVis.RoundIn();
|
||||||
nsIntRect localIntContentVis(localContentVis.pos.x, localContentVis.pos.y,
|
nsIntRect localIntContentVis(localContentVis.X(), localContentVis.Y(),
|
||||||
localContentVis.size.width, localContentVis.size.height);
|
localContentVis.Width(), localContentVis.Height());
|
||||||
|
|
||||||
// Get the frame's rect
|
// Get the frame's rect
|
||||||
nscoord auPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
|
nscoord auPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||||
|
|
|
@ -169,7 +169,7 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
|
||||||
// We don't care if this overflows, because we can handle upscaling/
|
// We don't care if this overflows, because we can handle upscaling/
|
||||||
// downscaling to filterRes
|
// downscaling to filterRes
|
||||||
PRBool overflow;
|
PRBool overflow;
|
||||||
filterRes = nsSVGUtils::ConvertToSurfaceSize(filterRegion.size * scale,
|
filterRes = nsSVGUtils::ConvertToSurfaceSize(filterRegion.Size() * scale,
|
||||||
&overflow);
|
&overflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
|
||||||
new gfxImageSurface(surfaceSize, gfxASurface::ImageFormatARGB32);
|
new gfxImageSurface(surfaceSize, gfxASurface::ImageFormatARGB32);
|
||||||
if (!image || image->CairoStatus())
|
if (!image || image->CairoStatus())
|
||||||
return nsnull;
|
return nsnull;
|
||||||
image->SetDeviceOffset(-clipExtents.pos);
|
image->SetDeviceOffset(-clipExtents.TopLeft());
|
||||||
|
|
||||||
nsSVGRenderState tmpState(image);
|
nsSVGRenderState tmpState(image);
|
||||||
|
|
||||||
|
|
|
@ -275,10 +275,8 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
||||||
// GetUserStrokeExtent gets the extents wrong we can still use it
|
// GetUserStrokeExtent gets the extents wrong we can still use it
|
||||||
// to get the device space position of zero length stroked paths.
|
// to get the device space position of zero length stroked paths.
|
||||||
extent = context->GetUserStrokeExtent();
|
extent = context->GetUserStrokeExtent();
|
||||||
extent.pos.x += extent.size.width / 2;
|
extent += extent.Size()/2;
|
||||||
extent.pos.y += extent.size.height / 2;
|
extent.SizeTo(gfxSize(0, 0));
|
||||||
extent.size.width = 0;
|
|
||||||
extent.size.height = 0;
|
|
||||||
}
|
}
|
||||||
extent = nsSVGUtils::PathExtentsToMaxStrokeExtents(extent, this);
|
extent = nsSVGUtils::PathExtentsToMaxStrokeExtents(extent, this);
|
||||||
} else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_None) {
|
} else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_None) {
|
||||||
|
|
|
@ -788,7 +788,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate the dirty rect so that it is wrt the widget top-left.
|
// Translate the dirty rect so that it is wrt the widget top-left.
|
||||||
dirtyRect.MoveBy(-rect.pos);
|
dirtyRect.MoveBy(-rect.TopLeft());
|
||||||
// Round out the dirty rect to gdk pixels to ensure that gtk draws
|
// Round out the dirty rect to gdk pixels to ensure that gtk draws
|
||||||
// enough pixels for interpolation to device pixels.
|
// enough pixels for interpolation to device pixels.
|
||||||
dirtyRect.RoundOut();
|
dirtyRect.RoundOut();
|
||||||
|
@ -837,7 +837,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||||
// Rects are in device coords.
|
// Rects are in device coords.
|
||||||
ctx->IdentityMatrix();
|
ctx->IdentityMatrix();
|
||||||
}
|
}
|
||||||
ctx->Translate(rect.pos + gfxPoint(drawingRect.x, drawingRect.y));
|
ctx->Translate(rect.TopLeft() + gfxPoint(drawingRect.x, drawingRect.y));
|
||||||
|
|
||||||
NS_ASSERTION(!IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType),
|
NS_ASSERTION(!IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType),
|
||||||
"Trying to render an unsafe widget!");
|
"Trying to render an unsafe widget!");
|
||||||
|
|
|
@ -1544,12 +1544,12 @@ RENDER_AGAIN:
|
||||||
// are because we might have drawn something above them (like a background-image).
|
// are because we might have drawn something above them (like a background-image).
|
||||||
ctx->Save();
|
ctx->Save();
|
||||||
ctx->ResetClip();
|
ctx->ResetClip();
|
||||||
ctx->Translate(dr.pos);
|
ctx->Translate(dr.TopLeft());
|
||||||
|
|
||||||
// Create a rounded rectangle to follow the buttons' look.
|
// Create a rounded rectangle to follow the buttons' look.
|
||||||
gfxRect buttonbox1(0.0, 0.0, dr.size.width, dr.size.height - 2.0);
|
gfxRect buttonbox1(0.0, 0.0, dr.Width(), dr.Height() - 2.0);
|
||||||
gfxRect buttonbox2(1.0, dr.size.height - 2.0, dr.size.width - 1.0, 1.0);
|
gfxRect buttonbox2(1.0, dr.Height() - 2.0, dr.Width() - 1.0, 1.0);
|
||||||
gfxRect buttonbox3(2.0, dr.size.height - 1.0, dr.size.width - 3.0, 1.0);
|
gfxRect buttonbox3(2.0, dr.Height() - 1.0, dr.Width() - 3.0, 1.0);
|
||||||
|
|
||||||
gfxContext::GraphicsOperator currentOp = ctx->CurrentOperator();
|
gfxContext::GraphicsOperator currentOp = ctx->CurrentOperator();
|
||||||
ctx->SetOperator(gfxContext::OPERATOR_CLEAR);
|
ctx->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче