mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1231888 - Remove AutoCairoPixmanBugWorkaround. r=jrmuizel.
This commit is contained in:
parent
4f2906ffbb
commit
e31c9366c0
@ -391,12 +391,6 @@ gfxUtils::ConvertBGRAtoRGBA(uint8_t* aData, uint32_t aLength)
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
IsSafeImageTransformComponent(gfxFloat aValue)
|
||||
{
|
||||
return aValue >= -32768 && aValue <= 32767;
|
||||
}
|
||||
|
||||
#if !defined(MOZ_GFX_OPTIMIZE_MOBILE)
|
||||
/**
|
||||
* This returns the fastest operator to use for solid surfaces which have no
|
||||
@ -468,83 +462,6 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
|
||||
}
|
||||
#endif // !MOZ_GFX_OPTIMIZE_MOBILE
|
||||
|
||||
// working around cairo/pixman bug (bug 364968)
|
||||
// Our device-space-to-image-space transform may not be acceptable to pixman.
|
||||
struct MOZ_STACK_CLASS AutoCairoPixmanBugWorkaround
|
||||
{
|
||||
AutoCairoPixmanBugWorkaround(gfxContext* aContext,
|
||||
const gfxMatrix& aDeviceSpaceToImageSpace,
|
||||
const gfxRect& aFill,
|
||||
const gfxASurface* aSurface)
|
||||
: mContext(aContext), mSucceeded(true), mPushedGroup(false)
|
||||
{
|
||||
// Quartz's limits for matrix are much larger than pixman
|
||||
if (!aSurface || aSurface->GetType() == gfxSurfaceType::Quartz)
|
||||
return;
|
||||
|
||||
if (!IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._11) ||
|
||||
!IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._21) ||
|
||||
!IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._12) ||
|
||||
!IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._22)) {
|
||||
NS_WARNING("Scaling up too much, bailing out");
|
||||
mSucceeded = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._31) &&
|
||||
IsSafeImageTransformComponent(aDeviceSpaceToImageSpace._32))
|
||||
return;
|
||||
|
||||
// We'll push a group, which will hopefully reduce our transform's
|
||||
// translation so it's in bounds.
|
||||
gfxMatrix currentMatrix = mContext->CurrentMatrix();
|
||||
mContext->Save();
|
||||
|
||||
// Clip the rounded-out-to-device-pixels bounds of the
|
||||
// transformed fill area. This is the area for the group we
|
||||
// want to push.
|
||||
mContext->SetMatrix(gfxMatrix());
|
||||
gfxRect bounds = currentMatrix.TransformBounds(aFill);
|
||||
bounds.RoundOut();
|
||||
mContext->Clip(bounds);
|
||||
mContext->SetMatrix(currentMatrix);
|
||||
mContext->PushGroupForBlendBack(gfxContentType::COLOR_ALPHA);
|
||||
mContext->SetOp(CompositionOp::OP_OVER);
|
||||
|
||||
mPushedGroup = true;
|
||||
}
|
||||
|
||||
~AutoCairoPixmanBugWorkaround()
|
||||
{
|
||||
if (mPushedGroup) {
|
||||
mContext->PopGroupAndBlend();
|
||||
mContext->Restore();
|
||||
}
|
||||
}
|
||||
|
||||
bool PushedGroup() { return mPushedGroup; }
|
||||
bool Succeeded() { return mSucceeded; }
|
||||
|
||||
private:
|
||||
gfxContext* mContext;
|
||||
bool mSucceeded;
|
||||
bool mPushedGroup;
|
||||
};
|
||||
|
||||
static gfxMatrix
|
||||
DeviceToImageTransform(gfxContext* aContext)
|
||||
{
|
||||
gfxFloat deviceX, deviceY;
|
||||
RefPtr<gfxASurface> currentTarget =
|
||||
aContext->CurrentSurface(&deviceX, &deviceY);
|
||||
gfxMatrix deviceToUser = aContext->CurrentMatrix();
|
||||
if (!deviceToUser.Invert()) {
|
||||
return gfxMatrix(0, 0, 0, 0, 0, 0); // singular
|
||||
}
|
||||
deviceToUser.Translate(-gfxPoint(-deviceX, -deviceY));
|
||||
return deviceToUser;
|
||||
}
|
||||
|
||||
/* These heuristics are based on Source/WebCore/platform/graphics/skia/ImageSkia.cpp:computeResamplingMode() */
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
static Filter ReduceResamplingFilter(Filter aFilter,
|
||||
@ -724,14 +641,6 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
|
||||
gfxRect region(aRegion.Rect());
|
||||
ExtendMode extendMode = aRegion.GetExtendMode();
|
||||
|
||||
RefPtr<gfxASurface> currentTarget = aContext->CurrentSurface();
|
||||
gfxMatrix deviceSpaceToImageSpace = DeviceToImageTransform(aContext);
|
||||
|
||||
AutoCairoPixmanBugWorkaround workaround(aContext, deviceSpaceToImageSpace,
|
||||
region, currentTarget);
|
||||
if (!workaround.Succeeded())
|
||||
return;
|
||||
|
||||
RefPtr<gfxDrawable> drawable = aDrawable;
|
||||
|
||||
aFilter = ReduceResamplingFilter(aFilter,
|
||||
|
Loading…
Reference in New Issue
Block a user