OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 class BitmapRectBench : public SkBenchmark { | 41 class BitmapRectBench : public SkBenchmark { |
42 SkBitmap fBitmap; | 42 SkBitmap fBitmap; |
43 bool fDoFilter; | 43 bool fDoFilter; |
44 bool fSlightMatrix; | 44 bool fSlightMatrix; |
45 uint8_t fAlpha; | 45 uint8_t fAlpha; |
46 SkString fName; | 46 SkString fName; |
47 SkRect fSrcR, fDstR; | 47 SkRect fSrcR, fDstR; |
48 static const int kWidth = 128; | 48 static const int kWidth = 128; |
49 static const int kHeight = 128; | 49 static const int kHeight = 128; |
50 public: | 50 public: |
51 BitmapRectBench(void* param, U8CPU alpha, bool doFilter, bool slightMatrix)
: INHERITED(param) { | 51 BitmapRectBench(U8CPU alpha, bool doFilter, bool slightMatrix) { |
52 fAlpha = SkToU8(alpha); | 52 fAlpha = SkToU8(alpha); |
53 fDoFilter = doFilter; | 53 fDoFilter = doFilter; |
54 fSlightMatrix = slightMatrix; | 54 fSlightMatrix = slightMatrix; |
55 | 55 |
56 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, kWidth, kHeight); | 56 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, kWidth, kHeight); |
57 } | 57 } |
58 | 58 |
59 protected: | 59 protected: |
60 virtual const char* onGetName() SK_OVERRIDE { | 60 virtual const char* onGetName() SK_OVERRIDE { |
61 fName.printf("bitmaprect_%02X_%sfilter_%s", | 61 fName.printf("bitmaprect_%02X_%sfilter_%s", |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 for (int i = 0; i < this->getLoops(); i++) { | 95 for (int i = 0; i < this->getLoops(); i++) { |
96 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint); | 96 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 typedef SkBenchmark INHERITED; | 101 typedef SkBenchmark INHERITED; |
102 }; | 102 }; |
103 | 103 |
104 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, false)) | 104 DEF_BENCH(return new BitmapRectBench(0xFF, false, false)) |
105 DEF_BENCH(return new BitmapRectBench(p, 0x80, false, false)) | 105 DEF_BENCH(return new BitmapRectBench(0x80, false, false)) |
106 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, false)) | 106 DEF_BENCH(return new BitmapRectBench(0xFF, true, false)) |
107 DEF_BENCH(return new BitmapRectBench(p, 0x80, true, false)) | 107 DEF_BENCH(return new BitmapRectBench(0x80, true, false)) |
108 | 108 |
109 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, true)) | 109 DEF_BENCH(return new BitmapRectBench(0xFF, false, true)) |
110 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, true)) | 110 DEF_BENCH(return new BitmapRectBench(0xFF, true, true)) |
OLD | NEW |