mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 21:58:06 +00:00
Bug 1062723 - Part 6: Implement source clipping for DrawTargetD2D1. r=Bas
--HG-- extra : rebase_source : bd1c022efe0548a9e7860fb18d6aced33ddad40f
This commit is contained in:
parent
f88faad335
commit
004810cf46
@ -871,17 +871,24 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D2D1_RECT_F samplingBounds;
|
||||
if (!pat->mSamplingRect.IsEmpty()) {
|
||||
samplingBounds = D2DRect(pat->mSamplingRect);
|
||||
} else {
|
||||
samplingBounds = D2D1::RectF(0, 0,
|
||||
Float(pat->mSurface->GetSize().width),
|
||||
Float(pat->mSurface->GetSize().height));
|
||||
}
|
||||
|
||||
Matrix mat = pat->mMatrix;
|
||||
|
||||
RefPtr<ID2D1ImageBrush> imageBrush;
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(pat->mSurface, mat, pat->mExtendMode);
|
||||
mDC->CreateImageBrush(image,
|
||||
D2D1::ImageBrushProperties(D2D1::RectF(0, 0,
|
||||
Float(pat->mSurface->GetSize().width),
|
||||
Float(pat->mSurface->GetSize().height)),
|
||||
D2DExtend(pat->mExtendMode), D2DExtend(pat->mExtendMode),
|
||||
D2DInterpolationMode(pat->mFilter)),
|
||||
D2D1::ImageBrushProperties(samplingBounds,
|
||||
D2DExtend(pat->mExtendMode),
|
||||
D2DExtend(pat->mExtendMode),
|
||||
D2DInterpolationMode(pat->mFilter)),
|
||||
D2D1::BrushProperties(aAlpha, D2DMatrix(mat)),
|
||||
byRef(imageBrush));
|
||||
return imageBrush.forget();
|
||||
|
@ -44,7 +44,8 @@ static inline D2D1_SIZE_U D2DIntSize(const IntSize &aSize)
|
||||
return D2D1::SizeU(aSize.width, aSize.height);
|
||||
}
|
||||
|
||||
static inline D2D1_RECT_F D2DRect(const Rect &aRect)
|
||||
template <typename T>
|
||||
static inline D2D1_RECT_F D2DRect(const T &aRect)
|
||||
{
|
||||
return D2D1::RectF(aRect.x, aRect.y, aRect.XMost(), aRect.YMost());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user