mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1149222 part 1 - Make nsLayoutUtils::DrawBackgroundImage and SVGImageContext use CSSIntSize instead of unitless nsIntSize. r=dholbert
This commit is contained in:
parent
5bab4f44d4
commit
3879e0afa3
@ -113,6 +113,7 @@
|
||||
#include "nsSVGLength2.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include "nsFontMetrics.h"
|
||||
#include "Units.h"
|
||||
|
||||
#undef free // apparently defined by some windows header, clashing with a free()
|
||||
// method in SkTypes.h
|
||||
@ -4463,7 +4464,8 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
|
||||
// FLAG_CLAMP is added for increased performance, since we never tile here.
|
||||
uint32_t modifiedFlags = image.mDrawingFlags | imgIContainer::FLAG_CLAMP;
|
||||
|
||||
SVGImageContext svgContext(scaledImageSize, Nothing(), CurrentState().globalAlpha);
|
||||
CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
|
||||
SVGImageContext svgContext(sz, Nothing(), CurrentState().globalAlpha);
|
||||
|
||||
auto result = image.mImgContainer->
|
||||
Draw(context, scaledImageSize,
|
||||
|
@ -345,7 +345,7 @@ UnclipViewport(const SVGImageContext& aOldContext,
|
||||
|
||||
// Map the viewport to the inner image. (Note that we don't take the aSize
|
||||
// parameter of Draw into account, just the clipping region.)
|
||||
nsIntSize vSize(aOldContext.GetViewportSize());
|
||||
CSSIntSize vSize(aOldContext.GetViewportSize());
|
||||
vSize.width = ceil(vSize.width * double(innerSize.width) / clipSize.width);
|
||||
vSize.height = ceil(vSize.height * double(innerSize.height) / clipSize.height);
|
||||
|
||||
|
@ -241,7 +241,7 @@ static SVGImageContext
|
||||
OrientViewport(const SVGImageContext& aOldContext,
|
||||
const Orientation& aOrientation)
|
||||
{
|
||||
nsIntSize viewportSize(aOldContext.GetViewportSize());
|
||||
CSSIntSize viewportSize(aOldContext.GetViewportSize());
|
||||
if (aOrientation.SwapsWidthAndHeight()) {
|
||||
swap(viewportSize.width, viewportSize.height);
|
||||
}
|
||||
|
@ -719,11 +719,16 @@ struct SVGDrawingParameters
|
||||
, region(aRegion)
|
||||
, filter(aFilter)
|
||||
, svgContext(aSVGContext)
|
||||
, viewportSize(aSVGContext ? aSVGContext->GetViewportSize() : aSize)
|
||||
, viewportSize(aSize)
|
||||
, animationTime(aAnimationTime)
|
||||
, flags(aFlags)
|
||||
, opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : 1.0)
|
||||
{ }
|
||||
{
|
||||
if (aSVGContext) {
|
||||
CSSIntSize sz = aSVGContext->GetViewportSize();
|
||||
viewportSize = nsIntSize(sz.width, sz.height); // XXX losing unit
|
||||
}
|
||||
}
|
||||
|
||||
gfxContext* context;
|
||||
IntSize size;
|
||||
|
@ -4917,8 +4917,8 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
|
||||
switch (mType) {
|
||||
case eStyleImageType_Image:
|
||||
{
|
||||
nsIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
|
||||
CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
|
||||
return
|
||||
nsLayoutUtils::DrawBackgroundImage(*aRenderingContext.ThebesContext(),
|
||||
aPresContext,
|
||||
|
@ -5746,7 +5746,7 @@ struct SnappedImageDrawingParameters {
|
||||
// one has been explicitly specified. This is the same as |size| except that
|
||||
// it does not take into account any transformation on the gfxContext we're
|
||||
// drawing to - for example, CSS transforms are not taken into account.
|
||||
nsIntSize svgViewportSize;
|
||||
CSSIntSize svgViewportSize;
|
||||
// Whether there's anything to draw at all.
|
||||
bool shouldDraw;
|
||||
|
||||
@ -5758,7 +5758,7 @@ struct SnappedImageDrawingParameters {
|
||||
SnappedImageDrawingParameters(const gfxMatrix& aImageSpaceToDeviceSpace,
|
||||
const nsIntSize& aSize,
|
||||
const ImageRegion& aRegion,
|
||||
const nsIntSize& aSVGViewportSize)
|
||||
const CSSIntSize& aSVGViewportSize)
|
||||
: imageSpaceToDeviceSpace(aImageSpaceToDeviceSpace)
|
||||
, size(aSize)
|
||||
, region(aRegion)
|
||||
@ -5884,10 +5884,10 @@ ComputeSnappedImageDrawingParameters(gfxContext* aCtx,
|
||||
aGraphicsFilter, aImageFlags);
|
||||
gfxSize imageSize(intImageSize.width, intImageSize.height);
|
||||
|
||||
nsIntSize svgViewportSize = currentMatrix.IsIdentity()
|
||||
? intImageSize
|
||||
: nsIntSize(NSAppUnitsToIntPixels(dest.width, aAppUnitsPerDevPixel),
|
||||
NSAppUnitsToIntPixels(dest.height, aAppUnitsPerDevPixel));
|
||||
CSSIntSize svgViewportSize = currentMatrix.IsIdentity()
|
||||
? CSSIntSize(intImageSize.width, intImageSize.height)
|
||||
: CSSIntSize(NSAppUnitsToIntPixels(dest.width, aAppUnitsPerDevPixel), //XXX BUG!
|
||||
NSAppUnitsToIntPixels(dest.height, aAppUnitsPerDevPixel)); //XXX BUG!
|
||||
|
||||
// Compute the set of pixels that would be sampled by an ideal rendering
|
||||
gfxPoint subimageTopLeft =
|
||||
@ -6194,7 +6194,7 @@ nsLayoutUtils::ComputeSizeForDrawingWithFallback(imgIContainer* aImage,
|
||||
nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
|
||||
nsPresContext* aPresContext,
|
||||
imgIContainer* aImage,
|
||||
const nsIntSize& aImageSize,
|
||||
const CSSIntSize& aImageSize,
|
||||
GraphicsFilter aGraphicsFilter,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
|
@ -1667,7 +1667,7 @@ public:
|
||||
static DrawResult DrawBackgroundImage(gfxContext& aContext,
|
||||
nsPresContext* aPresContext,
|
||||
imgIContainer* aImage,
|
||||
const nsIntSize& aImageSize,
|
||||
const CSSIntSize& aImageSize,
|
||||
GraphicsFilter aGraphicsFilter,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "SVGPreserveAspectRatio.h"
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -23,7 +24,7 @@ public:
|
||||
: mGlobalOpacity(1.0)
|
||||
{ }
|
||||
|
||||
SVGImageContext(nsIntSize aViewportSize,
|
||||
SVGImageContext(CSSIntSize aViewportSize,
|
||||
Maybe<SVGPreserveAspectRatio> aPreserveAspectRatio,
|
||||
gfxFloat aOpacity = 1.0)
|
||||
: mViewportSize(aViewportSize)
|
||||
@ -31,7 +32,7 @@ public:
|
||||
, mGlobalOpacity(aOpacity)
|
||||
{ }
|
||||
|
||||
const nsIntSize& GetViewportSize() const {
|
||||
const CSSIntSize& GetViewportSize() const {
|
||||
return mViewportSize;
|
||||
}
|
||||
|
||||
@ -65,7 +66,7 @@ private:
|
||||
return aPAR.Hash();
|
||||
}
|
||||
|
||||
nsIntSize mViewportSize;
|
||||
CSSIntSize mViewportSize;
|
||||
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
|
||||
gfxFloat mGlobalOpacity;
|
||||
};
|
||||
|
@ -366,7 +366,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
|
||||
if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
|
||||
// Package up the attributes of this image element which can override the
|
||||
// attributes of mImageContainer's internal SVG document.
|
||||
SVGImageContext context(nsIntSize(width, height),
|
||||
SVGImageContext context(CSSIntSize(width, height),
|
||||
Some(imgElem->mPreserveAspectRatio.GetAnimValue()));
|
||||
|
||||
nsRect destRect(0, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user