diff --git a/shell/gpu/ganesh_surface.cc b/shell/gpu/ganesh_surface.cc index c9771de53b0..e64853f8e83 100644 --- a/shell/gpu/ganesh_surface.cc +++ b/shell/gpu/ganesh_surface.cc @@ -10,12 +10,15 @@ namespace sky { namespace shell { -GaneshSurface::GaneshSurface(GaneshContext* context, const gfx::Size& size) { +GaneshSurface::GaneshSurface(intptr_t window_fbo, + GaneshContext* context, + const gfx::Size& size) { GrBackendRenderTargetDesc desc; desc.fWidth = size.width(); desc.fHeight = size.height(); desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = kBottomLeft_GrSurfaceOrigin; + desc.fRenderTargetHandle = window_fbo; auto target = skia::AdoptRef(context->gr()->wrapBackendRenderTarget(desc)); DCHECK(target); diff --git a/shell/gpu/ganesh_surface.h b/shell/gpu/ganesh_surface.h index 9a6ef1490fd..bceaad55d51 100644 --- a/shell/gpu/ganesh_surface.h +++ b/shell/gpu/ganesh_surface.h @@ -15,11 +15,13 @@ namespace sky { namespace shell { // GaneshSurface holds an SkSurface configured to render with Ganesh. Using the -// provided GaneshContext, GaneshSurface wraps an SkSurface around FBO 0 so that -// you can use |canvas()| to draw to FBO 0. +// provided GaneshContext, GaneshSurface wraps an SkSurface around the window +// bound FBO so that you can use |canvas()| to draw to that window bound FBO. class GaneshSurface { public: - GaneshSurface(GaneshContext* context, const gfx::Size& size); + GaneshSurface(intptr_t window_fbo, + GaneshContext* context, + const gfx::Size& size); ~GaneshSurface(); SkCanvas* canvas() const { return surface_->getCanvas(); } diff --git a/shell/gpu/rasterizer.cc b/shell/gpu/rasterizer.cc index cb56a054a45..cd22c560f23 100644 --- a/shell/gpu/rasterizer.cc +++ b/shell/gpu/rasterizer.cc @@ -54,7 +54,7 @@ void Rasterizer::Draw(skia::RefPtr picture) { EnsureGLContext(); CHECK(context_->MakeCurrent(surface_.get())); - EnsureGaneshSurface(size); + EnsureGaneshSurface(surface_->GetBackingFrameBufferObject(), size); DrawPicture(picture.get()); surface_->SwapBuffers(); @@ -84,9 +84,11 @@ void Rasterizer::EnsureGLContext() { ganesh_context_.reset(new GaneshContext(context_.get())); } -void Rasterizer::EnsureGaneshSurface(const gfx::Size& size) { +void Rasterizer::EnsureGaneshSurface(intptr_t window_fbo, + const gfx::Size& size) { if (!ganesh_surface_ || ganesh_surface_->size() != size) - ganesh_surface_.reset(new GaneshSurface(ganesh_context_.get(), size)); + ganesh_surface_.reset( + new GaneshSurface(window_fbo, ganesh_context_.get(), size)); } } // namespace shell diff --git a/shell/gpu/rasterizer.h b/shell/gpu/rasterizer.h index 6118382f8ef..84789143797 100644 --- a/shell/gpu/rasterizer.h +++ b/shell/gpu/rasterizer.h @@ -38,7 +38,7 @@ class Rasterizer : public GPUDelegate { private: void EnsureGLContext(); - void EnsureGaneshSurface(const gfx::Size& size); + void EnsureGaneshSurface(intptr_t window_fbo, const gfx::Size& size); void DrawPicture(SkPicture* picture); scoped_refptr share_group_;