| 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 | 8 |
| 9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 should I worry about dithering for the lower depths? | 215 should I worry about dithering for the lower depths? |
| 216 */ | 216 */ |
| 217 SkPMColor pmc = SkPreMultiplyColor(color); | 217 SkPMColor pmc = SkPreMultiplyColor(color); |
| 218 switch (bitmap.config()) { | 218 switch (bitmap.config()) { |
| 219 case SkBitmap::kARGB_8888_Config: | 219 case SkBitmap::kARGB_8888_Config: |
| 220 if (data) { | 220 if (data) { |
| 221 *data = pmc; | 221 *data = pmc; |
| 222 } | 222 } |
| 223 // SkDebugf("--- D32_Src_BitmapXferProc\n"); | 223 // SkDebugf("--- D32_Src_BitmapXferProc\n"); |
| 224 return D32_Src_BitmapXferProc; | 224 return D32_Src_BitmapXferProc; |
| 225 case SkBitmap::kARGB_4444_Config: | |
| 226 if (data) { | |
| 227 *data = SkPixel32ToPixel4444(pmc); | |
| 228 } | |
| 229 // SkDebugf("--- D16_Src_BitmapXferProc\n"); | |
| 230 return D16_Src_BitmapXferProc; | |
| 231 case SkBitmap::kRGB_565_Config: | 225 case SkBitmap::kRGB_565_Config: |
| 232 if (data) { | 226 if (data) { |
| 233 *data = SkPixel32ToPixel16(pmc); | 227 *data = SkPixel32ToPixel16(pmc); |
| 234 } | 228 } |
| 235 // SkDebugf("--- D16_Src_BitmapXferProc\n"); | 229 // SkDebugf("--- D16_Src_BitmapXferProc\n"); |
| 236 return D16_Src_BitmapXferProc; | 230 return D16_Src_BitmapXferProc; |
| 237 case SkBitmap::kA8_Config: | 231 case SkBitmap::kA8_Config: |
| 238 if (data) { | 232 if (data) { |
| 239 *data = SkGetPackedA32(pmc); | 233 *data = SkGetPackedA32(pmc); |
| 240 } | 234 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 251 return NULL; | 245 return NULL; |
| 252 } | 246 } |
| 253 | 247 |
| 254 static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect, | 248 static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect, |
| 255 BitmapXferProc proc, uint32_t procData) { | 249 BitmapXferProc proc, uint32_t procData) { |
| 256 int shiftPerPixel; | 250 int shiftPerPixel; |
| 257 switch (bitmap.config()) { | 251 switch (bitmap.config()) { |
| 258 case SkBitmap::kARGB_8888_Config: | 252 case SkBitmap::kARGB_8888_Config: |
| 259 shiftPerPixel = 2; | 253 shiftPerPixel = 2; |
| 260 break; | 254 break; |
| 261 case SkBitmap::kARGB_4444_Config: | |
| 262 case SkBitmap::kRGB_565_Config: | 255 case SkBitmap::kRGB_565_Config: |
| 263 shiftPerPixel = 1; | 256 shiftPerPixel = 1; |
| 264 break; | 257 break; |
| 265 case SkBitmap::kA8_Config: | 258 case SkBitmap::kA8_Config: |
| 266 shiftPerPixel = 0; | 259 shiftPerPixel = 0; |
| 267 break; | 260 break; |
| 268 default: | 261 default: |
| 269 SkDEBUGFAIL("Can't use xferproc on this config"); | 262 SkDEBUGFAIL("Can't use xferproc on this config"); |
| 270 return; | 263 return; |
| 271 } | 264 } |
| (...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 mask->fImage = SkMask::AllocImage(size); | 2825 mask->fImage = SkMask::AllocImage(size); |
| 2833 memset(mask->fImage, 0, mask->computeImageSize()); | 2826 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2834 } | 2827 } |
| 2835 | 2828 |
| 2836 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2829 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2837 draw_into_mask(*mask, devPath, style); | 2830 draw_into_mask(*mask, devPath, style); |
| 2838 } | 2831 } |
| 2839 | 2832 |
| 2840 return true; | 2833 return true; |
| 2841 } | 2834 } |
| OLD | NEW |