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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 | 48 |
49 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
51 class Sprite_D16_S16_Opaque : public SkSpriteBlitter { | 51 class Sprite_D16_S16_Opaque : public SkSpriteBlitter { |
52 public: | 52 public: |
53 Sprite_D16_S16_Opaque(const SkBitmap& source) | 53 Sprite_D16_S16_Opaque(const SkBitmap& source) |
54 : SkSpriteBlitter(source) {} | 54 : SkSpriteBlitter(source) {} |
55 | 55 |
56 // overrides | 56 // overrides |
57 virtual void blitRect(int x, int y, int width, int height) { | 57 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE { |
58 uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); | 58 uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); |
59 const uint16_t* SK_RESTRICT src = fSource->getAddr16(x - fLeft, | 59 const uint16_t* SK_RESTRICT src = fSource->getAddr16(x - fLeft, |
60 y - fTop); | 60 y - fTop); |
61 size_t dstRB = fDevice->rowBytes(); | 61 size_t dstRB = fDevice->rowBytes(); |
62 size_t srcRB = fSource->rowBytes(); | 62 size_t srcRB = fSource->rowBytes(); |
63 | 63 |
64 while (--height >= 0) { | 64 while (--height >= 0) { |
65 memcpy(dst, src, width << 1); | 65 memcpy(dst, src, width << 1); |
66 dst = (uint16_t*)((char*)dst + dstRB); | 66 dst = (uint16_t*)((char*)dst + dstRB); |
67 src = (const uint16_t*)((const char*)src + srcRB); | 67 src = (const uint16_t*)((const char*)src + srcRB); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 /////////////////////////////////////////////////////////////////////////////// | 257 /////////////////////////////////////////////////////////////////////////////// |
258 | 258 |
259 class Sprite_D16_S32_BlitRowProc : public SkSpriteBlitter { | 259 class Sprite_D16_S32_BlitRowProc : public SkSpriteBlitter { |
260 public: | 260 public: |
261 Sprite_D16_S32_BlitRowProc(const SkBitmap& source) | 261 Sprite_D16_S32_BlitRowProc(const SkBitmap& source) |
262 : SkSpriteBlitter(source) {} | 262 : SkSpriteBlitter(source) {} |
263 | 263 |
264 // overrides | 264 // overrides |
265 | 265 |
266 virtual void setup(const SkBitmap& device, int left, int top, | 266 virtual void setup(const SkBitmap& device, int left, int top, |
267 const SkPaint& paint) { | 267 const SkPaint& paint) SK_OVERRIDE { |
268 this->INHERITED::setup(device, left, top, paint); | 268 this->INHERITED::setup(device, left, top, paint); |
269 | 269 |
270 unsigned flags = 0; | 270 unsigned flags = 0; |
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::Factory(flags, kRGB_565_SkColorType); |
282 } | 282 } |
283 | 283 |
284 virtual void blitRect(int x, int y, int width, int height) { | 284 virtual 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::Proc 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); |
(...skipping 76 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 |