Skip to content

Commit

Permalink
Bug 1507021. Use SnappedRectangle in more places. r=mattwoodrow
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D11840

--HG--
extra : moz-landing-system : lando
  • Loading branch information
jrmuizel committed Nov 14, 2018
1 parent ee6cbfb commit 1d2422d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions gfx/thebes/gfxContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ class gfxContext final {

/**
* Draws the rectangle given by rect.
* @param snapToPixels ?
*/
void Rectangle(const gfxRect& rect, bool snapToPixels = false);
void Rectangle(const gfxRect& rect) { return Rectangle(rect, false); }
void SnappedRectangle(const gfxRect& rect) { return Rectangle(rect, true); }
private:
void Rectangle(const gfxRect& rect, bool snapToPixels);
public:

/**
** Transformation Matrix manipulation
Expand Down
4 changes: 2 additions & 2 deletions gfx/thebes/gfxTextRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,10 @@ struct MOZ_STACK_CLASS BufferAlphaColor {
{
mContext->Save();
mContext->NewPath();
mContext->Rectangle(gfxRect(aBounds.X() / appsPerDevUnit,
mContext->SnappedRectangle(gfxRect(aBounds.X() / appsPerDevUnit,
aBounds.Y() / appsPerDevUnit,
aBounds.Width() / appsPerDevUnit,
aBounds.Height() / appsPerDevUnit), true);
aBounds.Height() / appsPerDevUnit));
mContext->Clip();
mContext->SetColor(Color(aAlphaColor.r, aAlphaColor.g, aAlphaColor.b));
mContext->PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, aAlphaColor.a);
Expand Down
2 changes: 1 addition & 1 deletion layout/painting/DisplayItemClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ DisplayItemClip::ApplyRectTo(gfxContext* aContext, int32_t A2D) const
{
aContext->NewPath();
gfxRect clip = nsLayoutUtils::RectToGfxRect(mClipRect, A2D);
aContext->Rectangle(clip, true);
aContext->SnappedRectangle(clip);
aContext->Clip();
}

Expand Down
8 changes: 4 additions & 4 deletions layout/painting/nsCSSRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,

aAutoSR->EnsureSaved(aCtx);
aCtx->NewPath();
aCtx->Rectangle(bgAreaGfx, true);
aCtx->SnappedRectangle(bgAreaGfx);
aCtx->Clip();
}

Expand Down Expand Up @@ -2585,7 +2585,7 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
// table painting seems to depend on it.
if (!aClipState.mHasRoundedCorners || aClipState.mCustomClip) {
aCtx->NewPath();
aCtx->Rectangle(aClipState.mDirtyRectInDevPx, true);
aCtx->SnappedRectangle(aClipState.mDirtyRectInDevPx);
aCtx->Fill();
return;
}
Expand All @@ -2606,7 +2606,7 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectInDevPx);

aCtx->NewPath();
aCtx->Rectangle(dirty, true);
aCtx->SnappedRectangle(dirty);
aCtx->Clip();

if (aClipState.mHasAdditionalBGClipArea) {
Expand All @@ -2615,7 +2615,7 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
bgAdditionalAreaGfx.Round();
gfxUtils::ConditionRect(bgAdditionalAreaGfx);
aCtx->NewPath();
aCtx->Rectangle(bgAdditionalAreaGfx, true);
aCtx->SnappedRectangle(bgAdditionalAreaGfx);
aCtx->Clip();
}

Expand Down
4 changes: 2 additions & 2 deletions layout/painting/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5079,15 +5079,15 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,

ctx->SetColor(mColor);
ctx->NewPath();
ctx->Rectangle(bounds, true);
ctx->SnappedRectangle(bounds);
ctx->Fill();
ctx->PopGroupAndBlend();
return;
}

ctx->SetColor(mColor);
ctx->NewPath();
ctx->Rectangle(bounds, true);
ctx->SnappedRectangle(bounds);
ctx->Fill();
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsSVGIntegrationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ void PaintMaskAndClipPathInternal(const PaintFramesParams& aParams, const T& aPa
gfxRect drawingRect =
nsLayoutUtils::RectToGfxRect(aParams.borderArea,
frame->PresContext()->AppUnitsPerDevPixel());
context.Rectangle(drawingRect, true);
context.SnappedRectangle(drawingRect);
Color overlayColor(0.0f, 0.0f, 0.0f, 0.8f);
if (maskUsage.shouldGenerateMaskLayer) {
overlayColor.r = 1.0f; // red represents css positioned mask.
Expand Down

0 comments on commit 1d2422d

Please sign in to comment.