reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame^] | 1 | /* libs/graphics/sgl/SkSpriteBlitter.h |
| 2 | ** |
| 3 | ** Copyright 2006, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef SkSpriteBlitter_DEFINED |
| 19 | #define SkSpriteBlitter_DEFINED |
| 20 | |
| 21 | #include "SkBlitter.h" |
| 22 | #include "SkBitmap.h" |
| 23 | |
| 24 | class SkPaint; |
| 25 | |
| 26 | class SkSpriteBlitter : public SkBlitter { |
| 27 | public: |
| 28 | SkSpriteBlitter(const SkBitmap& source); |
| 29 | virtual ~SkSpriteBlitter(); |
| 30 | |
| 31 | virtual void setup(const SkBitmap& device, int left, int top, |
| 32 | const SkPaint& paint); |
| 33 | |
| 34 | // overrides |
| 35 | #ifdef SK_DEBUG |
| 36 | virtual void blitH(int x, int y, int width); |
| 37 | virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]); |
| 38 | virtual void blitV(int x, int y, int height, SkAlpha alpha); |
| 39 | virtual void blitMask(const SkMask&, const SkIRect& clip); |
| 40 | #endif |
| 41 | |
| 42 | static SkSpriteBlitter* ChooseD16(const SkBitmap& source, const SkPaint&, |
| 43 | void* storage, size_t storageSize); |
| 44 | static SkSpriteBlitter* ChooseD32(const SkBitmap& source, const SkPaint&, |
| 45 | void* storage, size_t storageSize); |
| 46 | |
| 47 | protected: |
| 48 | const SkBitmap* fDevice; |
| 49 | const SkBitmap* fSource; |
| 50 | int fLeft, fTop; |
| 51 | const SkPaint* fPaint; |
| 52 | }; |
| 53 | |
| 54 | #endif |
| 55 | |