OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkCoreBlitters.h" | 8 #include "SkCoreBlitters.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 fColor = color; | 46 fColor = color; |
47 | 47 |
48 fSrcA = SkColorGetA(color); | 48 fSrcA = SkColorGetA(color); |
49 unsigned scale = SkAlpha255To256(fSrcA); | 49 unsigned scale = SkAlpha255To256(fSrcA); |
50 fSrcR = SkAlphaMul(SkColorGetR(color), scale); | 50 fSrcR = SkAlphaMul(SkColorGetR(color), scale); |
51 fSrcG = SkAlphaMul(SkColorGetG(color), scale); | 51 fSrcG = SkAlphaMul(SkColorGetG(color), scale); |
52 fSrcB = SkAlphaMul(SkColorGetB(color), scale); | 52 fSrcB = SkAlphaMul(SkColorGetB(color), scale); |
53 | 53 |
54 fPMColor = SkPackARGB32(fSrcA, fSrcR, fSrcG, fSrcB); | 54 fPMColor = SkPackARGB32(fSrcA, fSrcR, fSrcG, fSrcB); |
55 fColor32Proc = SkBlitRow::ColorProcFactory(); | 55 fColor32Proc = SkBlitRow::ColorProcFactory(); |
56 fColorRect32Proc = SkBlitRow::ColorRectProcFactory(); | |
57 } | 56 } |
58 | 57 |
59 const SkBitmap* SkARGB32_Blitter::justAnOpaqueColor(uint32_t* value) { | 58 const SkBitmap* SkARGB32_Blitter::justAnOpaqueColor(uint32_t* value) { |
60 if (255 == fSrcA) { | 59 if (255 == fSrcA) { |
61 *value = fPMColor; | 60 *value = fPMColor; |
62 return &fDevice; | 61 return &fDevice; |
63 } | 62 } |
64 return NULL; | 63 return NULL; |
65 } | 64 } |
66 | 65 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width() && y + height <= f
Device.height()); | 206 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width() && y + height <= f
Device.height()); |
208 | 207 |
209 if (fSrcA == 0) { | 208 if (fSrcA == 0) { |
210 return; | 209 return; |
211 } | 210 } |
212 | 211 |
213 uint32_t* device = fDevice.getAddr32(x, y); | 212 uint32_t* device = fDevice.getAddr32(x, y); |
214 uint32_t color = fPMColor; | 213 uint32_t color = fPMColor; |
215 size_t rowBytes = fDevice.rowBytes(); | 214 size_t rowBytes = fDevice.rowBytes(); |
216 | 215 |
217 if (255 == SkGetPackedA32(color)) { | 216 while (--height >= 0) { |
218 fColorRect32Proc(device, width, height, rowBytes, color); | 217 fColor32Proc(device, device, width, color); |
219 } else { | 218 device = (uint32_t*)((char*)device + rowBytes); |
220 while (--height >= 0) { | |
221 fColor32Proc(device, device, width, color); | |
222 device = (uint32_t*)((char*)device + rowBytes); | |
223 } | |
224 } | 219 } |
225 } | 220 } |
226 | 221 |
227 #if defined _WIN32 && _MSC_VER >= 1300 | 222 #if defined _WIN32 && _MSC_VER >= 1300 |
228 #pragma warning ( pop ) | 223 #pragma warning ( pop ) |
229 #endif | 224 #endif |
230 | 225 |
231 /////////////////////////////////////////////////////////////////////// | 226 /////////////////////////////////////////////////////////////////////// |
232 | 227 |
233 void SkARGB32_Black_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 228 void SkARGB32_Black_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; | 626 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; |
632 do { | 627 do { |
633 shaderContext->shadeSpan(x, y, span, 1); | 628 shaderContext->shadeSpan(x, y, span, 1); |
634 proc(device, span, 1, alpha); | 629 proc(device, span, 1, alpha); |
635 y += 1; | 630 y += 1; |
636 device = (uint32_t*)((char*)device + deviceRB); | 631 device = (uint32_t*)((char*)device + deviceRB); |
637 } while (--height > 0); | 632 } while (--height > 0); |
638 } | 633 } |
639 } | 634 } |
640 } | 635 } |
OLD | NEW |