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

Unified Diff: mojo/skia/ganesh_texture_surface.cc

Issue 1518793004: Improve GL bindings for Ganesh surfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 5 years 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') | no next file » | 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_surface.cc b/mojo/skia/ganesh_texture_surface.cc
similarity index 57%
rename from mojo/skia/ganesh_surface.cc
rename to mojo/skia/ganesh_texture_surface.cc
index 11fe502cb82f7587a3a82dc6240ac9925c17bf93..2eccb81597e51aece84eab4eb40e8e9cb380cbc4 100644
--- a/mojo/skia/ganesh_surface.cc
+++ b/mojo/skia/ganesh_texture_surface.cc
@@ -2,13 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/skia/ganesh_surface.h"
+#include "base/logging.h"
+#include "mojo/skia/ganesh_texture_surface.h"
namespace mojo {
-GaneshSurface::GaneshSurface(GaneshContext* context,
- scoped_ptr<GLTexture> texture)
- : texture_(texture.Pass()) {
+GaneshTextureSurface::GaneshTextureSurface(GaneshContext* context,
+ 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);
+
GrBackendTextureDesc desc;
desc.fFlags = kRenderTarget_GrBackendTextureFlag;
desc.fWidth = texture_->size().width;
@@ -16,22 +23,21 @@ GaneshSurface::GaneshSurface(GaneshContext* context,
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fTextureHandle = texture_->texture_id();
- DCHECK(texture_->texture_id());
- auto gr_texture = skia::AdoptRef(
+ skia::RefPtr<GrTexture> gr_texture = skia::AdoptRef(
context->gr()->textureProvider()->wrapBackendTexture(desc));
DCHECK(gr_texture);
+
surface_ = skia::AdoptRef(
SkSurface::NewRenderTargetDirect(gr_texture->asRenderTarget()));
DCHECK(surface_);
}
-GaneshSurface::~GaneshSurface() {
-}
+GaneshTextureSurface::~GaneshTextureSurface() {}
-scoped_ptr<GLTexture> GaneshSurface::TakeTexture() {
+std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() {
surface_.clear();
- return texture_.Pass();
+ return std::move(texture_);
}
} // namespace mojo
« no previous file with comments | « mojo/skia/ganesh_texture_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698