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

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

Issue 183003011: Revert 254567 "don't create SkDevice directly, use SkBitmap or (..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
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/core/SkBitmapDevice.h"
9 #include "third_party/skia/include/utils/SkProxyCanvas.h" 10 #include "third_party/skia/include/utils/SkProxyCanvas.h"
10 11
11 namespace skia { 12 namespace skia {
12 13
13 class AutoStamper { 14 class AutoStamper {
14 public: 15 public:
15 AutoStamper(TimingCanvas* timing_canvas); 16 AutoStamper(TimingCanvas* timing_canvas);
16 ~AutoStamper(); 17 ~AutoStamper();
17 18
18 private: 19 private:
19 TimingCanvas* timing_canvas_; 20 TimingCanvas* timing_canvas_;
20 base::TimeTicks start_ticks_; 21 base::TimeTicks start_ticks_;
21 }; 22 };
22 23
23 class TimingCanvas : public SkProxyCanvas { 24 class TimingCanvas : public SkProxyCanvas {
24 public: 25 public:
25 TimingCanvas(int width, int height, const BenchmarkingCanvas* track_canvas) 26 TimingCanvas(int width, int height, const BenchmarkingCanvas* track_canvas)
26 : tracking_canvas_(track_canvas) { 27 : tracking_canvas_(track_canvas) {
27 canvas_ = skia::AdoptRef(SkCanvas::NewRasterN32(width, height)); 28 skia::RefPtr<SkBaseDevice> device = skia::AdoptRef(
29 SkNEW_ARGS(SkBitmapDevice, (SkBitmap::kARGB_8888_Config, width, height)) );
30 canvas_ = skia::AdoptRef(SkNEW_ARGS(SkCanvas, (device.get())));
28 31
29 setProxy(canvas_.get()); 32 setProxy(canvas_.get());
30 } 33 }
31 34
32 virtual ~TimingCanvas() { 35 virtual ~TimingCanvas() {
33 } 36 }
34 37
35 double GetTime(size_t index) { 38 double GetTime(size_t index) {
36 TimingsMap::const_iterator timing_info = timings_map_.find(index); 39 TimingsMap::const_iterator timing_info = timings_map_.find(index);
37 return timing_info != timings_map_.end() 40 return timing_info != timings_map_.end()
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 230 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
228 return debug_canvas_->getDrawCommandAt(index); 231 return debug_canvas_->getDrawCommandAt(index);
229 } 232 }
230 233
231 double BenchmarkingCanvas::GetTime(size_t index) { 234 double BenchmarkingCanvas::GetTime(size_t index) {
232 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 235 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
233 return timing_canvas_->GetTime(index); 236 return timing_canvas_->GetTime(index);
234 } 237 }
235 238
236 } // namespace skia 239 } // namespace skia
OLDNEW
« no previous file with comments | « trunk/src/media/filters/skcanvas_video_renderer_unittest.cc ('k') | trunk/src/skia/tools/filter_fuzz_stub/filter_fuzz_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698