OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkBenchmark.h" | 7 #include "Benchmark.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
12 #include "SkPictureRecorder.h" | 12 #include "SkPictureRecorder.h" |
13 #include "SkPoint.h" | 13 #include "SkPoint.h" |
14 #include "SkRandom.h" | 14 #include "SkRandom.h" |
15 #include "SkRect.h" | 15 #include "SkRect.h" |
16 #include "SkString.h" | 16 #include "SkString.h" |
17 | 17 |
18 class PictureRecordBench : public SkBenchmark { | 18 class PictureRecordBench : public Benchmark { |
19 public: | 19 public: |
20 PictureRecordBench(const char name[]) { | 20 PictureRecordBench(const char name[]) { |
21 fName.printf("picture_record_%s", name); | 21 fName.printf("picture_record_%s", name); |
22 } | 22 } |
23 | 23 |
24 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 24 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { |
25 return backend == kNonRendering_Backend; | 25 return backend == kNonRendering_Backend; |
26 } | 26 } |
27 | 27 |
28 enum { | 28 enum { |
29 PICTURE_WIDTH = 1000, | 29 PICTURE_WIDTH = 1000, |
30 PICTURE_HEIGHT = 4000, | 30 PICTURE_HEIGHT = 4000, |
31 }; | 31 }; |
32 protected: | 32 protected: |
33 virtual const char* onGetName() SK_OVERRIDE { | 33 virtual const char* onGetName() SK_OVERRIDE { |
34 return fName.c_str(); | 34 return fName.c_str(); |
35 } | 35 } |
36 private: | 36 private: |
37 SkString fName; | 37 SkString fName; |
38 typedef SkBenchmark INHERITED; | 38 typedef Benchmark INHERITED; |
39 }; | 39 }; |
40 | 40 |
41 | 41 |
42 static const int kMaxLoopsPerCanvas = 10000; | 42 static const int kMaxLoopsPerCanvas = 10000; |
43 | 43 |
44 /* | 44 /* |
45 * An SkPicture has internal dictionaries to store bitmaps, matrices, paints, | 45 * An SkPicture has internal dictionaries to store bitmaps, matrices, paints, |
46 * and regions. This bench populates those dictionaries to test the speed of | 46 * and regions. This bench populates those dictionaries to test the speed of |
47 * reading and writing to those particular dictionary data structures. | 47 * reading and writing to those particular dictionary data structures. |
48 */ | 48 */ |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 private: | 169 private: |
170 SkPaint fPaint [ObjCount]; | 170 SkPaint fPaint [ObjCount]; |
171 typedef PictureRecordBench INHERITED; | 171 typedef PictureRecordBench INHERITED; |
172 }; | 172 }; |
173 | 173 |
174 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
175 | 175 |
176 DEF_BENCH( return new DictionaryRecordBench(); ) | 176 DEF_BENCH( return new DictionaryRecordBench(); ) |
177 DEF_BENCH( return new UniquePaintDictionaryRecordBench(); ) | 177 DEF_BENCH( return new UniquePaintDictionaryRecordBench(); ) |
178 DEF_BENCH( return new RecurringPaintDictionaryRecordBench(); ) | 178 DEF_BENCH( return new RecurringPaintDictionaryRecordBench(); ) |
OLD | NEW |