Bug 899884. Take into account the app unit to dev pixel ratio when reusing mask layers. r=roc

This commit is contained in:
Nicholas Cameron 2013-08-09 21:42:05 +12:00
parent 106066517d
commit afbb0ff592

View File

@ -667,7 +667,8 @@ struct MaskLayerUserData : public LayerUserData
return mRoundedClipRects == aOther.mRoundedClipRects &&
mScaleX == aOther.mScaleX &&
mScaleY == aOther.mScaleY &&
mOffset == aOther.mOffset;
mOffset == aOther.mOffset &&
mAppUnitsPerDevPixel == aOther.mAppUnitsPerDevPixel;
}
nsRefPtr<const MaskLayerImageCache::MaskLayerImageKey> mImageKey;
@ -678,6 +679,7 @@ struct MaskLayerUserData : public LayerUserData
float mScaleX, mScaleY;
// The ContainerParameters offset which is applied to the mask's transform.
nsIntPoint mOffset;
int32_t mAppUnitsPerDevPixel;
};
/**
@ -3414,6 +3416,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
newData.mScaleX = mParameters.mXScale;
newData.mScaleY = mParameters.mYScale;
newData.mOffset = mParameters.mOffset;
newData.mAppUnitsPerDevPixel = mContainerFrame->PresContext()->AppUnitsPerDevPixel();
if (*userData == newData) {
aLayer->SetMaskLayer(maskLayer);
@ -3422,8 +3425,8 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
}
// calculate a more precise bounding rect
const int32_t A2D = mContainerFrame->PresContext()->AppUnitsPerDevPixel();
gfxRect boundingRect = CalculateBounds(newData.mRoundedClipRects, A2D);
gfxRect boundingRect = CalculateBounds(newData.mRoundedClipRects,
newData.mAppUnitsPerDevPixel);
boundingRect.Scale(mParameters.mXScale, mParameters.mYScale);
uint32_t maxSize = mManager->GetMaxTextureSize();
@ -3479,7 +3482,10 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
// paint the clipping rects with alpha to create the mask
context->SetColor(gfxRGBA(1, 1, 1, 1));
aClip.DrawRoundedRectsTo(context, A2D, 0, aRoundedRectClipCount);
aClip.DrawRoundedRectsTo(context,
newData.mAppUnitsPerDevPixel,
0,
aRoundedRectClipCount);
// build the image and container
container = aLayer->Manager()->CreateImageContainer();