Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: mojo/skia/ganesh_texture_surface.cc

Issue 1534033002: Improve Ganesh helpers. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-8
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/skia/ganesh_texture_surface.h ('k') | mojo/skia/gl_bindings_skia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f58d3ad1d7072bddbebd2f31a4718b94e3dc49f9 100644
--- a/mojo/skia/ganesh_texture_surface.cc
+++ b/mojo/skia/ganesh_texture_surface.cc
@@ -2,34 +2,39 @@
// 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 "third_party/skia/include/gpu/gl/GrGLTypes.h"
+
namespace mojo {
+namespace skia {
-GaneshTextureSurface::GaneshTextureSurface(GaneshContext* context,
+GaneshTextureSurface::GaneshTextureSurface(const GaneshContext::Scope& scope,
std::unique_ptr<GLTexture> texture)
: texture_(std::move(texture)) {
- DCHECK(context);
DCHECK(texture_);
DCHECK(texture_->texture_id());
DCHECK(texture_->size().width > 0);
DCHECK(texture_->size().height > 0);
+ 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(scope.gr_context(), desc, nullptr));
DCHECK(surface_);
}
@@ -40,4 +45,5 @@ std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() {
return std::move(texture_);
}
+} // namespace skia
} // namespace mojo
« no previous file with comments | « mojo/skia/ganesh_texture_surface.h ('k') | mojo/skia/gl_bindings_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698