mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 991028 - Stop using OpenDescriptor in ContentClientIncremental. r=nical
This commit is contained in:
parent
d532a9c01b
commit
25cf440923
@ -572,14 +572,16 @@ WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
|
||||
}
|
||||
|
||||
static void
|
||||
FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion,
|
||||
FillSurface(DrawTarget* aDT, const nsIntRegion& aRegion,
|
||||
const nsIntPoint& aOffset, const gfxRGBA& aColor)
|
||||
{
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(aSurface);
|
||||
ctx->Translate(-gfxPoint(aOffset.x, aOffset.y));
|
||||
gfxUtils::ClipToRegion(ctx, aRegion);
|
||||
ctx->SetColor(aColor);
|
||||
ctx->Paint();
|
||||
nsIntRegionRectIterator iter(aRegion);
|
||||
const nsIntRect* r;
|
||||
while ((r = iter.Next()) != nullptr) {
|
||||
aDT->FillRect(Rect(r->x - aOffset.x, r->y - aOffset.y,
|
||||
r->width, r->height),
|
||||
ColorPattern(ToColor(aColor)));
|
||||
}
|
||||
}
|
||||
|
||||
RotatedContentBuffer::PaintState
|
||||
@ -799,22 +801,19 @@ ContentClientIncremental::BorrowDrawTargetForPainting(ThebesLayer* aLayer,
|
||||
// if it wants more to be repainted than we request.
|
||||
if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
||||
nsIntRegion drawRegionCopy = aPaintState.mRegionToDraw;
|
||||
nsRefPtr<gfxASurface> onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy);
|
||||
nsRefPtr<gfxASurface> onWhite = GetUpdateSurface(BUFFER_WHITE, aPaintState.mRegionToDraw);
|
||||
RefPtr<DrawTarget> onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy);
|
||||
RefPtr<DrawTarget> onWhite = GetUpdateSurface(BUFFER_WHITE, aPaintState.mRegionToDraw);
|
||||
if (onBlack && onWhite) {
|
||||
NS_ASSERTION(aPaintState.mRegionToDraw == drawRegionCopy,
|
||||
"BeginUpdate should always modify the draw region in the same way!");
|
||||
FillSurface(onBlack, aPaintState.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(0.0, 0.0, 0.0, 1.0));
|
||||
FillSurface(onWhite, aPaintState.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(1.0, 1.0, 1.0, 1.0));
|
||||
RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize().ToIntSize());
|
||||
RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize().ToIntSize());
|
||||
mLoanedDrawTarget = Factory::CreateDualDrawTarget(onBlackDT, onWhiteDT);
|
||||
mLoanedDrawTarget = Factory::CreateDualDrawTarget(onBlack, onWhite);
|
||||
} else {
|
||||
mLoanedDrawTarget = nullptr;
|
||||
}
|
||||
} else {
|
||||
nsRefPtr<gfxASurface> surf = GetUpdateSurface(BUFFER_BLACK, aPaintState.mRegionToDraw);
|
||||
mLoanedDrawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize().ToIntSize());
|
||||
mLoanedDrawTarget = GetUpdateSurface(BUFFER_BLACK, aPaintState.mRegionToDraw);
|
||||
}
|
||||
if (!mLoanedDrawTarget) {
|
||||
NS_WARNING("unable to get context for update");
|
||||
@ -866,7 +865,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
|
||||
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
TemporaryRef<DrawTarget>
|
||||
ContentClientIncremental::GetUpdateSurface(BufferType aType,
|
||||
const nsIntRegion& aUpdateRegion)
|
||||
{
|
||||
@ -883,9 +882,6 @@ ContentClientIncremental::GetUpdateSurface(BufferType aType,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> tmpASurface =
|
||||
ShadowLayerForwarder::OpenDescriptor(OPEN_READ_WRITE, desc);
|
||||
|
||||
if (aType == BUFFER_BLACK) {
|
||||
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptor));
|
||||
mUpdateDescriptor = desc;
|
||||
@ -895,7 +891,7 @@ ContentClientIncremental::GetUpdateSurface(BufferType aType,
|
||||
mUpdateDescriptorOnWhite = desc;
|
||||
}
|
||||
|
||||
return tmpASurface.forget();
|
||||
return GetDrawTargetForDescriptor(desc, gfx::BackendType::COREGRAPHICS);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ private:
|
||||
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface> GetUpdateSurface(BufferType aType,
|
||||
TemporaryRef<gfx::DrawTarget> GetUpdateSurface(BufferType aType,
|
||||
const nsIntRegion& aUpdateRegion);
|
||||
|
||||
TextureInfo mTextureInfo;
|
||||
|
@ -312,7 +312,7 @@ bool
|
||||
CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
|
||||
SurfaceDescriptor* aOutSnapshot)
|
||||
{
|
||||
RefPtr<DrawTarget> target = GetDrawTargetForDescriptor(aInSnapshot);
|
||||
RefPtr<DrawTarget> target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO);
|
||||
ForceComposeToTarget(target);
|
||||
*aOutSnapshot = aInSnapshot;
|
||||
return true;
|
||||
|
@ -77,12 +77,12 @@ GetAddressFromDescriptor(const SurfaceDescriptor& aDescriptor, size_t& aSize)
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::DrawTarget>
|
||||
GetDrawTargetForDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
GetDrawTargetForDescriptor(const SurfaceDescriptor& aDescriptor, gfx::BackendType aBackend)
|
||||
{
|
||||
size_t size;
|
||||
uint8_t* data = GetAddressFromDescriptor(aDescriptor, size);
|
||||
ImageDataDeserializer image(data, size);
|
||||
return image.GetAsDrawTarget(gfx::BackendType::CAIRO);
|
||||
return image.GetAsDrawTarget(aBackend);
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::DataSourceSurface>
|
||||
|
@ -72,7 +72,7 @@ bool IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface);
|
||||
bool IsSurfaceDescriptorOwned(const SurfaceDescriptor& aDescriptor);
|
||||
bool ReleaseOwnedSurfaceDescriptor(const SurfaceDescriptor& aDescriptor);
|
||||
|
||||
TemporaryRef<gfx::DrawTarget> GetDrawTargetForDescriptor(const SurfaceDescriptor& aDescriptor);
|
||||
TemporaryRef<gfx::DrawTarget> GetDrawTargetForDescriptor(const SurfaceDescriptor& aDescriptor, gfx::BackendType aBackend);
|
||||
TemporaryRef<gfx::DataSourceSurface> GetSurfaceForDescriptor(const SurfaceDescriptor& aDescriptor);
|
||||
/**
|
||||
* An interface used to create and destroy surfaces that are shared with the
|
||||
|
Loading…
Reference in New Issue
Block a user