| 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 SkSpriteBlitter_DEFINED | 8 #ifndef SkSpriteBlitter_DEFINED |
| 9 #define SkSpriteBlitter_DEFINED | 9 #define SkSpriteBlitter_DEFINED |
| 10 | 10 |
| 11 #include "SkBlitter.h" | 11 #include "SkBlitter.h" |
| 12 #include "SkPixmap.h" | 12 #include "SkPixmap.h" |
| 13 #include "SkShader.h" | 13 #include "SkShader.h" |
| 14 #include "SkSmallAllocator.h" | 14 #include "SkSmallAllocator.h" |
| 15 | 15 |
| 16 class SkPaint; | 16 class SkPaint; |
| 17 | 17 |
| 18 // SkSpriteBlitter specializes SkBlitter in a way to move large rectangles of pi
xels around. |
| 19 // Because of this use, the main primitive shifts from blitH style things to the
more efficient |
| 20 // blitRect. |
| 18 class SkSpriteBlitter : public SkBlitter { | 21 class SkSpriteBlitter : public SkBlitter { |
| 19 public: | 22 public: |
| 20 SkSpriteBlitter(const SkPixmap& source); | 23 SkSpriteBlitter(const SkPixmap& source); |
| 21 | 24 |
| 22 virtual void setup(const SkPixmap& dst, int left, int top, const SkPaint&); | 25 virtual void setup(const SkPixmap& dst, int left, int top, const SkPaint&); |
| 23 | 26 |
| 24 #ifdef SK_DEBUG | 27 // blitH, blitAntiH, blitV and blitMask should not be called on an SkSpriteB
litter. |
| 25 void blitH(int x, int y, int width) override; | 28 void blitH(int x, int y, int width) override; |
| 26 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]
) override; | 29 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]
) override; |
| 27 void blitV(int x, int y, int height, SkAlpha alpha) override; | 30 void blitV(int x, int y, int height, SkAlpha alpha) override; |
| 28 void blitMask(const SkMask&, const SkIRect& clip) override; | 31 void blitMask(const SkMask&, const SkIRect& clip) override; |
| 29 #endif | 32 |
| 33 // A SkSpriteBlitter must implement blitRect. |
| 34 void blitRect(int x, int y, int width, int height) override = 0; |
| 30 | 35 |
| 31 static SkSpriteBlitter* ChooseD16(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); | 36 static SkSpriteBlitter* ChooseD16(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); |
| 32 static SkSpriteBlitter* ChooseL32(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); | 37 static SkSpriteBlitter* ChooseL32(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); |
| 33 static SkSpriteBlitter* ChooseS32(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); | 38 static SkSpriteBlitter* ChooseS32(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); |
| 34 static SkSpriteBlitter* ChooseF16(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); | 39 static SkSpriteBlitter* ChooseF16(const SkPixmap& source, const SkPaint&, Sk
TBlitterAllocator*); |
| 35 | 40 |
| 36 protected: | 41 protected: |
| 37 SkPixmap fDst; | 42 SkPixmap fDst; |
| 38 const SkPixmap fSource; | 43 const SkPixmap fSource; |
| 39 int fLeft, fTop; | 44 int fLeft, fTop; |
| 40 const SkPaint* fPaint; | 45 const SkPaint* fPaint; |
| 46 |
| 47 private: |
| 48 typedef SkBlitter INHERITED; |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 #endif | 51 #endif |
| OLD | NEW |