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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bool drawCoverage = false); | 129 bool drawCoverage = false); |
130 | 130 |
131 static SkBlitter* ChooseSprite(const SkPixmap& dst, | 131 static SkBlitter* ChooseSprite(const SkPixmap& dst, |
132 const SkPaint&, | 132 const SkPaint&, |
133 const SkPixmap& src, | 133 const SkPixmap& src, |
134 int left, int top, | 134 int left, int top, |
135 SkTBlitterAllocator*); | 135 SkTBlitterAllocator*); |
136 ///@} | 136 ///@} |
137 | 137 |
138 protected: | 138 protected: |
139 | |
140 SkAutoMalloc fBlitMemory; | 139 SkAutoMalloc fBlitMemory; |
141 | |
142 private: | |
143 }; | 140 }; |
144 | 141 |
145 /** This blitter silently never draws anything. | 142 /** This blitter silently never draws anything. |
146 */ | 143 */ |
147 class SkNullBlitter : public SkBlitter { | 144 class SkNullBlitter : public SkBlitter { |
148 public: | 145 public: |
149 void blitH(int x, int y, int width) override; | 146 void blitH(int x, int y, int width) override; |
150 virtual void blitAntiH(int x, int y, const SkAlpha[], | 147 void blitAntiH(int x, int y, const SkAlpha[], const int16_t runs[]) override
; |
151 const int16_t runs[]) override; | |
152 void blitV(int x, int y, int height, SkAlpha alpha) override; | 148 void blitV(int x, int y, int height, SkAlpha alpha) override; |
153 void blitRect(int x, int y, int width, int height) override; | 149 void blitRect(int x, int y, int width, int height) override; |
154 void blitMask(const SkMask&, const SkIRect& clip) override; | 150 void blitMask(const SkMask&, const SkIRect& clip) override; |
155 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; | 151 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; |
156 bool isNullBlitter() const override; | 152 bool isNullBlitter() const override; |
157 }; | 153 }; |
158 | 154 |
159 /** Wraps another (real) blitter, and ensures that the real blitter is only | 155 /** Wraps another (real) blitter, and ensures that the real blitter is only |
160 called with coordinates that have been clipped by the specified clipRect. | 156 called with coordinates that have been clipped by the specified clipRect. |
161 This means the caller need not perform the clipping ahead of time. | 157 This means the caller need not perform the clipping ahead of time. |
162 */ | 158 */ |
163 class SkRectClipBlitter : public SkBlitter { | 159 class SkRectClipBlitter : public SkBlitter { |
164 public: | 160 public: |
165 void init(SkBlitter* blitter, const SkIRect& clipRect) { | 161 void init(SkBlitter* blitter, const SkIRect& clipRect) { |
166 SkASSERT(!clipRect.isEmpty()); | 162 SkASSERT(!clipRect.isEmpty()); |
167 fBlitter = blitter; | 163 fBlitter = blitter; |
168 fClipRect = clipRect; | 164 fClipRect = clipRect; |
169 } | 165 } |
170 | 166 |
171 void blitH(int x, int y, int width) override; | 167 void blitH(int x, int y, int width) override; |
172 virtual void blitAntiH(int x, int y, const SkAlpha[], | 168 void blitAntiH(int x, int y, const SkAlpha[], const int16_t runs[]) override
; |
173 const int16_t runs[]) override; | |
174 void blitV(int x, int y, int height, SkAlpha alpha) override; | 169 void blitV(int x, int y, int height, SkAlpha alpha) override; |
175 void blitRect(int x, int y, int width, int height) override; | 170 void blitRect(int x, int y, int width, int height) override; |
176 virtual void blitAntiRect(int x, int y, int width, int height, | 171 virtual void blitAntiRect(int x, int y, int width, int height, |
177 SkAlpha leftAlpha, SkAlpha rightAlpha) override; | 172 SkAlpha leftAlpha, SkAlpha rightAlpha) override; |
178 void blitMask(const SkMask&, const SkIRect& clip) override; | 173 void blitMask(const SkMask&, const SkIRect& clip) override; |
179 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; | 174 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; |
180 | 175 |
181 int requestRowsPreserved() const override { | 176 int requestRowsPreserved() const override { |
182 return fBlitter->requestRowsPreserved(); | 177 return fBlitter->requestRowsPreserved(); |
183 } | 178 } |
(...skipping 13 matching lines...) Expand all Loading... |
197 */ | 192 */ |
198 class SkRgnClipBlitter : public SkBlitter { | 193 class SkRgnClipBlitter : public SkBlitter { |
199 public: | 194 public: |
200 void init(SkBlitter* blitter, const SkRegion* clipRgn) { | 195 void init(SkBlitter* blitter, const SkRegion* clipRgn) { |
201 SkASSERT(clipRgn && !clipRgn->isEmpty()); | 196 SkASSERT(clipRgn && !clipRgn->isEmpty()); |
202 fBlitter = blitter; | 197 fBlitter = blitter; |
203 fRgn = clipRgn; | 198 fRgn = clipRgn; |
204 } | 199 } |
205 | 200 |
206 void blitH(int x, int y, int width) override; | 201 void blitH(int x, int y, int width) override; |
207 virtual void blitAntiH(int x, int y, const SkAlpha[], | 202 void blitAntiH(int x, int y, const SkAlpha[], const int16_t runs[]) override
; |
208 const int16_t runs[]) override; | |
209 void blitV(int x, int y, int height, SkAlpha alpha) override; | 203 void blitV(int x, int y, int height, SkAlpha alpha) override; |
210 void blitRect(int x, int y, int width, int height) override; | 204 void blitRect(int x, int y, int width, int height) override; |
211 virtual void blitAntiRect(int x, int y, int width, int height, | 205 void blitAntiRect(int x, int y, int width, int height, |
212 SkAlpha leftAlpha, SkAlpha rightAlpha) override; | 206 SkAlpha leftAlpha, SkAlpha rightAlpha) override; |
213 void blitMask(const SkMask&, const SkIRect& clip) override; | 207 void blitMask(const SkMask&, const SkIRect& clip) override; |
214 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; | 208 const SkPixmap* justAnOpaqueColor(uint32_t* value) override; |
215 | 209 |
216 int requestRowsPreserved() const override { | 210 int requestRowsPreserved() const override { |
217 return fBlitter->requestRowsPreserved(); | 211 return fBlitter->requestRowsPreserved(); |
218 } | 212 } |
219 | 213 |
220 void* allocBlitMemory(size_t sz) override { | 214 void* allocBlitMemory(size_t sz) override { |
221 return fBlitter->allocBlitMemory(sz); | 215 return fBlitter->allocBlitMemory(sz); |
222 } | 216 } |
(...skipping 12 matching lines...) Expand all Loading... |
235 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, | 229 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, |
236 const SkIRect* bounds = NULL); | 230 const SkIRect* bounds = NULL); |
237 | 231 |
238 private: | 232 private: |
239 SkNullBlitter fNullBlitter; | 233 SkNullBlitter fNullBlitter; |
240 SkRectClipBlitter fRectBlitter; | 234 SkRectClipBlitter fRectBlitter; |
241 SkRgnClipBlitter fRgnBlitter; | 235 SkRgnClipBlitter fRgnBlitter; |
242 }; | 236 }; |
243 | 237 |
244 #endif | 238 #endif |
OLD | NEW |