зеркало из https://github.com/mozilla/gecko-dev.git
Bug 848491 - Update DrawTarget and gfxPlatform to use the new Skia APIs r=mattwoodrow
This commit is contained in:
Родитель
6cb4038886
Коммит
8a86a63e18
|
@ -604,15 +604,16 @@ DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
|||
void
|
||||
DrawTargetSkia::InitWithFBO(unsigned int aFBOID, GrContext* aGrContext, const IntSize &aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
GrPlatformRenderTargetDesc targetDescriptor;
|
||||
GrBackendRenderTargetDesc targetDescriptor;
|
||||
|
||||
targetDescriptor.fWidth = aSize.width;
|
||||
targetDescriptor.fHeight = aSize.height;
|
||||
targetDescriptor.fConfig = GfxFormatToGrConfig(aFormat);
|
||||
targetDescriptor.fOrigin = kBottomLeft_GrSurfaceOrigin;
|
||||
targetDescriptor.fSampleCnt = 0;
|
||||
targetDescriptor.fRenderTargetHandle = aFBOID;
|
||||
|
||||
SkAutoTUnref<GrRenderTarget> target(aGrContext->createPlatformRenderTarget(targetDescriptor));
|
||||
SkAutoTUnref<GrRenderTarget> target(aGrContext->wrapBackendRenderTarget(targetDescriptor));
|
||||
|
||||
SkAutoTUnref<SkDevice> device(new SkGpuDevice(aGrContext, target.get()));
|
||||
SkAutoTUnref<SkCanvas> canvas(new SkCanvas(device.get()));
|
||||
|
|
|
@ -33,10 +33,25 @@ GfxFormatToSkiaConfig(SurfaceFormat format)
|
|||
return SkBitmap::kRGB_565_Config;
|
||||
case FORMAT_A8:
|
||||
return SkBitmap::kA8_Config;
|
||||
|
||||
default:
|
||||
return SkBitmap::kARGB_8888_Config;
|
||||
}
|
||||
}
|
||||
|
||||
return SkBitmap::kARGB_8888_Config;
|
||||
static inline SurfaceFormat
|
||||
SkiaConfigToGfxFormat(SkBitmap::Config config)
|
||||
{
|
||||
switch (config)
|
||||
{
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
return FORMAT_B8G8R8A8;
|
||||
case SkBitmap::kRGB_565_Config:
|
||||
return FORMAT_R5G6B5;
|
||||
case SkBitmap::kA8_Config:
|
||||
return FORMAT_A8;
|
||||
default:
|
||||
return FORMAT_B8G8R8A8;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
|
|
|
@ -833,7 +833,7 @@ gfxPlatform::CreateDrawTargetForFBO(unsigned int aFBOID, mozilla::gl::GLContext*
|
|||
GrContext* ctx = reinterpret_cast<GrContext*>(aGLContext->GetUserData(&sGrContextKey));
|
||||
if (!ctx) {
|
||||
GrGLInterface* grInterface = CreateGrInterfaceFromGLContext(aGLContext);
|
||||
ctx = GrContext::Create(kOpenGL_Shaders_GrEngine, (GrPlatform3DContext)grInterface);
|
||||
ctx = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)grInterface);
|
||||
aGLContext->SetUserData(&sGrContextKey, ctx);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче