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 #ifndef SkBlitter_DEFINED | 8 #ifndef SkBlitter_DEFINED |
9 #define SkBlitter_DEFINED | 9 #define SkBlitter_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 on the right. | 43 on the right. |
44 The result will always be at least two pixels wide. | 44 The result will always be at least two pixels wide. |
45 */ | 45 */ |
46 virtual void blitAntiRect(int x, int y, int width, int height, | 46 virtual void blitAntiRect(int x, int y, int width, int height, |
47 SkAlpha leftAlpha, SkAlpha rightAlpha); | 47 SkAlpha leftAlpha, SkAlpha rightAlpha); |
48 /// Blit a pattern of pixels defined by a rectangle-clipped mask; | 48 /// Blit a pattern of pixels defined by a rectangle-clipped mask; |
49 /// typically used for text. | 49 /// typically used for text. |
50 virtual void blitMask(const SkMask&, const SkIRect& clip); | 50 virtual void blitMask(const SkMask&, const SkIRect& clip); |
51 | 51 |
52 /** If the blitter just sets a single value for each pixel, return the | 52 /** If the blitter just sets a single value for each pixel, return the |
53 bitmap it draws into, and assign value. If not, return NULL and ignore | 53 bitmap it draws into, and assign value. If not, return nullptr and ignor
e |
54 the value parameter. | 54 the value parameter. |
55 */ | 55 */ |
56 virtual const SkPixmap* justAnOpaqueColor(uint32_t* value); | 56 virtual const SkPixmap* justAnOpaqueColor(uint32_t* value); |
57 | 57 |
58 // (x, y), (x + 1, y) | 58 // (x, y), (x + 1, y) |
59 virtual void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { | 59 virtual void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { |
60 int16_t runs[3]; | 60 int16_t runs[3]; |
61 uint8_t aa[2]; | 61 uint8_t aa[2]; |
62 | 62 |
63 runs[0] = 1; | 63 runs[0] = 1; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 * This function returns the number of rows that this blitter could optimall
y | 102 * This function returns the number of rows that this blitter could optimall
y |
103 * process at a time. It is still required to support blitting one scanline | 103 * process at a time. It is still required to support blitting one scanline |
104 * at a time. | 104 * at a time. |
105 */ | 105 */ |
106 virtual int requestRowsPreserved() const { return 1; } | 106 virtual int requestRowsPreserved() const { return 1; } |
107 | 107 |
108 /** | 108 /** |
109 * This function allocates memory for the blitter that the blitter then owns
. | 109 * This function allocates memory for the blitter that the blitter then owns
. |
110 * The memory can be used by the calling function at will, but it will be | 110 * The memory can be used by the calling function at will, but it will be |
111 * released when the blitter's destructor is called. This function returns | 111 * released when the blitter's destructor is called. This function returns |
112 * NULL if no persistent memory is needed by the blitter. | 112 * nullptr if no persistent memory is needed by the blitter. |
113 */ | 113 */ |
114 virtual void* allocBlitMemory(size_t sz) { | 114 virtual void* allocBlitMemory(size_t sz) { |
115 return fBlitMemory.reset(sz, SkAutoMalloc::kReuse_OnShrink); | 115 return fBlitMemory.reset(sz, SkAutoMalloc::kReuse_OnShrink); |
116 } | 116 } |
117 | 117 |
118 ///@name non-virtual helpers | 118 ///@name non-virtual helpers |
119 void blitMaskRegion(const SkMask& mask, const SkRegion& clip); | 119 void blitMaskRegion(const SkMask& mask, const SkRegion& clip); |
120 void blitRectRegion(const SkIRect& rect, const SkRegion& clip); | 120 void blitRectRegion(const SkIRect& rect, const SkRegion& clip); |
121 void blitRegion(const SkRegion& clip); | 121 void blitRegion(const SkRegion& clip); |
122 ///@} | 122 ///@} |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const SkRegion* fRgn; | 222 const SkRegion* fRgn; |
223 }; | 223 }; |
224 | 224 |
225 /** Factory to set up the appropriate most-efficient wrapper blitter | 225 /** Factory to set up the appropriate most-efficient wrapper blitter |
226 to apply a clip. Returns a pointer to a member, so lifetime must | 226 to apply a clip. Returns a pointer to a member, so lifetime must |
227 be managed carefully. | 227 be managed carefully. |
228 */ | 228 */ |
229 class SkBlitterClipper { | 229 class SkBlitterClipper { |
230 public: | 230 public: |
231 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, | 231 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, |
232 const SkIRect* bounds = NULL); | 232 const SkIRect* bounds = nullptr); |
233 | 233 |
234 private: | 234 private: |
235 SkNullBlitter fNullBlitter; | 235 SkNullBlitter fNullBlitter; |
236 SkRectClipBlitter fRectBlitter; | 236 SkRectClipBlitter fRectBlitter; |
237 SkRgnClipBlitter fRgnBlitter; | 237 SkRgnClipBlitter fRgnBlitter; |
238 }; | 238 }; |
239 | 239 |
240 #endif | 240 #endif |
OLD | NEW |