| 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 "SkBenchmark.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 "SkPoint.h" | 12 #include "SkPoint.h" |
| 13 #include "SkRandom.h" | 13 #include "SkRandom.h" |
| 14 #include "SkRect.h" | 14 #include "SkRect.h" |
| 15 #include "SkString.h" | 15 #include "SkString.h" |
| 16 | 16 |
| 17 class PictureRecordBench : public SkBenchmark { | 17 class PictureRecordBench : public SkBenchmark { |
| 18 public: | 18 public: |
| 19 PictureRecordBench(void* param, const char name[]) : INHERITED(param) { | 19 PictureRecordBench(void* param, const char name[]) : INHERITED(param) { |
| 20 fName.printf("picture_record_%s", name); | 20 fName.printf("picture_record_%s", name); |
| 21 fPictureWidth = SkIntToScalar(PICTURE_WIDTH); | 21 fPictureWidth = SkIntToScalar(PICTURE_WIDTH); |
| 22 fPictureHeight = SkIntToScalar(PICTURE_HEIGHT); | 22 fPictureHeight = SkIntToScalar(PICTURE_HEIGHT); |
| 23 fIsRendering = false; |
| 23 } | 24 } |
| 24 | 25 |
| 25 enum { | 26 enum { |
| 26 N = SkBENCHLOOP(25), // number of times to create the picture | 27 N = SkBENCHLOOP(25), // number of times to create the picture |
| 27 PICTURE_WIDTH = 1000, | 28 PICTURE_WIDTH = 1000, |
| 28 PICTURE_HEIGHT = 4000, | 29 PICTURE_HEIGHT = 4000, |
| 29 }; | 30 }; |
| 30 protected: | 31 protected: |
| 31 virtual const char* onGetName() { | 32 virtual const char* onGetName() { |
| 32 return fName.c_str(); | 33 return fName.c_str(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 185 |
| 185 /////////////////////////////////////////////////////////////////////////////// | 186 /////////////////////////////////////////////////////////////////////////////// |
| 186 | 187 |
| 187 static SkBenchmark* Fact0(void* p) { return new DictionaryRecordBench(p); } | 188 static SkBenchmark* Fact0(void* p) { return new DictionaryRecordBench(p); } |
| 188 static SkBenchmark* Fact1(void* p) { return new UniquePaintDictionaryRecordBench
(p); } | 189 static SkBenchmark* Fact1(void* p) { return new UniquePaintDictionaryRecordBench
(p); } |
| 189 static SkBenchmark* Fact2(void* p) { return new RecurringPaintDictionaryRecordBe
nch(p); } | 190 static SkBenchmark* Fact2(void* p) { return new RecurringPaintDictionaryRecordBe
nch(p); } |
| 190 | 191 |
| 191 static BenchRegistry gReg0(Fact0); | 192 static BenchRegistry gReg0(Fact0); |
| 192 static BenchRegistry gReg1(Fact1); | 193 static BenchRegistry gReg1(Fact1); |
| 193 static BenchRegistry gReg2(Fact2); | 194 static BenchRegistry gReg2(Fact2); |
| OLD | NEW |