mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1168189 - Force D2D1 CopySurface to use DrawBitmap like D2D. r=bas
--HG-- extra : rebase_source : 0bf0b8148d9bb5f2f1e19c9c56ea1a4a85dd1f3e
This commit is contained in:
parent
d20508cc2e
commit
87a268fcb4
@ -333,30 +333,39 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFormat == SurfaceFormat::A8) {
|
||||
RefPtr<ID2D1Bitmap> bitmap;
|
||||
image->QueryInterface((ID2D1Bitmap**)byRef(bitmap));
|
||||
|
||||
mDC->PushAxisAlignedClip(D2D1::RectF(aDestination.x, aDestination.y,
|
||||
aDestination.x + aSourceRect.width,
|
||||
aDestination.y + aSourceRect.height),
|
||||
D2D1_ANTIALIAS_MODE_ALIASED);
|
||||
mDC->Clear();
|
||||
mDC->PopAxisAlignedClip();
|
||||
RefPtr<ID2D1Bitmap> bitmap;
|
||||
image->QueryInterface((ID2D1Bitmap**)byRef(bitmap));
|
||||
|
||||
if (bitmap && mFormat == SurfaceFormat::A8) {
|
||||
RefPtr<ID2D1SolidColorBrush> brush;
|
||||
mDC->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White),
|
||||
D2D1::BrushProperties(), byRef(brush));
|
||||
mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED);
|
||||
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY);
|
||||
mDC->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS);
|
||||
mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_SOURCE_OVER);
|
||||
return;
|
||||
}
|
||||
|
||||
Rect srcRect(Float(aSourceRect.x), Float(aSourceRect.y),
|
||||
Float(aSourceRect.width), Float(aSourceRect.height));
|
||||
|
||||
Rect dstRect(Float(aDestination.x), Float(aDestination.y),
|
||||
Float(aSourceRect.width), Float(aSourceRect.height));
|
||||
|
||||
if (bitmap) {
|
||||
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY);
|
||||
mDC->DrawBitmap(bitmap, D2DRect(dstRect), 1.0f,
|
||||
D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
|
||||
D2DRect(srcRect));
|
||||
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_SOURCE_OVER);
|
||||
return;
|
||||
}
|
||||
|
||||
mDC->DrawImage(image, D2D1::Point2F(Float(aDestination.x), Float(aDestination.y)),
|
||||
D2D1::RectF(Float(aSourceRect.x), Float(aSourceRect.y),
|
||||
Float(aSourceRect.XMost()), Float(aSourceRect.YMost())),
|
||||
D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY);
|
||||
D2DRect(srcRect), D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
|
||||
D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user