Reviewed by Kenneth Russell.
Use new skia API for wrapping DrawingBuffer's FBO/Tex IDs in skia object
https://bugs.webkit.org/show_bug.cgi?id=58363
No new tests needed, exercised by all existing canvas2d tests.
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBuffer::getGrPlatformSurfaceDesc):
* platform/graphics/gpu/DrawingBuffer.h:
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83733
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-04-13 Brian Salomon <bsalomon@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Use new skia API for wrapping DrawingBuffer's FBO/Tex IDs in skia object
+ https://bugs.webkit.org/show_bug.cgi?id=58363
+
+ No new tests needed, exercised by all existing canvas2d tests.
+
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBuffer::getGrPlatformSurfaceDesc):
+ * platform/graphics/gpu/DrawingBuffer.h:
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
+
2011-04-13 Andrey Kosyakov <caseq@chromium.org>
Unreviewed. Fix chromium clang build problem:
// the SharedGraphicsContext3D object that is giving us the context.
m_grContext = context;
}
+
+void DrawingBuffer::getGrPlatformSurfaceDesc(GrPlatformSurfaceDesc* desc)
+{
+ desc->fSurfaceType = kTextureRenderTarget_GrPlatformSurfaceType;
+
+ desc->fPlatformTexture = m_colorBuffer;
+ if (multisample()) {
+ desc->fRenderTargetFlags = kIsMultisampled_GrPlatformRenderTargetFlagBit | kGrCanResolve_GrPlatformRenderTargetFlagBit;
+ desc->fPlatformRenderTarget = m_multisampleFBO;
+ desc->fPlatformResolveDestination = m_fbo;
+ } else {
+ desc->fRenderTargetFlags = kNone_GrPlatformRenderTargetFlagBit;
+ desc->fPlatformRenderTarget = m_fbo;
+ desc->fPlatformResolveDestination = 0;
+ }
+
+ desc->fWidth = m_size.width();
+ desc->fHeight = m_size.height();
+ desc->fConfig = kRGBA_8888_GrPixelConfig;
+
+ desc->fStencilBits = (m_depthStencilBuffer || m_stencilBuffer) ? 8 : 0;
+}
+
#endif
}
#if ENABLE(SKIA_GPU)
class GrContext;
+struct GrPlatformSurfaceDesc;
#endif
namespace WebCore {
#if ENABLE(SKIA_GPU)
void setGrContext(GrContext* ctx);
+ void getGrPlatformSurfaceDesc(GrPlatformSurfaceDesc*);
#endif
PassRefPtr<GraphicsContext3D> graphicsContext3D() const { return m_context; }
gr->resetContext();
drawingBuffer->setGrContext(gr);
- SkDeviceFactory* factory = new SkGpuDeviceFactory(gr, SkGpuDevice::Current3DApiRenderTarget());
+ GrPlatformSurfaceDesc drawBufDesc;
+ drawingBuffer->getGrPlatformSurfaceDesc(&drawBufDesc);
+ GrTexture* drawBufTex = static_cast<GrTexture*>(gr->createPlatformSurface(drawBufDesc));
+ SkDeviceFactory* factory = new SkGpuDeviceFactory(gr, drawBufTex);
+ drawBufTex->unref();
+
SkDevice* device = factory->newDevice(m_canvas, SkBitmap::kARGB_8888_Config, drawingBuffer->size().width(), drawingBuffer->size().height(), false, false);
m_canvas->setDevice(device)->unref();
m_canvas->setDeviceFactory(factory);