mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1149222 part 2 - Make nsSVGImageFrame::PaintSVG use LayoutDeviceSize & LayoutDevicePixel::ToAppUnits, when setting up its dest-rect. r=mats
This commit is contained in:
parent
400128b6ce
commit
9f9755084d
@ -282,6 +282,11 @@ struct LayoutDevicePixel {
|
|||||||
aSize.height * aAppUnitsPerDevPixel);
|
aSize.height * aAppUnitsPerDevPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static nsSize ToAppUnits(const LayoutDeviceSize& aSize, nscoord aAppUnitsPerDevPixel) {
|
||||||
|
return nsSize(NSFloatPixelsToAppUnits(aSize.width, aAppUnitsPerDevPixel),
|
||||||
|
NSFloatPixelsToAppUnits(aSize.height, aAppUnitsPerDevPixel));
|
||||||
|
}
|
||||||
|
|
||||||
static nsRect ToAppUnits(const LayoutDeviceRect& aRect, nscoord aAppUnitsPerDevPixel) {
|
static nsRect ToAppUnits(const LayoutDeviceRect& aRect, nscoord aAppUnitsPerDevPixel) {
|
||||||
return nsRect(NSFloatPixelsToAppUnits(aRect.x, aAppUnitsPerDevPixel),
|
return nsRect(NSFloatPixelsToAppUnits(aRect.x, aAppUnitsPerDevPixel),
|
||||||
NSFloatPixelsToAppUnits(aRect.y, aAppUnitsPerDevPixel),
|
NSFloatPixelsToAppUnits(aRect.y, aAppUnitsPerDevPixel),
|
||||||
|
@ -365,13 +365,20 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
|
|||||||
|
|
||||||
if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
|
if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
|
||||||
// Package up the attributes of this image element which can override the
|
// Package up the attributes of this image element which can override the
|
||||||
// attributes of mImageContainer's internal SVG document.
|
// attributes of mImageContainer's internal SVG document. The 'width' &
|
||||||
|
// 'height' values we're passing in here are in CSS units (though they
|
||||||
|
// come from width/height *attributes* in SVG). They influence the region
|
||||||
|
// of the SVG image's internal document that is visible, in combination
|
||||||
|
// with preserveAspectRatio and viewBox.
|
||||||
SVGImageContext context(CSSIntSize(width, height),
|
SVGImageContext context(CSSIntSize(width, height),
|
||||||
Some(imgElem->mPreserveAspectRatio.GetAnimValue()));
|
Some(imgElem->mPreserveAspectRatio.GetAnimValue()));
|
||||||
|
|
||||||
nsRect destRect(0, 0,
|
// For the actual draw operation to draw crisply (and at the right size),
|
||||||
appUnitsPerDevPx * width,
|
// our destination rect needs to be |width|x|height|, *in dev pixels*.
|
||||||
appUnitsPerDevPx * height);
|
LayoutDeviceSize devPxSize(width, height);
|
||||||
|
nsRect destRect(nsPoint(),
|
||||||
|
LayoutDevicePixel::ToAppUnits(devPxSize,
|
||||||
|
appUnitsPerDevPx));
|
||||||
|
|
||||||
// Note: Can't use DrawSingleUnscaledImage for the TYPE_VECTOR case.
|
// Note: Can't use DrawSingleUnscaledImage for the TYPE_VECTOR case.
|
||||||
// That method needs our image to have a fixed native width & height,
|
// That method needs our image to have a fixed native width & height,
|
||||||
|
Loading…
Reference in New Issue
Block a user