зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1773387 - Change local variables of type gfxSize, which actually represent scales, to MatrixScalesDouble. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D149565
This commit is contained in:
Родитель
00e9bad904
Коммит
5b663ef76f
|
@ -5007,10 +5007,13 @@ void CanvasRenderingContext2D::DrawDirectlyToCanvas(
|
|||
aDest.Scale((float)contextScale.xScale, (float)contextScale.yScale);
|
||||
|
||||
// Scale the image size to the dest rect, and adjust the source rect to match.
|
||||
gfxSize scale(aDest.width / aSrc.width, aDest.height / aSrc.height);
|
||||
IntSize scaledImageSize = IntSize::Ceil(aImgSize.width * scale.width,
|
||||
aImgSize.height * scale.height);
|
||||
aSrc.Scale(scale.width, scale.height);
|
||||
MatrixScalesDouble scale(aDest.width / aSrc.width,
|
||||
aDest.height / aSrc.height);
|
||||
IntSize scaledImageSize =
|
||||
IntSize::Ceil(static_cast<float>(scale.xScale * aImgSize.width),
|
||||
static_cast<float>(scale.yScale * aImgSize.height));
|
||||
aSrc.Scale(static_cast<float>(scale.xScale),
|
||||
static_cast<float>(scale.yScale));
|
||||
|
||||
// We're wrapping tempTarget's (our) DrawTarget here, so we need to restore
|
||||
// the matrix even though this is a temp gfxContext.
|
||||
|
|
|
@ -194,14 +194,14 @@ DynamicImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
|
|||
return ImgDrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
gfxSize scale(double(aSize.width) / drawableSize.width,
|
||||
MatrixScalesDouble scale(double(aSize.width) / drawableSize.width,
|
||||
double(aSize.height) / drawableSize.height);
|
||||
|
||||
ImageRegion region(aRegion);
|
||||
region.Scale(1.0 / scale.width, 1.0 / scale.height);
|
||||
region.Scale(1.0 / scale.xScale, 1.0 / scale.yScale);
|
||||
|
||||
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
|
||||
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
|
||||
aContext->Multiply(gfxMatrix::Scaling(scale));
|
||||
|
||||
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize),
|
||||
region, SurfaceFormat::OS_RGBA, aSamplingFilter,
|
||||
|
|
|
@ -6105,10 +6105,10 @@ struct SnappedImageDrawingParameters {
|
|||
*/
|
||||
static gfxMatrix TransformBetweenRects(const gfxRect& aFrom,
|
||||
const gfxRect& aTo) {
|
||||
gfxSize scale(aTo.width / aFrom.width, aTo.height / aFrom.height);
|
||||
gfxPoint translation(aTo.x - aFrom.x * scale.width,
|
||||
aTo.y - aFrom.y * scale.height);
|
||||
return gfxMatrix(scale.width, 0, 0, scale.height, translation.x,
|
||||
MatrixScalesDouble scale(aTo.width / aFrom.width, aTo.height / aFrom.height);
|
||||
gfxPoint translation(aTo.x - aFrom.x * scale.xScale,
|
||||
aTo.y - aFrom.y * scale.yScale);
|
||||
return gfxMatrix(scale.xScale, 0, 0, scale.yScale, translation.x,
|
||||
translation.y);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче