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

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

Issue 984153004: SkyShell DCHECKs on startup sometimes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | 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 "sky/shell/gpu/ganesh_context.h" 7 #include "sky/shell/gpu/ganesh_context.h"
8 #include "sky/shell/gpu/ganesh_surface.h" 8 #include "sky/shell/gpu/ganesh_surface.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPicture.h" 10 #include "third_party/skia/include/core/SkPicture.h"
(...skipping 26 matching lines...) Expand all
37 37
38 void Rasterizer::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { 38 void Rasterizer::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) {
39 surface_ = gfx::GLSurface::CreateViewGLSurface(widget); 39 surface_ = gfx::GLSurface::CreateViewGLSurface(widget);
40 CHECK(surface_) << "GLSurface required."; 40 CHECK(surface_) << "GLSurface required.";
41 } 41 }
42 42
43 void Rasterizer::Draw(skia::RefPtr<SkPicture> picture) { 43 void Rasterizer::Draw(skia::RefPtr<SkPicture> picture) {
44 if (!surface_) 44 if (!surface_)
45 return; 45 return;
46 46
47 gfx::Size size = GetSize(picture.get());
48 if (size.IsEmpty())
49 return;
50
47 EnsureGLContext(); 51 EnsureGLContext();
48 CHECK(context_->MakeCurrent(surface_.get())); 52 CHECK(context_->MakeCurrent(surface_.get()));
49 EnsureGaneshSurface(GetSize(picture.get())); 53 EnsureGaneshSurface(size);
50 54
51 SkCanvas* canvas = ganesh_surface_->canvas(); 55 SkCanvas* canvas = ganesh_surface_->canvas();
52 canvas->drawPicture(picture.get()); 56 canvas->drawPicture(picture.get());
53 canvas->flush(); 57 canvas->flush();
54 58
55 surface_->SwapBuffers(); 59 surface_->SwapBuffers();
56 } 60 }
57 61
58 void Rasterizer::OnOutputSurfaceDestroyed() { 62 void Rasterizer::OnOutputSurfaceDestroyed() {
59 ganesh_surface_.reset(); 63 ganesh_surface_.reset();
(...skipping 12 matching lines...) Expand all
72 ganesh_context_.reset(new GaneshContext(context_.get())); 76 ganesh_context_.reset(new GaneshContext(context_.get()));
73 } 77 }
74 78
75 void Rasterizer::EnsureGaneshSurface(const gfx::Size& size) { 79 void Rasterizer::EnsureGaneshSurface(const gfx::Size& size) {
76 if (!ganesh_surface_ || ganesh_surface_->size() != size) 80 if (!ganesh_surface_ || ganesh_surface_->size() != size)
77 ganesh_surface_.reset(new GaneshSurface(ganesh_context_.get(), size)); 81 ganesh_surface_.reset(new GaneshSurface(ganesh_context_.get(), size));
78 } 82 }
79 83
80 } // namespace shell 84 } // namespace shell
81 } // namespace sky 85 } // namespace sky
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698