OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkSpriteBlitter.h" | 10 #include "SkSpriteBlitter.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 if (paint.getAlpha() < 0xFF) { | 272 if (paint.getAlpha() < 0xFF) { |
273 flags |= SkBlitRow::kGlobalAlpha_Flag; | 273 flags |= SkBlitRow::kGlobalAlpha_Flag; |
274 } | 274 } |
275 if (!fSource->isOpaque()) { | 275 if (!fSource->isOpaque()) { |
276 flags |= SkBlitRow::kSrcPixelAlpha_Flag; | 276 flags |= SkBlitRow::kSrcPixelAlpha_Flag; |
277 } | 277 } |
278 if (paint.isDither()) { | 278 if (paint.isDither()) { |
279 flags |= SkBlitRow::kDither_Flag; | 279 flags |= SkBlitRow::kDither_Flag; |
280 } | 280 } |
281 fProc = SkBlitRow::Factory(flags, kRGB_565_SkColorType); | 281 fProc = SkBlitRow::Factory16(flags); |
282 } | 282 } |
283 | 283 |
284 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { | 284 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { |
285 uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); | 285 uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); |
286 const SkPMColor* SK_RESTRICT src = fSource->getAddr32(x - fLeft, | 286 const SkPMColor* SK_RESTRICT src = fSource->getAddr32(x - fLeft, |
287 y - fTop); | 287 y - fTop); |
288 size_t dstRB = fDevice->rowBytes(); | 288 size_t dstRB = fDevice->rowBytes(); |
289 size_t srcRB = fSource->rowBytes(); | 289 size_t srcRB = fSource->rowBytes(); |
290 SkBlitRow::Proc proc = fProc; | 290 SkBlitRow::Proc16 proc = fProc; |
291 U8CPU alpha = fPaint->getAlpha(); | 291 U8CPU alpha = fPaint->getAlpha(); |
292 | 292 |
293 while (--height >= 0) { | 293 while (--height >= 0) { |
294 proc(dst, src, width, alpha, x, y); | 294 proc(dst, src, width, alpha, x, y); |
295 y += 1; | 295 y += 1; |
296 dst = (uint16_t* SK_RESTRICT)((char*)dst + dstRB); | 296 dst = (uint16_t* SK_RESTRICT)((char*)dst + dstRB); |
297 src = (const SkPMColor* SK_RESTRICT)((const char*)src + srcRB); | 297 src = (const SkPMColor* SK_RESTRICT)((const char*)src + srcRB); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 private: | 301 private: |
302 SkBlitRow::Proc fProc; | 302 SkBlitRow::Proc16 fProc; |
303 | 303 |
304 typedef SkSpriteBlitter INHERITED; | 304 typedef SkSpriteBlitter INHERITED; |
305 }; | 305 }; |
306 | 306 |
307 /////////////////////////////////////////////////////////////////////////////// | 307 /////////////////////////////////////////////////////////////////////////////// |
308 | 308 |
309 SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
t& paint, | 309 SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
t& paint, |
310 SkTBlitterAllocator* allocator) { | 310 SkTBlitterAllocator* allocator) { |
311 | 311 |
312 SkASSERT(allocator != NULL); | 312 SkASSERT(allocator != NULL); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } else { | 371 } else { |
372 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour
ce, alpha); | 372 blitter = allocator->createT<Sprite_D16_SIndex8A_Blend>(sour
ce, alpha); |
373 } | 373 } |
374 } | 374 } |
375 break; | 375 break; |
376 default: | 376 default: |
377 break; | 377 break; |
378 } | 378 } |
379 return blitter; | 379 return blitter; |
380 } | 380 } |
OLD | NEW |