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

Side by Side Diff: skia/ext/benchmarking_canvas.cc

Issue 315963003: Switch Chromium to new Skia SkCanvas::drawPicture method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address code review comment (fix benchmasking_canvas override) Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/skpicture_content_layer_updater.cc ('k') | skia/ext/pixel_ref_utils.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "skia/ext/benchmarking_canvas.h" 8 #include "skia/ext/benchmarking_canvas.h"
9 #include "third_party/skia/include/utils/SkProxyCanvas.h" 9 #include "third_party/skia/include/utils/SkProxyCanvas.h"
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 AutoStamper stamper(this); 107 AutoStamper stamper(this);
108 SkProxyCanvas::drawBitmapMatrix(bitmap, m, paint); 108 SkProxyCanvas::drawBitmapMatrix(bitmap, m, paint);
109 } 109 }
110 110
111 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, 111 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
112 const SkPaint* paint = NULL) OVERRIDE { 112 const SkPaint* paint = NULL) OVERRIDE {
113 AutoStamper stamper(this); 113 AutoStamper stamper(this);
114 SkProxyCanvas::drawSprite(bitmap, left, top, paint); 114 SkProxyCanvas::drawSprite(bitmap, left, top, paint);
115 } 115 }
116 116
117 virtual void drawPicture(SkPicture& picture) OVERRIDE {
118 AutoStamper stamper(this);
119 SkProxyCanvas::drawPicture(picture);
120 }
121
122 virtual void drawVertices(VertexMode vmode, int vertexCount, 117 virtual void drawVertices(VertexMode vmode, int vertexCount,
123 const SkPoint vertices[], const SkPoint texs[], 118 const SkPoint vertices[], const SkPoint texs[],
124 const SkColor colors[], SkXfermode* xmode, 119 const SkColor colors[], SkXfermode* xmode,
125 const uint16_t indices[], int indexCount, 120 const uint16_t indices[], int indexCount,
126 const SkPaint& paint) OVERRIDE { 121 const SkPaint& paint) OVERRIDE {
127 AutoStamper stamper(this); 122 AutoStamper stamper(this);
128 SkProxyCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors, 123 SkProxyCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors,
129 xmode, indices, indexCount, paint); 124 xmode, indices, indexCount, paint);
130 } 125 }
131 126
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 AutoStamper stamper(this); 174 AutoStamper stamper(this);
180 SkProxyCanvas::onClipPath(path, op, edge_style); 175 SkProxyCanvas::onClipPath(path, op, edge_style);
181 } 176 }
182 177
183 virtual void onClipRegion(const SkRegion& region, 178 virtual void onClipRegion(const SkRegion& region,
184 SkRegion::Op op) OVERRIDE { 179 SkRegion::Op op) OVERRIDE {
185 AutoStamper stamper(this); 180 AutoStamper stamper(this);
186 SkProxyCanvas::onClipRegion(region, op); 181 SkProxyCanvas::onClipRegion(region, op);
187 } 182 }
188 183
184 virtual void onDrawPicture(const SkPicture* picture) OVERRIDE {
185 AutoStamper stamper(this);
186 SkProxyCanvas::onDrawPicture(picture);
187 }
188
189 private: 189 private:
190 typedef base::hash_map<size_t, base::TimeDelta> TimingsMap; 190 typedef base::hash_map<size_t, base::TimeDelta> TimingsMap;
191 TimingsMap timings_map_; 191 TimingsMap timings_map_;
192 192
193 skia::RefPtr<SkCanvas> canvas_; 193 skia::RefPtr<SkCanvas> canvas_;
194 194
195 friend class AutoStamper; 195 friend class AutoStamper;
196 const BenchmarkingCanvas* tracking_canvas_; 196 const BenchmarkingCanvas* tracking_canvas_;
197 }; 197 };
198 198
(...skipping 30 matching lines...) Expand all
229 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 229 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
230 return debug_canvas_->getDrawCommandAt(index); 230 return debug_canvas_->getDrawCommandAt(index);
231 } 231 }
232 232
233 double BenchmarkingCanvas::GetTime(size_t index) { 233 double BenchmarkingCanvas::GetTime(size_t index) {
234 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 234 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
235 return timing_canvas_->GetTime(index); 235 return timing_canvas_->GetTime(index);
236 } 236 }
237 237
238 } // namespace skia 238 } // namespace skia
OLDNEW
« no previous file with comments | « cc/resources/skpicture_content_layer_updater.cc ('k') | skia/ext/pixel_ref_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698