Bug 1323797 - Add compositor support for triangle layers (for BasicCompositor backend) - Part 3: Implement DrawPolygon() with Paths r=mattwoodrow
MozReview-Commit-ID: FjxDlzdhqor
This commit is contained in:
@@ -206,6 +206,68 @@ FillRectWithMask(DrawTarget* aDT,
|
||||
ExtendMode::CLAMP);
|
||||
}
|
||||
|
||||
void
|
||||
FillPathWithMask(DrawTarget* aDT,
|
||||
const Path* aPath,
|
||||
const Rect& aClipRect,
|
||||
const Color& aColor,
|
||||
const DrawOptions& aOptions,
|
||||
SourceSurface* aMaskSource,
|
||||
const Matrix* aMaskTransform)
|
||||
{
|
||||
if (aMaskSource && aMaskTransform) {
|
||||
aDT->PushClipRect(aClipRect);
|
||||
Matrix oldTransform = aDT->GetTransform();
|
||||
|
||||
aDT->SetTransform(*aMaskTransform);
|
||||
aDT->MaskSurface(ColorPattern(aColor), aMaskSource, Point(), aOptions);
|
||||
aDT->SetTransform(oldTransform);
|
||||
aDT->PopClip();
|
||||
return;
|
||||
}
|
||||
|
||||
aDT->Fill(aPath, ColorPattern(aColor), aOptions);
|
||||
}
|
||||
|
||||
void
|
||||
FillPathWithMask(DrawTarget* aDT,
|
||||
const Path* aPath,
|
||||
const Rect& aClipRect,
|
||||
SourceSurface* aSurface,
|
||||
SamplingFilter aSamplingFilter,
|
||||
const DrawOptions& aOptions,
|
||||
ExtendMode aExtendMode,
|
||||
SourceSurface* aMaskSource,
|
||||
const Matrix* aMaskTransform,
|
||||
const Matrix* aSurfaceTransform)
|
||||
{
|
||||
if (aMaskSource && aMaskTransform) {
|
||||
aDT->PushClipRect(aClipRect);
|
||||
Matrix oldTransform = aDT->GetTransform();
|
||||
|
||||
Matrix inverseMask = *aMaskTransform;
|
||||
inverseMask.Invert();
|
||||
|
||||
Matrix transform = oldTransform * inverseMask;
|
||||
if (aSurfaceTransform) {
|
||||
transform = (*aSurfaceTransform) * transform;
|
||||
}
|
||||
|
||||
SurfacePattern source(aSurface, aExtendMode, transform, aSamplingFilter);
|
||||
|
||||
aDT->SetTransform(*aMaskTransform);
|
||||
aDT->MaskSurface(source, aMaskSource, Point(0, 0), aOptions);
|
||||
aDT->SetTransform(oldTransform);
|
||||
aDT->PopClip();
|
||||
return;
|
||||
}
|
||||
|
||||
aDT->Fill(aPath,
|
||||
SurfacePattern(aSurface, aExtendMode,
|
||||
aSurfaceTransform ? (*aSurfaceTransform) : Matrix(),
|
||||
aSamplingFilter), aOptions);
|
||||
}
|
||||
|
||||
BasicImplData*
|
||||
ToData(Layer* aLayer)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user