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 "SkDraw.h" | 8 #include "SkDraw.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "SkBounder.h" | 10 #include "SkBounder.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 return D_Clear_BitmapXferProc; // ignore data | 181 return D_Clear_BitmapXferProc; // ignore data |
182 case SkXfermode::kDst_Mode: | 182 case SkXfermode::kDst_Mode: |
183 // SkDebugf("--- D_Dst_BitmapXferProc\n"); | 183 // SkDebugf("--- D_Dst_BitmapXferProc\n"); |
184 return D_Dst_BitmapXferProc; // ignore data | 184 return D_Dst_BitmapXferProc; // ignore data |
185 case SkXfermode::kSrc_Mode: { | 185 case SkXfermode::kSrc_Mode: { |
186 /* | 186 /* |
187 should I worry about dithering for the lower depths? | 187 should I worry about dithering for the lower depths? |
188 */ | 188 */ |
189 SkPMColor pmc = SkPreMultiplyColor(color); | 189 SkPMColor pmc = SkPreMultiplyColor(color); |
190 switch (bitmap.colorType()) { | 190 switch (bitmap.colorType()) { |
191 case kPMColor_SkColorType: | 191 case kN32_SkColorType: |
192 if (data) { | 192 if (data) { |
193 *data = pmc; | 193 *data = pmc; |
194 } | 194 } |
195 // SkDebugf("--- D32_Src_BitmapXferProc\n"); | 195 // SkDebugf("--- D32_Src_BitmapXferProc\n"); |
196 return D32_Src_BitmapXferProc; | 196 return D32_Src_BitmapXferProc; |
197 case kRGB_565_SkColorType: | 197 case kRGB_565_SkColorType: |
198 if (data) { | 198 if (data) { |
199 *data = SkPixel32ToPixel16(pmc); | 199 *data = SkPixel32ToPixel16(pmc); |
200 } | 200 } |
201 // SkDebugf("--- D16_Src_BitmapXferProc\n"); | 201 // SkDebugf("--- D16_Src_BitmapXferProc\n"); |
(...skipping 12 matching lines...) Expand all Loading... |
214 default: | 214 default: |
215 break; | 215 break; |
216 } | 216 } |
217 return NULL; | 217 return NULL; |
218 } | 218 } |
219 | 219 |
220 static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect, | 220 static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect, |
221 BitmapXferProc proc, uint32_t procData) { | 221 BitmapXferProc proc, uint32_t procData) { |
222 int shiftPerPixel; | 222 int shiftPerPixel; |
223 switch (bitmap.colorType()) { | 223 switch (bitmap.colorType()) { |
224 case kPMColor_SkColorType: | 224 case kN32_SkColorType: |
225 shiftPerPixel = 2; | 225 shiftPerPixel = 2; |
226 break; | 226 break; |
227 case kRGB_565_SkColorType: | 227 case kRGB_565_SkColorType: |
228 shiftPerPixel = 1; | 228 shiftPerPixel = 1; |
229 break; | 229 break; |
230 case kAlpha_8_SkColorType: | 230 case kAlpha_8_SkColorType: |
231 shiftPerPixel = 0; | 231 shiftPerPixel = 0; |
232 break; | 232 break; |
233 default: | 233 default: |
234 SkDEBUGFAIL("Can't use xferproc on this config"); | 234 SkDEBUGFAIL("Can't use xferproc on this config"); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 SkASSERT(SkCanvas::kPoints_PointMode == fMode); | 508 SkASSERT(SkCanvas::kPoints_PointMode == fMode); |
509 proc = aa_square_proc; | 509 proc = aa_square_proc; |
510 } | 510 } |
511 } else { // BW | 511 } else { // BW |
512 if (fRadius <= SK_FixedHalf) { // small radii and hairline | 512 if (fRadius <= SK_FixedHalf) { // small radii and hairline |
513 if (SkCanvas::kPoints_PointMode == fMode && fClip->isRect()) { | 513 if (SkCanvas::kPoints_PointMode == fMode && fClip->isRect()) { |
514 uint32_t value; | 514 uint32_t value; |
515 const SkBitmap* bm = blitter->justAnOpaqueColor(&value); | 515 const SkBitmap* bm = blitter->justAnOpaqueColor(&value); |
516 if (bm && kRGB_565_SkColorType == bm->colorType()) { | 516 if (bm && kRGB_565_SkColorType == bm->colorType()) { |
517 proc = bw_pt_rect_16_hair_proc; | 517 proc = bw_pt_rect_16_hair_proc; |
518 } else if (bm && kPMColor_SkColorType == bm->colorType()) { | 518 } else if (bm && kN32_SkColorType == bm->colorType()) { |
519 proc = bw_pt_rect_32_hair_proc; | 519 proc = bw_pt_rect_32_hair_proc; |
520 } else { | 520 } else { |
521 proc = bw_pt_rect_hair_proc; | 521 proc = bw_pt_rect_hair_proc; |
522 } | 522 } |
523 } else { | 523 } else { |
524 static Proc gBWProcs[] = { | 524 static Proc gBWProcs[] = { |
525 bw_pt_hair_proc, bw_line_hair_proc, bw_poly_hair_proc | 525 bw_pt_hair_proc, bw_line_hair_proc, bw_poly_hair_proc |
526 }; | 526 }; |
527 proc = gBWProcs[fMode]; | 527 proc = gBWProcs[fMode]; |
528 } | 528 } |
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 mask->fImage = SkMask::AllocImage(size); | 2801 mask->fImage = SkMask::AllocImage(size); |
2802 memset(mask->fImage, 0, mask->computeImageSize()); | 2802 memset(mask->fImage, 0, mask->computeImageSize()); |
2803 } | 2803 } |
2804 | 2804 |
2805 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2805 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2806 draw_into_mask(*mask, devPath, style); | 2806 draw_into_mask(*mask, devPath, style); |
2807 } | 2807 } |
2808 | 2808 |
2809 return true; | 2809 return true; |
2810 } | 2810 } |
OLD | NEW |