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

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

Issue 1235813005: Add machinery for dumping SkPictures to disk (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/picture_serializer.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 "sky/shell/gpu/picture_serializer.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkPicture.h" 12 #include "third_party/skia/include/core/SkPicture.h"
12 #include "ui/gl/gl_bindings.h" 13 #include "ui/gl/gl_bindings.h"
13 #include "ui/gl/gl_context.h" 14 #include "ui/gl/gl_context.h"
14 #include "ui/gl/gl_share_group.h" 15 #include "ui/gl/gl_share_group.h"
15 #include "ui/gl/gl_surface.h" 16 #include "ui/gl/gl_surface.h"
16 17
17 namespace sky { 18 namespace sky {
18 namespace shell { 19 namespace shell {
19 namespace { 20 namespace {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 gfx::Size size = GetSize(picture.get()); 52 gfx::Size size = GetSize(picture.get());
52 if (size.IsEmpty()) 53 if (size.IsEmpty())
53 return; 54 return;
54 55
55 EnsureGLContext(); 56 EnsureGLContext();
56 CHECK(context_->MakeCurrent(surface_.get())); 57 CHECK(context_->MakeCurrent(surface_.get()));
57 EnsureGaneshSurface(surface_->GetBackingFrameBufferObject(), size); 58 EnsureGaneshSurface(surface_->GetBackingFrameBufferObject(), size);
58 59
59 DrawPicture(picture.get()); 60 DrawPicture(picture.get());
60 surface_->SwapBuffers(); 61 surface_->SwapBuffers();
62
63 // SerializePicture("/data/data/org.domokit.sky.demo/cache/layer0.skp", pictur e.get());
61 } 64 }
62 65
63 void Rasterizer::DrawPicture(SkPicture* picture) { 66 void Rasterizer::DrawPicture(SkPicture* picture) {
64 TRACE_EVENT0("sky", "Rasterizer::DrawPicture"); 67 TRACE_EVENT0("sky", "Rasterizer::DrawPicture");
65 SkCanvas* canvas = ganesh_surface_->canvas(); 68 SkCanvas* canvas = ganesh_surface_->canvas();
66 canvas->drawPicture(picture); 69 canvas->drawPicture(picture);
67 canvas->flush(); 70 canvas->flush();
68 } 71 }
69 72
70 void Rasterizer::OnOutputSurfaceDestroyed() { 73 void Rasterizer::OnOutputSurfaceDestroyed() {
(...skipping 16 matching lines...) Expand all
87 90
88 void Rasterizer::EnsureGaneshSurface(intptr_t window_fbo, 91 void Rasterizer::EnsureGaneshSurface(intptr_t window_fbo,
89 const gfx::Size& size) { 92 const gfx::Size& size) {
90 if (!ganesh_surface_ || ganesh_surface_->size() != size) 93 if (!ganesh_surface_ || ganesh_surface_->size() != size)
91 ganesh_surface_.reset( 94 ganesh_surface_.reset(
92 new GaneshSurface(window_fbo, ganesh_context_.get(), size)); 95 new GaneshSurface(window_fbo, ganesh_context_.get(), size));
93 } 96 }
94 97
95 } // namespace shell 98 } // namespace shell
96 } // namespace sky 99 } // namespace sky
OLDNEW
« no previous file with comments | « sky/shell/gpu/picture_serializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698