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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 int gg = conv_6_to_byte(g); | 59 int gg = conv_6_to_byte(g); |
60 for (int b = 0; b < 6; b++) { | 60 for (int b = 0; b < 6; b++) { |
61 int bb = conv_6_to_byte(b); | 61 int bb = conv_6_to_byte(b); |
62 *colors++ = SkPreMultiplyARGB(0xFF, rr, gg, bb); | 62 *colors++ = SkPreMultiplyARGB(0xFF, rr, gg, bb); |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 SkColorTable* ctable = new SkColorTable(storage, 216); | 66 SkColorTable* ctable = new SkColorTable(storage, 216); |
67 dst->allocPixels(SkImageInfo::Make(src.width(), src.height(), | 67 dst->allocPixels(SkImageInfo::Make(src.width(), src.height(), |
68 kIndex_8_SkColorType, kOpaque_SkAlphaType
), | 68 kIndex_8_SkColorType, kOpaque_SkAlphaType
), |
69 NULL, ctable); | 69 nullptr, ctable); |
70 ctable->unref(); | 70 ctable->unref(); |
71 | 71 |
72 SkAutoLockPixels alps(src); | 72 SkAutoLockPixels alps(src); |
73 SkAutoLockPixels alpd(*dst); | 73 SkAutoLockPixels alpd(*dst); |
74 | 74 |
75 for (int y = 0; y < src.height(); y++) { | 75 for (int y = 0; y < src.height(); y++) { |
76 const SkPMColor* srcP = src.getAddr32(0, y); | 76 const SkPMColor* srcP = src.getAddr32(0, y); |
77 uint8_t* dstP = dst->getAddr8(0, y); | 77 uint8_t* dstP = dst->getAddr8(0, y); |
78 for (int x = src.width() - 1; x >= 0; --x) { | 78 for (int x = src.width() - 1; x >= 0; --x) { |
79 *dstP++ = compute_666_index(*srcP++); | 79 *dstP++ = compute_666_index(*srcP++); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 typedef Benchmark INHERITED; | 140 typedef Benchmark INHERITED; |
141 }; | 141 }; |
142 | 142 |
143 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kOpaque_SkAlphaType)) | 143 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kOpaque_SkAlphaType)) |
144 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kPremul_SkAlphaType)) | 144 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kPremul_SkAlphaType)) |
145 DEF_BENCH(return new RepeatTileBench(kRGB_565_SkColorType, kOpaque_SkAlphaType)) | 145 DEF_BENCH(return new RepeatTileBench(kRGB_565_SkColorType, kOpaque_SkAlphaType)) |
146 DEF_BENCH(return new RepeatTileBench(kIndex_8_SkColorType, kPremul_SkAlphaType)) | 146 DEF_BENCH(return new RepeatTileBench(kIndex_8_SkColorType, kPremul_SkAlphaType)) |
OLD | NEW |