Bug 985049 - Remove gfxPlatform::SupportsAzureContent() and kill of the resulting dead code. r=mattwoodrow

This commit is contained in:
Jonathan Watt
2014-03-19 10:36:58 +08:00
parent 1f6a6c94e6
commit 3ad3cf73a4
11 changed files with 46 additions and 167 deletions

View File

@@ -2269,38 +2269,22 @@ nsWindow::OnExposeEvent(cairo_t *cr)
void
nsWindow::UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect)
{
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
// We need to create our own buffer to force the stride to match the
// expected stride.
int32_t stride = GetAlignedStride<4>(BytesPerPixel(SurfaceFormat::A8) *
aBoundsRect.width);
int32_t bufferSize = stride * aBoundsRect.height;
nsAutoArrayPtr<uint8_t> imageBuffer(new (std::nothrow) uint8_t[bufferSize]);
RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
CreateDrawTargetForData(imageBuffer, ToIntSize(aBoundsRect.Size()),
stride, SurfaceFormat::A8);
// We need to create our own buffer to force the stride to match the
// expected stride.
int32_t stride = GetAlignedStride<4>(BytesPerPixel(SurfaceFormat::A8) *
aBoundsRect.width);
int32_t bufferSize = stride * aBoundsRect.height;
nsAutoArrayPtr<uint8_t> imageBuffer(new (std::nothrow) uint8_t[bufferSize]);
RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
CreateDrawTargetForData(imageBuffer, ToIntSize(aBoundsRect.Size()),
stride, SurfaceFormat::A8);
if (drawTarget) {
drawTarget->FillRect(Rect(0, 0, aBoundsRect.width, aBoundsRect.height),
*aPattern->GetPattern(drawTarget),
DrawOptions(1.0, CompositionOp::OP_SOURCE));
}
UpdateTranslucentWindowAlphaInternal(aBoundsRect, imageBuffer, stride);
} else {
nsRefPtr<gfxImageSurface> img =
new gfxImageSurface(aBoundsRect.Size(), gfxImageFormat::A8);
if (img && !img->CairoStatus()) {
img->SetDeviceOffset(-aBoundsRect.TopLeft());
nsRefPtr<gfxContext> imgCtx = new gfxContext(img);
imgCtx->SetPattern(aPattern);
imgCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
imgCtx->Paint();
UpdateTranslucentWindowAlphaInternal(aBoundsRect, img->Data(),
img->Stride());
}
}
if (drawTarget) {
drawTarget->FillRect(Rect(0, 0, aBoundsRect.width, aBoundsRect.height),
*aPattern->GetPattern(drawTarget),
DrawOptions(1.0, CompositionOp::OP_SOURCE));
}
UpdateTranslucentWindowAlphaInternal(aBoundsRect, imageBuffer, stride);
}
gboolean