| 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 |
| 11 #include "SkBitmapProcShader.h" | 11 #include "SkBitmapProcShader.h" |
| 12 #include "SkColor.h" | 12 #include "SkColor.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkRegion.h" | 14 #include "SkRegion.h" |
| 15 #include "SkShader.h" | 15 #include "SkShader.h" |
| 16 #include "SkTypes.h" | 16 #include "SkTypes.h" |
| 17 | 17 |
| 18 class SkMatrix; | 18 class SkMatrix; |
| 19 class SkPaint; | 19 class SkPaint; |
| 20 class SkPixmap; | 20 class SkPixmap; |
| 21 struct SkMask; | 21 struct SkMask; |
| 22 | 22 |
| 23 /** SkBlitter and its subclasses are responsible for actually writing pixels | 23 /** SkBlitter and its subclasses are responsible for actually writing pixels |
| 24 into memory. Besides efficiency, they handle clipping and antialiasing. | 24 into memory. Besides efficiency, they handle clipping and antialiasing. |
| 25 A SkBlitter subclass contains all the context needed to generate pixels |
| 26 for the destination and how src/generated pixels map to the destination. |
| 27 The coordinates passed to the blitX calls are in destination pixel space. |
| 25 */ | 28 */ |
| 26 class SkBlitter { | 29 class SkBlitter { |
| 27 public: | 30 public: |
| 28 virtual ~SkBlitter(); | 31 virtual ~SkBlitter(); |
| 29 | 32 |
| 30 /// Blit a horizontal run of one or more pixels. | 33 /// Blit a horizontal run of one or more pixels. |
| 31 virtual void blitH(int x, int y, int width) = 0; | 34 virtual void blitH(int x, int y, int width) = 0; |
| 32 | 35 |
| 33 /// Blit a horizontal run of antialiased pixels; runs[] is a *sparse* | 36 /// Blit a horizontal run of antialiased pixels; runs[] is a *sparse* |
| 34 /// zero-terminated run-length encoding of spans of constant alpha values. | 37 /// zero-terminated run-length encoding of spans of constant alpha values. |
| 38 /// The runs[] and antialias[] work together to represent long runs of pixel
s with the same |
| 39 /// alphas. The runs[] contains the number of pixels with the same alpha, an
d antialias[] |
| 40 /// contain the coverage value for that number of pixels. The runs[] (and an
tialias[]) are |
| 41 /// encoded in a clever way. The runs array is zero terminated, and has enou
gh entries for |
| 42 /// each pixel plus one, in most cases some of the entries will not contain
valid data. An entry |
| 43 /// in the runs array contains the number of pixels (np) that have the same
alpha value. The |
| 44 /// next np value is found np entries away. For example, if runs[0] = 7, the
n the next valid |
| 45 /// entry will by at runs[7]. The runs array and antialias[] are coupled by
index. So, if the |
| 46 /// np entry is at runs[45] = 12 then the alpha value can be found at antial
ias[45] = 0x88. |
| 47 /// This would mean to use an alpha value of 0x88 for the next 12 pixels sta
rting at pixel 45. |
| 35 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_
t runs[]) = 0; | 48 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_
t runs[]) = 0; |
| 36 | 49 |
| 37 /// Blit a vertical run of pixels with a constant alpha value. | 50 /// Blit a vertical run of pixels with a constant alpha value. |
| 38 virtual void blitV(int x, int y, int height, SkAlpha alpha); | 51 virtual void blitV(int x, int y, int height, SkAlpha alpha); |
| 39 | 52 |
| 40 /// Blit a solid rectangle one or more pixels wide. | 53 /// Blit a solid rectangle one or more pixels wide. |
| 41 virtual void blitRect(int x, int y, int width, int height); | 54 virtual void blitRect(int x, int y, int width, int height); |
| 42 | 55 |
| 43 /** Blit a rectangle with one alpha-blended column on the left, | 56 /** Blit a rectangle with one alpha-blended column on the left, |
| 44 width (zero or more) opaque pixels, and one alpha-blended column | 57 width (zero or more) opaque pixels, and one alpha-blended column |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, | 249 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, |
| 237 const SkIRect* bounds = nullptr); | 250 const SkIRect* bounds = nullptr); |
| 238 | 251 |
| 239 private: | 252 private: |
| 240 SkNullBlitter fNullBlitter; | 253 SkNullBlitter fNullBlitter; |
| 241 SkRectClipBlitter fRectBlitter; | 254 SkRectClipBlitter fRectBlitter; |
| 242 SkRgnClipBlitter fRgnBlitter; | 255 SkRgnClipBlitter fRgnBlitter; |
| 243 }; | 256 }; |
| 244 | 257 |
| 245 #endif | 258 #endif |
| OLD | NEW |