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

Side by Side Diff: mojo/skia/ganesh_surface.cc

Issue 759763002: Fix DCHECK(gr_texture) when running test_sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « mojo/gpu/gl_context_owner.h ('k') | sky/compositor/layer_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/skia/ganesh_surface.h" 5 #include "mojo/skia/ganesh_surface.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 8
9 GaneshSurface::GaneshSurface(GaneshContext* context, 9 GaneshSurface::GaneshSurface(GaneshContext* context,
10 scoped_ptr<GLTexture> texture) 10 scoped_ptr<GLTexture> texture)
11 : texture_(texture.Pass()) { 11 : texture_(texture.Pass()) {
12 GrBackendTextureDesc desc; 12 GrBackendTextureDesc desc;
13 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 13 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
14 desc.fWidth = texture_->size().width; 14 desc.fWidth = texture_->size().width;
15 desc.fHeight = texture_->size().height; 15 desc.fHeight = texture_->size().height;
16 desc.fConfig = kSkia8888_GrPixelConfig; 16 desc.fConfig = kSkia8888_GrPixelConfig;
17 desc.fOrigin = kTopLeft_GrSurfaceOrigin; 17 desc.fOrigin = kTopLeft_GrSurfaceOrigin;
18 desc.fTextureHandle = texture_->texture_id(); 18 desc.fTextureHandle = texture_->texture_id();
19 DCHECK(texture_->texture_id());
19 20
20 auto gr_texture = skia::AdoptRef(context->gr()->wrapBackendTexture(desc)); 21 auto gr_texture = skia::AdoptRef(context->gr()->wrapBackendTexture(desc));
21 DCHECK(gr_texture); 22 DCHECK(gr_texture);
22 surface_ = skia::AdoptRef( 23 surface_ = skia::AdoptRef(
23 SkSurface::NewRenderTargetDirect(gr_texture->asRenderTarget())); 24 SkSurface::NewRenderTargetDirect(gr_texture->asRenderTarget()));
24 DCHECK(surface_); 25 DCHECK(surface_);
25 } 26 }
26 27
27 GaneshSurface::~GaneshSurface() { 28 GaneshSurface::~GaneshSurface() {
28 } 29 }
29 30
30 scoped_ptr<GLTexture> GaneshSurface::TakeTexture() { 31 scoped_ptr<GLTexture> GaneshSurface::TakeTexture() {
31 surface_.clear(); 32 surface_.clear();
32 return texture_.Pass(); 33 return texture_.Pass();
33 } 34 }
34 35
35 } // namespace mojo 36 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/gpu/gl_context_owner.h ('k') | sky/compositor/layer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698