mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 981621 - Don't crash if we fail to create SkiaGL backing texture r=gwright
This commit is contained in:
parent
cddb418a57
commit
d426ef8502
@ -979,7 +979,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
virtual void InitWithGrContext(GrContext* aGrContext,
|
||||
virtual bool InitWithGrContext(GrContext* aGrContext,
|
||||
const IntSize &aSize,
|
||||
SurfaceFormat aFormat)
|
||||
{
|
||||
|
@ -659,7 +659,7 @@ DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
||||
}
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
void
|
||||
bool
|
||||
DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
|
||||
const IntSize &aSize,
|
||||
SurfaceFormat aFormat)
|
||||
@ -681,12 +681,17 @@ DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
|
||||
targetDescriptor.fSampleCnt = 0;
|
||||
|
||||
SkAutoTUnref<GrTexture> skiaTexture(mGrContext->createUncachedTexture(targetDescriptor, NULL, 0));
|
||||
if (!skiaTexture) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mTexture = (uint32_t)skiaTexture->getTextureHandle();
|
||||
|
||||
SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(mGrContext.get(), skiaTexture->asRenderTarget()));
|
||||
SkAutoTUnref<SkCanvas> canvas(new SkCanvas(device.get()));
|
||||
mCanvas = canvas.get();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
void Init(unsigned char* aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat);
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
void InitWithGrContext(GrContext* aGrContext,
|
||||
bool InitWithGrContext(GrContext* aGrContext,
|
||||
const IntSize &aSize,
|
||||
SurfaceFormat aFormat) MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
@ -590,9 +590,10 @@ Factory::CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext,
|
||||
const IntSize &aSize,
|
||||
SurfaceFormat aFormat)
|
||||
{
|
||||
DrawTargetSkia* newDrawTargetSkia = new DrawTargetSkia();
|
||||
newDrawTargetSkia->InitWithGrContext(aGrContext, aSize, aFormat);
|
||||
RefPtr<DrawTarget> newTarget = newDrawTargetSkia;
|
||||
RefPtr<DrawTarget> newTarget = new DrawTargetSkia();
|
||||
if (!newTarget->InitWithGrContext(aGrContext, aSize, aFormat)) {
|
||||
return nullptr;
|
||||
}
|
||||
return newTarget;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user