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

Side by Side Diff: sky/shell/gpu/rasterizer.cc

Issue 1214263002: Fix corrupted rendering of images (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « sky/shell/gpu/ganesh_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "sky/shell/gpu/rasterizer.h" 5 #include "sky/shell/gpu/rasterizer.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "sky/shell/gpu/ganesh_context.h" 8 #include "sky/shell/gpu/ganesh_context.h"
9 #include "sky/shell/gpu/ganesh_surface.h" 9 #include "sky/shell/gpu/ganesh_surface.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 void Rasterizer::DrawPicture(SkPicture* picture) { 63 void Rasterizer::DrawPicture(SkPicture* picture) {
64 TRACE_EVENT0("sky", "Rasterizer::DrawPicture"); 64 TRACE_EVENT0("sky", "Rasterizer::DrawPicture");
65 SkCanvas* canvas = ganesh_surface_->canvas(); 65 SkCanvas* canvas = ganesh_surface_->canvas();
66 canvas->drawPicture(picture); 66 canvas->drawPicture(picture);
67 canvas->flush(); 67 canvas->flush();
68 } 68 }
69 69
70 void Rasterizer::OnOutputSurfaceDestroyed() { 70 void Rasterizer::OnOutputSurfaceDestroyed() {
71 CHECK(context_->MakeCurrent(surface_.get()));
71 ganesh_surface_.reset(); 72 ganesh_surface_.reset();
72 ganesh_context_.reset(); 73 ganesh_context_.reset();
73 context_ = nullptr; 74 context_ = nullptr;
74 surface_ = nullptr; 75 surface_ = nullptr;
75 } 76 }
76 77
77 void Rasterizer::EnsureGLContext() { 78 void Rasterizer::EnsureGLContext() {
78 if (context_) 79 if (context_)
79 return; 80 return;
80 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), surface_.get(), 81 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), surface_.get(),
81 gfx::PreferIntegratedGpu); 82 gfx::PreferIntegratedGpu);
82 CHECK(context_) << "GLContext required."; 83 CHECK(context_) << "GLContext required.";
83 CHECK(context_->MakeCurrent(surface_.get())); 84 CHECK(context_->MakeCurrent(surface_.get()));
84 ganesh_context_.reset(new GaneshContext(context_.get())); 85 ganesh_context_.reset(new GaneshContext(context_.get()));
85 } 86 }
86 87
87 void Rasterizer::EnsureGaneshSurface(intptr_t window_fbo, 88 void Rasterizer::EnsureGaneshSurface(intptr_t window_fbo,
88 const gfx::Size& size) { 89 const gfx::Size& size) {
89 if (!ganesh_surface_ || ganesh_surface_->size() != size) 90 if (!ganesh_surface_ || ganesh_surface_->size() != size)
90 ganesh_surface_.reset( 91 ganesh_surface_.reset(
91 new GaneshSurface(window_fbo, ganesh_context_.get(), size)); 92 new GaneshSurface(window_fbo, ganesh_context_.get(), size));
92 } 93 }
93 94
94 } // namespace shell 95 } // namespace shell
95 } // namespace sky 96 } // namespace sky
OLDNEW
« no previous file with comments | « sky/shell/gpu/ganesh_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698