extern "C" AzSkiaSharedGLContextRef AzCreateSkiaSharedGLContext(AzGLContext aGLContext, void *extra, AzIntSize *aSize) { SkNativeSharedGLContext *sharedGLContext = new SkNativeSharedGLContext(aGLContext, extra); if (sharedGLContext == NULL) { return NULL; } if (!sharedGLContext->init(aSize->width, aSize->height)) { return NULL; } return sharedGLContext; }
extern "C" AzSkiaSharedGLContextRef AzCreateSkiaSharedGLContext(AzGLNativeContextRef aNativeContext, AzIntSize *aSize) { GrGLNativeContext* nativeContext = reinterpret_cast<GrGLNativeContext*>(aNativeContext); SkNativeSharedGLContext *sharedGLContext = new SkNativeSharedGLContext(*nativeContext); if (sharedGLContext == NULL) { return NULL; } if (!sharedGLContext->init(aSize->width, aSize->height)) { return NULL; } return sharedGLContext; }
extern "C" AzDrawTargetRef AzCreateSkiaDrawTargetForFBO(AzSkiaSharedGLContextRef aGLContext, AzIntSize *aSize, AzSurfaceFormat aFormat) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); GrContext *grContext = sharedGLContext->getGrContext(); grContext->AddRef(); gfx::IntSize *size = reinterpret_cast<gfx::IntSize*>(aSize); gfx::SurfaceFormat surfaceFormat = static_cast<gfx::SurfaceFormat>(aFormat); RefPtr<gfx::DrawTarget> target = gfx::Factory::CreateSkiaDrawTargetForFBO(sharedGLContext->getFBOID(), grContext, *size, surfaceFormat); target->AddRef(); return target; }
extern "C" void AzSkiaSharedGLContextFlush(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); sharedGLContext->flush(); }
extern "C" void AzSkiaSharedGLContextMakeCurrent(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); sharedGLContext->makeCurrent(); }
extern "C" AzSkiaGrContextRef AzSkiaSharedGLContextGetGrContext(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); return sharedGLContext->getGrContext(); }
extern "C" unsigned int AzSkiaSharedGLContextStealTextureID(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); return sharedGLContext->stealTextureID(); }
extern "C" unsigned int AzSkiaSharedGLContextGetFBOID(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); return sharedGLContext->getFBOID(); }
extern "C" void AzReleaseSkiaSharedGLContext(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); sharedGLContext->Release(); }
extern "C" void AzRetainSkiaSharedGLContext(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); sharedGLContext->AddRef(); }
extern "C" AzSkiaGrGLSharedSurfaceRef AzSkiaSharedGLContextStealSurface(AzSkiaSharedGLContextRef aGLContext) { SkNativeSharedGLContext *sharedGLContext = static_cast<SkNativeSharedGLContext*>(aGLContext); return reinterpret_cast<void*>(sharedGLContext->stealSurface()); }