| 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 #ifndef SkBlitter_DEFINED | 10 #ifndef SkBlitter_DEFINED |
| 11 #define SkBlitter_DEFINED | 11 #define SkBlitter_DEFINED |
| 12 | 12 |
| 13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
| 14 #include "SkBitmapProcShader.h" |
| 15 #include "SkMask.h" |
| 14 #include "SkMatrix.h" | 16 #include "SkMatrix.h" |
| 15 #include "SkPaint.h" | 17 #include "SkPaint.h" |
| 16 #include "SkRefCnt.h" | 18 #include "SkRefCnt.h" |
| 17 #include "SkRegion.h" | 19 #include "SkRegion.h" |
| 18 #include "SkMask.h" | 20 #include "SkShader.h" |
| 21 #include "SkSmallAllocator.h" |
| 19 | 22 |
| 20 /** SkBlitter and its subclasses are responsible for actually writing pixels | 23 /** SkBlitter and its subclasses are responsible for actually writing pixels |
| 21 into memory. Besides efficiency, they handle clipping and antialiasing. | 24 into memory. Besides efficiency, they handle clipping and antialiasing. |
| 22 */ | 25 */ |
| 23 class SkBlitter { | 26 class SkBlitter { |
| 24 public: | 27 public: |
| 25 virtual ~SkBlitter(); | 28 virtual ~SkBlitter(); |
| 26 | 29 |
| 27 /// Blit a horizontal run of one or more pixels. | 30 /// Blit a horizontal run of one or more pixels. |
| 28 virtual void blitH(int x, int y, int width); | 31 virtual void blitH(int x, int y, int width); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void blitMaskRegion(const SkMask& mask, const SkRegion& clip); | 65 void blitMaskRegion(const SkMask& mask, const SkRegion& clip); |
| 63 void blitRectRegion(const SkIRect& rect, const SkRegion& clip); | 66 void blitRectRegion(const SkIRect& rect, const SkRegion& clip); |
| 64 void blitRegion(const SkRegion& clip); | 67 void blitRegion(const SkRegion& clip); |
| 65 ///@} | 68 ///@} |
| 66 | 69 |
| 67 /** @name Factories | 70 /** @name Factories |
| 68 Return the correct blitter to use given the specified context. | 71 Return the correct blitter to use given the specified context. |
| 69 */ | 72 */ |
| 70 static SkBlitter* Choose(const SkBitmap& device, | 73 static SkBlitter* Choose(const SkBitmap& device, |
| 71 const SkMatrix& matrix, | 74 const SkMatrix& matrix, |
| 72 const SkPaint& paint) { | |
| 73 return Choose(device, matrix, paint, NULL, 0); | |
| 74 } | |
| 75 | |
| 76 static SkBlitter* Choose(const SkBitmap& device, | |
| 77 const SkMatrix& matrix, | |
| 78 const SkPaint& paint, | 75 const SkPaint& paint, |
| 79 void* storage, size_t storageSize, | 76 SkTBlitterAllocator*, |
| 80 bool drawCoverage = false); | 77 bool drawCoverage = false); |
| 81 | 78 |
| 82 static SkBlitter* ChooseSprite(const SkBitmap& device, | 79 static SkBlitter* ChooseSprite(const SkBitmap& device, |
| 83 const SkPaint&, | 80 const SkPaint&, |
| 84 const SkBitmap& src, | 81 const SkBitmap& src, |
| 85 int left, int top, | 82 int left, int top, |
| 86 void* storage, size_t storageSize); | 83 SkTBlitterAllocator*); |
| 87 ///@} | 84 ///@} |
| 88 | 85 |
| 89 private: | 86 private: |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 /** This blitter silently never draws anything. | 89 /** This blitter silently never draws anything. |
| 93 */ | 90 */ |
| 94 class SkNullBlitter : public SkBlitter { | 91 class SkNullBlitter : public SkBlitter { |
| 95 public: | 92 public: |
| 96 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 93 virtual void blitH(int x, int y, int width) SK_OVERRIDE; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, | 163 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, |
| 167 const SkIRect* bounds = NULL); | 164 const SkIRect* bounds = NULL); |
| 168 | 165 |
| 169 private: | 166 private: |
| 170 SkNullBlitter fNullBlitter; | 167 SkNullBlitter fNullBlitter; |
| 171 SkRectClipBlitter fRectBlitter; | 168 SkRectClipBlitter fRectBlitter; |
| 172 SkRgnClipBlitter fRgnBlitter; | 169 SkRgnClipBlitter fRgnBlitter; |
| 173 }; | 170 }; |
| 174 | 171 |
| 175 #endif | 172 #endif |
| OLD | NEW |