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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 SkASSERT(fSrcA != 0xFF); | 167 SkASSERT(fSrcA != 0xFF); |
168 | 168 |
169 if (fSrcA == 0) { | 169 if (fSrcA == 0) { |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 if (SkBlitMask::BlitColor(fDevice, mask, clip, fColor)) { | 173 if (SkBlitMask::BlitColor(fDevice, mask, clip, fColor)) { |
174 return; | 174 return; |
175 } | 175 } |
176 | 176 |
177 if (mask.fFormat == SkMask::kBW_Format) { | 177 switch (mask.fFormat) { |
178 SkARGB32_BlendBW(fDevice, mask, clip, fPMColor, SkAlpha255To256(255 - fS
rcA)); | 178 case SkMask::kBW_Format: |
179 } else if (SkMask::kARGB32_Format == mask.fFormat) { | 179 SkARGB32_BlendBW(fDevice, mask, clip, fPMColor, SkAlpha255To256(255
- fSrcA)); |
180 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); | 180 break; |
| 181 case SkMask::kARGB32_Format: |
| 182 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); |
| 183 break; |
| 184 default: |
| 185 SkFAIL("Mask format not handled."); |
181 } | 186 } |
182 } | 187 } |
183 | 188 |
184 void SkARGB32_Opaque_Blitter::blitMask(const SkMask& mask, | 189 void SkARGB32_Opaque_Blitter::blitMask(const SkMask& mask, |
185 const SkIRect& clip) { | 190 const SkIRect& clip) { |
186 SkASSERT(mask.fBounds.contains(clip)); | 191 SkASSERT(mask.fBounds.contains(clip)); |
187 | 192 |
188 if (SkBlitMask::BlitColor(fDevice, mask, clip, fColor)) { | 193 if (SkBlitMask::BlitColor(fDevice, mask, clip, fColor)) { |
189 return; | 194 return; |
190 } | 195 } |
191 | 196 |
192 if (mask.fFormat == SkMask::kBW_Format) { | 197 switch (mask.fFormat) { |
193 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); | 198 case SkMask::kBW_Format: |
194 } else if (SkMask::kARGB32_Format == mask.fFormat) { | 199 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); |
195 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); | 200 break; |
| 201 case SkMask::kARGB32_Format: |
| 202 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); |
| 203 break; |
| 204 default: |
| 205 SkFAIL("Mask format not handled."); |
196 } | 206 } |
197 } | 207 } |
198 | 208 |
199 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { | 209 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { |
200 uint32_t* device = fDevice.writable_addr32(x, y); | 210 uint32_t* device = fDevice.writable_addr32(x, y); |
201 SkDEBUGCODE((void)fDevice.writable_addr32(x + 1, y);) | 211 SkDEBUGCODE((void)fDevice.writable_addr32(x + 1, y);) |
202 | 212 |
203 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); | 213 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); |
204 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1); | 214 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1); |
205 } | 215 } |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; | 686 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; |
677 do { | 687 do { |
678 shaderContext->shadeSpan(x, y, span, 1); | 688 shaderContext->shadeSpan(x, y, span, 1); |
679 proc(device, span, 1, alpha); | 689 proc(device, span, 1, alpha); |
680 y += 1; | 690 y += 1; |
681 device = (uint32_t*)((char*)device + deviceRB); | 691 device = (uint32_t*)((char*)device + deviceRB); |
682 } while (--height > 0); | 692 } while (--height > 0); |
683 } | 693 } |
684 } | 694 } |
685 } | 695 } |
OLD | NEW |