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 "SkBitmap.h" | 10 #include "SkBitmap.h" |
11 #include "SkMask.h" | 11 #include "SkMask.h" |
12 | 12 |
13 #ifndef ClearLow3Bits_DEFINED | 13 #ifndef ClearLow3Bits_DEFINED |
14 #define ClearLow3Bits_DEFINED | 14 #define ClearLow3Bits_DEFINED |
15 #define ClearLow3Bits(x) ((unsigned)(x) >> 3 << 3) | 15 #define ClearLow3Bits(x) ((unsigned)(x) >> 3 << 3) |
16 #endif | 16 #endif |
17 | 17 |
18 /* | 18 /* |
19 SK_BLITBWMASK_NAME name of function(const SkBitmap& bitmap, const S
kMask& mask, const SkIRect& clip, SK_BLITBWMASK_ARGS) | 19 SK_BLITBWMASK_NAME name of function(const SkBitmap& bitmap, const S
kMask& mask, const SkIRect& clip, SK_BLITBWMASK_ARGS) |
20 SK_BLITBWMASK_ARGS list of additional arguments to SK_BLITBWMASK_NA
ME, beginning with a comma | 20 SK_BLITBWMASK_ARGS list of additional arguments to SK_BLITBWMASK_NA
ME, beginning with a comma |
21 SK_BLITBWMASK_BLIT8 name of function(U8CPU byteMask, SK_BLITBWMASK_D
EVTYPE* dst, int x, int y) | 21 SK_BLITBWMASK_BLIT8 name of function(U8CPU byteMask, SK_BLITBWMASK_D
EVTYPE* dst, int x, int y) |
22 SK_BLITBWMASK_GETADDR either getAddr32 or getAddr16 or getAddr8 | 22 SK_BLITBWMASK_GETADDR either writable_addr[8,16,32] |
23 SK_BLITBWMASK_DEVTYPE either U32 or U16 or U8 | 23 SK_BLITBWMASK_DEVTYPE either U32 or U16 or U8 |
24 */ | 24 */ |
25 | 25 |
26 static void SK_BLITBWMASK_NAME(const SkBitmap& bitmap, const SkMask& srcMask, co
nst SkIRect& clip SK_BLITBWMASK_ARGS) | 26 static void SK_BLITBWMASK_NAME(const SkPixmap& dst, const SkMask& srcMask, |
27 { | 27 const SkIRect& clip SK_BLITBWMASK_ARGS) { |
28 SkASSERT(clip.fRight <= srcMask.fBounds.fRight); | 28 SkASSERT(clip.fRight <= srcMask.fBounds.fRight); |
29 | 29 |
30 int cx = clip.fLeft; | 30 int cx = clip.fLeft; |
31 int cy = clip.fTop; | 31 int cy = clip.fTop; |
32 int maskLeft = srcMask.fBounds.fLeft; | 32 int maskLeft = srcMask.fBounds.fLeft; |
33 unsigned mask_rowBytes = srcMask.fRowBytes; | 33 unsigned mask_rowBytes = srcMask.fRowBytes; |
34 size_t bitmap_rowBytes = bitmap.rowBytes(); | 34 size_t bitmap_rowBytes = dst.rowBytes(); |
35 unsigned height = clip.height(); | 35 unsigned height = clip.height(); |
36 | 36 |
37 SkASSERT(mask_rowBytes != 0); | 37 SkASSERT(mask_rowBytes != 0); |
38 SkASSERT(bitmap_rowBytes != 0); | 38 SkASSERT(bitmap_rowBytes != 0); |
39 SkASSERT(height != 0); | 39 SkASSERT(height != 0); |
40 | 40 |
41 const uint8_t* bits = srcMask.getAddr1(cx, cy); | 41 const uint8_t* bits = srcMask.getAddr1(cx, cy); |
42 SK_BLITBWMASK_DEVTYPE* device = bitmap.SK_BLITBWMASK_GETADDR(cx, cy); | 42 SK_BLITBWMASK_DEVTYPE* device = dst.SK_BLITBWMASK_GETADDR(cx, cy); |
43 | 43 |
44 if (cx == maskLeft && clip.fRight == srcMask.fBounds.fRight) | 44 if (cx == maskLeft && clip.fRight == srcMask.fBounds.fRight) |
45 { | 45 { |
46 do { | 46 do { |
47 SK_BLITBWMASK_DEVTYPE* dst = device; | 47 SK_BLITBWMASK_DEVTYPE* dst = device; |
48 unsigned rb = mask_rowBytes; | 48 unsigned rb = mask_rowBytes; |
49 do { | 49 do { |
50 U8CPU mask = *bits++; | 50 U8CPU mask = *bits++; |
51 SK_BLITBWMASK_BLIT8(mask, dst); | 51 SK_BLITBWMASK_BLIT8(mask, dst); |
52 dst += 8; | 52 dst += 8; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 #undef SK_BLITBWMASK_NAME | 123 #undef SK_BLITBWMASK_NAME |
124 #undef SK_BLITBWMASK_ARGS | 124 #undef SK_BLITBWMASK_ARGS |
125 #undef SK_BLITBWMASK_BLIT8 | 125 #undef SK_BLITBWMASK_BLIT8 |
126 #undef SK_BLITBWMASK_GETADDR | 126 #undef SK_BLITBWMASK_GETADDR |
127 #undef SK_BLITBWMASK_DEVTYPE | 127 #undef SK_BLITBWMASK_DEVTYPE |
128 #undef SK_BLITBWMASK_DOROWSETUP | 128 #undef SK_BLITBWMASK_DOROWSETUP |
OLD | NEW |