OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 7 |
8 #include "SkBenchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkString.h" | 10 #include "SkString.h" |
11 | 11 |
12 class WritePixelsBench : public SkBenchmark { | 12 class WritePixelsBench : public Benchmark { |
13 public: | 13 public: |
14 WritePixelsBench(SkColorType ct, SkAlphaType at) | 14 WritePixelsBench(SkColorType ct, SkAlphaType at) |
15 : fColorType(ct) | 15 : fColorType(ct) |
16 , fAlphaType(at) | 16 , fAlphaType(at) |
17 , fName("writepix") | 17 , fName("writepix") |
18 { | 18 { |
19 switch (ct) { | 19 switch (ct) { |
20 case kRGBA_8888_SkColorType: | 20 case kRGBA_8888_SkColorType: |
21 fName.append("_RGBA"); | 21 fName.append("_RGBA"); |
22 break; | 22 break; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 for (int loop = 0; loop < loops; ++loop) { | 61 for (int loop = 0; loop < loops; ++loop) { |
62 canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0); | 62 canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 SkColorType fColorType; | 67 SkColorType fColorType; |
68 SkAlphaType fAlphaType; | 68 SkAlphaType fAlphaType; |
69 SkString fName; | 69 SkString fName; |
70 | 70 |
71 typedef SkBenchmark INHERITED; | 71 typedef Benchmark INHERITED; |
72 }; | 72 }; |
73 | 73 |
74 ////////////////////////////////////////////////////////////////////////////// | 74 ////////////////////////////////////////////////////////////////////////////// |
75 | 75 |
76 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kPremul_
SkAlphaType)); ) | 76 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kPremul_
SkAlphaType)); ) |
77 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kUnpremu
l_SkAlphaType)); ) | 77 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kUnpremu
l_SkAlphaType)); ) |
OLD | NEW |