зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1347147 - fix DrawTargetD2D1::GetImageForSurface to support uploads in device-space. r=mchang
MozReview-Commit-ID: 2galhKidxca
This commit is contained in:
Родитель
e3392d3ab4
Коммит
f942812710
|
@ -229,7 +229,7 @@ DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
|||
mTransformDirty = true;
|
||||
|
||||
Matrix mat;
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP);
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP, nullptr, false);
|
||||
|
||||
if (!image) {
|
||||
gfxWarning() << "Couldn't get image for surface.";
|
||||
|
@ -378,7 +378,7 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
|
|||
mTransformDirty = true;
|
||||
|
||||
Matrix mat = Matrix::Translation(aDestination.x - aSourceRect.x, aDestination.y - aSourceRect.y);
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP);
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP, nullptr, false);
|
||||
|
||||
if (!image) {
|
||||
gfxWarning() << "Couldn't get image for surface.";
|
||||
|
@ -1857,7 +1857,8 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
|||
|
||||
already_AddRefed<ID2D1Image>
|
||||
DrawTargetD2D1::GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTransform,
|
||||
ExtendMode aExtendMode, const IntRect* aSourceRect)
|
||||
ExtendMode aExtendMode, const IntRect* aSourceRect,
|
||||
bool aUserSpace)
|
||||
{
|
||||
RefPtr<ID2D1Image> image;
|
||||
|
||||
|
@ -1876,7 +1877,8 @@ DrawTargetD2D1::GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTrans
|
|||
gfxWarning() << "Invalid surface type.";
|
||||
return nullptr;
|
||||
}
|
||||
return CreatePartialBitmapForSurface(dataSurf, mTransform, mSize, aExtendMode,
|
||||
Matrix transform = aUserSpace ? mTransform : Matrix();
|
||||
return CreatePartialBitmapForSurface(dataSurf, transform, mSize, aExtendMode,
|
||||
aSourceTransform, mDC, aSourceRect);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -140,9 +140,11 @@ public:
|
|||
|
||||
// This function will get an image for a surface, it may adjust the source
|
||||
// transform for any transformation of the resulting image relative to the
|
||||
// oritingal SourceSurface.
|
||||
// oritingal SourceSurface. By default, the surface and its transform are
|
||||
// interpreted in user-space, but may be specified in device-space instead.
|
||||
already_AddRefed<ID2D1Image> GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTransform,
|
||||
ExtendMode aExtendMode, const IntRect* aSourceRect = nullptr);
|
||||
ExtendMode aExtendMode, const IntRect* aSourceRect = nullptr,
|
||||
bool aUserSpace = true);
|
||||
|
||||
already_AddRefed<ID2D1Image> GetImageForSurface(SourceSurface *aSurface, ExtendMode aExtendMode) {
|
||||
Matrix mat;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
function draw() {
|
||||
var c = document.getElementById('c').getContext('2d');
|
||||
|
||||
c.fillStyle = 'lime';
|
||||
c.fillRect(0, 0, 100, 50);
|
||||
|
||||
c.fillStyle = 'red';
|
||||
c.fillRect(40, 0, 30, 50);
|
||||
|
||||
c.fillStyle = 'blue';
|
||||
c.fillRect(70, 0, 30, 50);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="draw();">
|
||||
<canvas id='c' width='100' height='50'></canvas>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
function draw() {
|
||||
var c = document.getElementById('c').getContext('2d');
|
||||
|
||||
c.fillStyle = 'lime';
|
||||
c.fillRect(0, 0, 100, 50);
|
||||
|
||||
var imgdata = c.createImageData(60, 50);
|
||||
for (var i = 0; i < imgdata.data.length; i += 4 * 60) {
|
||||
for (var x = i; x < i + 4 * 30; x += 4) {
|
||||
imgdata.data[x] = 255;
|
||||
imgdata.data[x+3] = 255;
|
||||
}
|
||||
for (var x = i + 4 * 30; x < i + 4 * 60; x += 4) {
|
||||
imgdata.data[x+2] = 255;
|
||||
imgdata.data[x+3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that putImageData is not affected by the current transform.
|
||||
c.translate(20, 0);
|
||||
c.putImageData(imgdata, 40, 0);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="draw();">
|
||||
<canvas id='c' width='100' height='50'></canvas>
|
||||
</body>
|
||||
</html>
|
|
@ -108,3 +108,5 @@ fuzzy-if(d2d,12,21) fuzzy-if(skiaContent,12,7) fuzzy-if(d2d&&/^Windows\x20NT\x20
|
|||
== 1304353-text-global-alpha-1.html 1304353-text-global-alpha-1-ref.html
|
||||
fuzzy-if(winWidget,1,14) == 1304353-text-global-alpha-2.html 1304353-text-global-alpha-2-ref.html
|
||||
fuzzy-if(winWidget,94,1575) fuzzy-if(cocoaWidget,1,24) == 1304353-text-global-composite-op-1.html 1304353-text-global-composite-op-1-ref.html
|
||||
|
||||
== 1347147-1.html 1347147-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче