Bug 1407470 - make nsImageRenderer::Draw compute luminance in device space instead of user space. r=mstange

MozReview-Commit-ID: oKtzekYaYI
This commit is contained in:
Lee Salzman 2017-10-12 14:42:42 -04:00
Родитель 8e4b879a3c
Коммит 320337bba3
3 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,19 @@
<body id='test_body'>
<script>
let o = [];
o[0] = document.createElement("tt");
test_body.appendChild(o[0]);
o[1] = document.createElement("center");
o[2] = document.createElement("footer");
o[0].appendChild(o[2]);
o[1].animate([{
"padding": "80.40vw 0.0vmax",
"transform": "matrix(6287.56,268.76,237.34,222.80,186.72,287.94) rotateX(2.046rad)"
}], { duration:3845.75 });
o[2].appendChild(o[1]);
test_body.animate([{
"transform": "scale3d(0.0,5961462.820,250.41)",
"outline": "auto thick",
"mask": "exclude no-clip url(data:image/gif;base64,R0lGODlhAQABAAD/ACH/C05FVFNDQVBFMi4wAwEAAAAsAAAAAAEAAQAAAgAsAAAAAAEAAQAAAgA7),exclude",
}], 3617.63433129);
</script>

Просмотреть файл

@ -1 +1,2 @@
load 1402183-1.html
skip-if(stylo||Android) load 1407470-1.html

Просмотреть файл

@ -494,7 +494,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
IntRect tmpDTRect;
if (ctx->CurrentOp() != CompositionOp::OP_OVER || mMaskOp == NS_STYLE_MASK_MODE_LUMINANCE) {
gfxRect clipRect = ctx->GetClipExtents();
gfxRect clipRect = ctx->GetClipExtents(gfxContext::eDeviceSpace);
tmpDTRect = RoundedOut(ToRect(clipRect));
if (tmpDTRect.IsEmpty()) {
return DrawResult::SUCCESS;
@ -507,7 +507,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
return DrawResult::TEMPORARY_ERROR;
}
tempDT->SetTransform(Matrix::Translation(-tmpDTRect.TopLeft()));
tempDT->SetTransform(ctx->GetDrawTarget()->GetTransform() * Matrix::Translation(-tmpDTRect.TopLeft()));
ctx = gfxContext::CreatePreservingTransformOrNull(tempDT);
if (!ctx) {
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
@ -566,7 +566,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
if (mMaskOp == NS_STYLE_MASK_MODE_LUMINANCE) {
RefPtr<DataSourceSurface> maskData = surf->GetDataSurface();
DataSourceSurface::MappedSurface map;
if (!maskData->Map(DataSourceSurface::MapType::WRITE, &map)) {
if (!maskData->Map(DataSourceSurface::MapType::READ_WRITE, &map)) {
return result;
}
@ -576,10 +576,13 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
}
DrawTarget* dt = aRenderingContext.GetDrawTarget();
Matrix oldTransform = dt->GetTransform();
dt->SetTransform(Matrix());
dt->DrawSurface(surf, Rect(tmpDTRect.x, tmpDTRect.y, tmpDTRect.width, tmpDTRect.height),
Rect(0, 0, tmpDTRect.width, tmpDTRect.height),
DrawSurfaceOptions(SamplingFilter::POINT),
DrawOptions(1.0f, aRenderingContext.CurrentOp()));
dt->SetTransform(oldTransform);
}
return result;