mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1088235: Use DrawBitmap when we can. r=jrmuizel
This commit is contained in:
parent
03dbe73deb
commit
93ec577355
@ -128,14 +128,27 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
|
||||
return;
|
||||
}
|
||||
|
||||
mDC->CreateImageBrush(image,
|
||||
D2D1::ImageBrushProperties(samplingBounds,
|
||||
D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_EXTEND_MODE_CLAMP,
|
||||
D2DInterpolationMode(aSurfOptions.mFilter)),
|
||||
D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(transform)),
|
||||
byRef(brush));
|
||||
mDC->FillRectangle(D2DRect(aDest), brush);
|
||||
RefPtr<ID2D1Bitmap> bitmap;
|
||||
if (aSurface->GetType() == SurfaceType::D2D1_1_IMAGE) {
|
||||
// If this is called with a DataSourceSurface it might do a partial upload
|
||||
// that our DrawBitmap call doesn't support.
|
||||
image->QueryInterface((ID2D1Bitmap**)byRef(bitmap));
|
||||
}
|
||||
|
||||
if (bitmap && aSurfOptions.mSamplingBounds == SamplingBounds::UNBOUNDED) {
|
||||
mDC->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(aSource));
|
||||
} else {
|
||||
// This has issues ignoring the alpha channel on windows 7 with images marked opaque.
|
||||
MOZ_ASSERT(aSurface->GetFormat() != SurfaceFormat::B8G8R8X8);
|
||||
mDC->CreateImageBrush(image,
|
||||
D2D1::ImageBrushProperties(samplingBounds,
|
||||
D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_EXTEND_MODE_CLAMP,
|
||||
D2DInterpolationMode(aSurfOptions.mFilter)),
|
||||
D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(transform)),
|
||||
byRef(brush));
|
||||
mDC->FillRectangle(D2DRect(aDest), brush);
|
||||
}
|
||||
|
||||
FinalizeDrawing(aOptions.mCompositionOp, ColorPattern(Color()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user