Add APIs and plumbing for external rendertaret-textures w/ and w/out MSAA.
Review URL: http://codereview.appspot.com/4388049/
git-svn-id: http://skia.googlecode.com/svn/trunk@1102 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index b17a238..8017f73 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -267,16 +267,26 @@
///////////////////////////////////////////////////////////////////////////////
-GrRenderTarget* GrContext::createPlatformRenderTarget(
- intptr_t platformRenderTarget,
- int stencilBits,
- bool isMultisampled,
- int width, int height) {
- return fGpu->createPlatformRenderTarget(platformRenderTarget, stencilBits,
- isMultisampled,
- width, height);
+GrResource* GrContext::createPlatformSurface(const GrPlatformSurfaceDesc& desc) {
+ // validate flags here so that GrGpu subclasses don't have to check
+ if (kTexture_GrPlatformSurfaceType == desc.fSurfaceType &&
+ 0 != desc.fRenderTargetFlags) {
+ return NULL;
+ }
+ if (!(kIsMultisampled_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags) &&
+ (kGrCanResolve_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags)) {
+ return NULL;
+ }
+ if (kTextureRenderTarget_GrPlatformSurfaceType == desc.fSurfaceType &&
+ (kIsMultisampled_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags) &&
+ !(kGrCanResolve_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags)) {
+ return NULL;
+ }
+ return fGpu->createPlatformSurface(desc);
}
+///////////////////////////////////////////////////////////////////////////////
+
bool GrContext::supportsIndex8PixelConfig(const GrSamplerState& sampler,
int width, int height) {
if (!fGpu->supports8BitPalette()) {