OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 static int proc_bad(const void*, int, uint32_t, uint32_t* bad) { | 58 static int proc_bad(const void*, int, uint32_t, uint32_t* bad) { |
59 *bad = 0; | 59 *bad = 0; |
60 return 0; | 60 return 0; |
61 } | 61 } |
62 | 62 |
63 static Proc find_proc(const SkBitmap& bm, SkPMColor expect32, uint16_t expect16, | 63 static Proc find_proc(const SkBitmap& bm, SkPMColor expect32, uint16_t expect16, |
64 uint8_t expect8, uint32_t* expect) { | 64 uint8_t expect8, uint32_t* expect) { |
65 switch (bm.colorType()) { | 65 switch (bm.colorType()) { |
66 case kN32_SkColorType: | 66 case kPMColor_SkColorType: |
67 *expect = expect32; | 67 *expect = expect32; |
68 return proc_32; | 68 return proc_32; |
69 case kARGB_4444_SkColorType: | 69 case kARGB_4444_SkColorType: |
70 case kRGB_565_SkColorType: | 70 case kRGB_565_SkColorType: |
71 *expect = expect16; | 71 *expect = expect16; |
72 return proc_16; | 72 return proc_16; |
73 case kAlpha_8_SkColorType: | 73 case kAlpha_8_SkColorType: |
74 *expect = expect8; | 74 *expect = expect8; |
75 return proc_8; | 75 return proc_8; |
76 default: | 76 default: |
(...skipping 17 matching lines...) Expand all Loading... |
94 } | 94 } |
95 } | 95 } |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 // Make sure our blits always map src==0 to a noop, and src==FF to full opaque | 99 // Make sure our blits always map src==0 to a noop, and src==FF to full opaque |
100 static void test_00_FF(skiatest::Reporter* reporter) { | 100 static void test_00_FF(skiatest::Reporter* reporter) { |
101 static const int W = 256; | 101 static const int W = 256; |
102 | 102 |
103 static const SkColorType gDstColorType[] = { | 103 static const SkColorType gDstColorType[] = { |
104 kN32_SkColorType, | 104 kPMColor_SkColorType, |
105 kRGB_565_SkColorType, | 105 kRGB_565_SkColorType, |
106 }; | 106 }; |
107 | 107 |
108 static const struct { | 108 static const struct { |
109 SkColor fSrc; | 109 SkColor fSrc; |
110 SkColor fDst; | 110 SkColor fDst; |
111 SkPMColor fResult32; | 111 SkPMColor fResult32; |
112 uint16_t fResult16; | 112 uint16_t fResult16; |
113 uint8_t fResult8; | 113 uint8_t fResult8; |
114 } gSrcRec[] = { | 114 } gSrcRec[] = { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 static bool gOnce; | 186 static bool gOnce; |
187 | 187 |
188 // Make sure our blits are invariant with the width of the blit (i.e. that | 188 // Make sure our blits are invariant with the width of the blit (i.e. that |
189 // special case for 8 at a time have the same results as narrower blits) | 189 // special case for 8 at a time have the same results as narrower blits) |
190 static void test_diagonal(skiatest::Reporter* reporter) { | 190 static void test_diagonal(skiatest::Reporter* reporter) { |
191 static const int W = 64; | 191 static const int W = 64; |
192 static const int H = W; | 192 static const int H = W; |
193 | 193 |
194 static const SkColorType gDstColorType[] = { | 194 static const SkColorType gDstColorType[] = { |
195 kN32_SkColorType, | 195 kPMColor_SkColorType, |
196 kRGB_565_SkColorType, | 196 kRGB_565_SkColorType, |
197 }; | 197 }; |
198 | 198 |
199 static const SkColor gDstBG[] = { 0, 0xFFFFFFFF }; | 199 static const SkColor gDstBG[] = { 0, 0xFFFFFFFF }; |
200 | 200 |
201 SkPaint paint; | 201 SkPaint paint; |
202 | 202 |
203 SkBitmap srcBM; | 203 SkBitmap srcBM; |
204 srcBM.allocN32Pixels(W, H); | 204 srcBM.allocN32Pixels(W, H); |
205 SkRect srcR = { | 205 SkRect srcR = { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 } | 256 } |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 DEF_TEST(BlitRow, reporter) { | 261 DEF_TEST(BlitRow, reporter) { |
262 test_00_FF(reporter); | 262 test_00_FF(reporter); |
263 test_diagonal(reporter); | 263 test_diagonal(reporter); |
264 } | 264 } |
OLD | NEW |