| Index: mojo/skia/ganesh_texture_surface.cc
|
| diff --git a/mojo/skia/ganesh_texture_surface.cc b/mojo/skia/ganesh_texture_surface.cc
|
| index 2eccb81597e51aece84eab4eb40e8e9cb380cbc4..e3a35cded15b76c60ca85bec67c9950d6af0320e 100644
|
| --- a/mojo/skia/ganesh_texture_surface.cc
|
| +++ b/mojo/skia/ganesh_texture_surface.cc
|
| @@ -2,10 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/logging.h"
|
| #include "mojo/skia/ganesh_texture_surface.h"
|
|
|
| +#include <GLES2/gl2.h>
|
| +
|
| +#include "base/logging.h"
|
| +#include "mojo/gpu/gl_texture.h"
|
| +#include "mojo/skia/ganesh_context.h"
|
| +#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
|
| +
|
| namespace mojo {
|
| +namespace skia {
|
|
|
| GaneshTextureSurface::GaneshTextureSurface(GaneshContext* context,
|
| std::unique_ptr<GLTexture> texture)
|
| @@ -15,21 +22,23 @@ GaneshTextureSurface::GaneshTextureSurface(GaneshContext* context,
|
| DCHECK(texture_->texture_id());
|
| DCHECK(texture_->size().width > 0);
|
| DCHECK(texture_->size().height > 0);
|
| + GaneshContext::Scope scope(context);
|
| +
|
| + GrGLTextureInfo info;
|
| + info.fTarget = GL_TEXTURE_2D;
|
| + info.fID = texture_->texture_id();
|
|
|
| GrBackendTextureDesc desc;
|
| desc.fFlags = kRenderTarget_GrBackendTextureFlag;
|
| + desc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
| desc.fWidth = texture_->size().width;
|
| desc.fHeight = texture_->size().height;
|
| desc.fConfig = kSkia8888_GrPixelConfig;
|
| - desc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
| - desc.fTextureHandle = texture_->texture_id();
|
| -
|
| - skia::RefPtr<GrTexture> gr_texture = skia::AdoptRef(
|
| - context->gr()->textureProvider()->wrapBackendTexture(desc));
|
| - DCHECK(gr_texture);
|
| + desc.fSampleCnt = 0;
|
| + desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info);
|
|
|
| - surface_ = skia::AdoptRef(
|
| - SkSurface::NewRenderTargetDirect(gr_texture->asRenderTarget()));
|
| + surface_ = ::skia::AdoptRef(
|
| + SkSurface::NewFromBackendTexture(context->gr_context(), desc, nullptr));
|
| DCHECK(surface_);
|
| }
|
|
|
| @@ -40,4 +49,5 @@ std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() {
|
| return std::move(texture_);
|
| }
|
|
|
| +} // namespace skia
|
| } // namespace mojo
|
|
|