Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/core/SkBlitter_ARGB32.cpp

Issue 2054213002: Add documention on SkBlitter for runs, and small cleanups. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #include "SkBlitBWMaskTemplate.h" 163 #include "SkBlitBWMaskTemplate.h"
164 164
165 void SkARGB32_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) { 165 void SkARGB32_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
166 SkASSERT(mask.fBounds.contains(clip)); 166 SkASSERT(mask.fBounds.contains(clip));
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 switch (mask.fFormat) {
174 return; 174 case SkMask::kBW_Format:
175 } 175 SkARGB32_BlendBW(fDevice, mask, clip, fPMColor, SkAlpha255To256(255 - fSrcA));
176 176 break;
177 if (mask.fFormat == SkMask::kBW_Format) { 177 case SkMask::kARGB32_Format:
178 SkARGB32_BlendBW(fDevice, mask, clip, fPMColor, SkAlpha255To256(255 - fS rcA)); 178 SkARGB32_Blit32(fDevice, mask, clip, fPMColor);
179 } else if (SkMask::kARGB32_Format == mask.fFormat) { 179 break;
180 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); 180 default:
181 // If this asserts then the mask case was not handled.
182 SkASSERT(SkBlitMask::BlitColor(fDevice, mask, clip, fColor));
reed1 2016/06/10 20:40:45 SkASSERT_ALWAYS?
herb_g 2016/06/10 20:56:48 Done.
181 } 183 }
182 } 184 }
183 185
184 void SkARGB32_Opaque_Blitter::blitMask(const SkMask& mask, 186 void SkARGB32_Opaque_Blitter::blitMask(const SkMask& mask,
185 const SkIRect& clip) { 187 const SkIRect& clip) {
186 SkASSERT(mask.fBounds.contains(clip)); 188 SkASSERT(mask.fBounds.contains(clip));
187 189
188 if (SkBlitMask::BlitColor(fDevice, mask, clip, fColor)) { 190 switch (mask.fFormat) {
189 return; 191 case SkMask::kBW_Format:
190 } 192 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor);
191 193 break;
192 if (mask.fFormat == SkMask::kBW_Format) { 194 case SkMask::kARGB32_Format:
193 SkARGB32_BlitBW(fDevice, mask, clip, fPMColor); 195 SkARGB32_Blit32(fDevice, mask, clip, fPMColor);
194 } else if (SkMask::kARGB32_Format == mask.fFormat) { 196 break;
195 SkARGB32_Blit32(fDevice, mask, clip, fPMColor); 197 default:
198 // If this asserts then the mask case was not handled.
199 SkASSERT(SkBlitMask::BlitColor(fDevice, mask, clip, fColor));
196 } 200 }
197 } 201 }
198 202
199 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { 203 void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
200 uint32_t* device = fDevice.writable_addr32(x, y); 204 uint32_t* device = fDevice.writable_addr32(x, y);
201 SkDEBUGCODE((void)fDevice.writable_addr32(x + 1, y);) 205 SkDEBUGCODE((void)fDevice.writable_addr32(x + 1, y);)
202 206
203 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0); 207 device[0] = SkFastFourByteInterp(fPMColor, device[0], a0);
204 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1); 208 device[1] = SkFastFourByteInterp(fPMColor, device[1], a1);
205 } 209 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; 680 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
677 do { 681 do {
678 shaderContext->shadeSpan(x, y, span, 1); 682 shaderContext->shadeSpan(x, y, span, 1);
679 proc(device, span, 1, alpha); 683 proc(device, span, 1, alpha);
680 y += 1; 684 y += 1;
681 device = (uint32_t*)((char*)device + deviceRB); 685 device = (uint32_t*)((char*)device + deviceRB);
682 } while (--height > 0); 686 } while (--height > 0);
683 } 687 }
684 } 688 }
685 } 689 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698