static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GraphicsContext3D* context,
                                                    TextureAllocator* allocator,
                                                    ManagedTexture* texture)
{
    // Allocate so that we have a valid texture id.
    texture->allocate(allocator);

    GrContext* grContext = context->grContext();
    IntSize canvasSize = texture->size();
    GrPlatformTextureDesc textureDesc;
    textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag;
    textureDesc.fWidth = canvasSize.width();
    textureDesc.fHeight = canvasSize.height();
    textureDesc.fConfig = kSkia8888_PM_GrPixelConfig;
    textureDesc.fTextureHandle = texture->textureId();
    SkAutoTUnref<GrTexture> target(grContext->createPlatformTexture(textureDesc));
    SkAutoTUnref<SkDevice> device(new SkGpuDevice(grContext, target.get()));
    return adoptPtr(new SkCanvas(device.get()));
}