зеркало из https://github.com/mozilla/gecko-dev.git
Bug 923434 - Use DrawSurface in ThebesLayerBuffer instead of FillRect. r=Bas
This commit is contained in:
Родитель
2b4a1c6957
Коммит
cd67756e2e
|
@ -50,6 +50,27 @@ RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const
|
|||
return mBufferRect + quadrantTranslation;
|
||||
}
|
||||
|
||||
Rect
|
||||
RotatedBuffer::GetSourceRectangle(XSide aXSide, YSide aYSide) const
|
||||
{
|
||||
Rect result;
|
||||
if (aXSide == LEFT) {
|
||||
result.x = 0;
|
||||
result.width = mBufferRotation.x;
|
||||
} else {
|
||||
result.x = mBufferRotation.x;
|
||||
result.width = mBufferRect.width - mBufferRotation.x;
|
||||
}
|
||||
if (aYSide == TOP) {
|
||||
result.y = 0;
|
||||
result.height = mBufferRotation.y;
|
||||
} else {
|
||||
result.y = mBufferRotation.y;
|
||||
result.height = mBufferRect.height - mBufferRotation.y;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aXSide LEFT means we draw from the left side of the buffer (which
|
||||
* is drawn on the right side of mBufferRect). RIGHT means we draw from
|
||||
|
@ -199,16 +220,6 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
|
|||
snapshot = mDTBufferOnWhite->Snapshot();
|
||||
}
|
||||
|
||||
// Transform from user -> buffer space.
|
||||
Matrix transform;
|
||||
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
|
||||
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
|
||||
#else
|
||||
SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
|
||||
#endif
|
||||
|
||||
if (aOperator == OP_SOURCE) {
|
||||
// OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
|
||||
// We also can't do a ClearRect+FillRect since we need the drawing to happen
|
||||
|
@ -218,14 +229,30 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
|
|||
}
|
||||
|
||||
if (aMask) {
|
||||
// Transform from user -> buffer space.
|
||||
Matrix transform;
|
||||
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
|
||||
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
|
||||
#else
|
||||
SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
|
||||
#endif
|
||||
|
||||
Matrix oldTransform = aTarget->GetTransform();
|
||||
aTarget->SetTransform(*aMaskTransform);
|
||||
aTarget->MaskSurface(source, aMask, Point(0, 0), DrawOptions(aOpacity, aOperator));
|
||||
aTarget->SetTransform(oldTransform);
|
||||
} else {
|
||||
aTarget->FillRect(gfx::Rect(fillRect.x, fillRect.y,
|
||||
fillRect.width, fillRect.height),
|
||||
source, DrawOptions(aOpacity, aOperator));
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
DrawSurfaceOptions options(FILTER_POINT);
|
||||
#else
|
||||
DrawSurfaceOptions options;
|
||||
#endif
|
||||
aTarget->DrawSurface(snapshot, ToRect(fillRect),
|
||||
GetSourceRectangle(aXSide, aYSide),
|
||||
options,
|
||||
DrawOptions(aOpacity, aOperator));
|
||||
}
|
||||
|
||||
if (aOperator == OP_SOURCE) {
|
||||
|
|
|
@ -112,6 +112,8 @@ protected:
|
|||
};
|
||||
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
|
||||
|
||||
gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const;
|
||||
|
||||
/*
|
||||
* If aMask is non-null, then it is used as an alpha mask for rendering this
|
||||
* buffer. aMaskTransform must be non-null if aMask is non-null, and is used
|
||||
|
|
Загрузка…
Ссылка в новой задаче