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 SkBitmapProcShader_DEFINED | 10 #ifndef SkBitmapProcShader_DEFINED |
11 #define SkBitmapProcShader_DEFINED | 11 #define SkBitmapProcShader_DEFINED |
12 | 12 |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkBitmapProcState.h" | 14 #include "SkBitmapProcState.h" |
| 15 #include "SkSmallAllocator.h" |
15 | 16 |
16 class SkBitmapProcShader : public SkShader { | 17 class SkBitmapProcShader : public SkShader { |
17 public: | 18 public: |
18 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty); | 19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty); |
19 | 20 |
20 // overrides from SkShader | 21 // overrides from SkShader |
21 virtual bool isOpaque() const SK_OVERRIDE; | 22 virtual bool isOpaque() const SK_OVERRIDE; |
22 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK
_OVERRIDE; | 23 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK
_OVERRIDE; |
23 virtual void endContext() SK_OVERRIDE; | 24 virtual void endContext() SK_OVERRIDE; |
24 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } | 25 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } |
(...skipping 16 matching lines...) Expand all Loading... |
41 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 42 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
42 | 43 |
43 SkBitmap fRawBitmap; // experimental for RLE encoding | 44 SkBitmap fRawBitmap; // experimental for RLE encoding |
44 SkBitmapProcState fState; | 45 SkBitmapProcState fState; |
45 uint32_t fFlags; | 46 uint32_t fFlags; |
46 | 47 |
47 private: | 48 private: |
48 typedef SkShader INHERITED; | 49 typedef SkShader INHERITED; |
49 }; | 50 }; |
50 | 51 |
| 52 // Commonly used allocator. It currently is only used to allocate up to 2 object
s. The total |
| 53 // bytes requested is calculated using one of our large shaders plus the size of
an Sk3DBlitter |
| 54 // in SkDraw.cpp |
| 55 typedef SkSmallAllocator<2, sizeof(SkBitmapProcShader) + sizeof(void*) * 2> SkTB
litterAllocator; |
| 56 |
| 57 // If alloc is non-NULL, it will be used to allocate the returned SkShader, and
MUST outlive |
| 58 // the SkShader. |
| 59 SkShader* CreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader::
TileMode, |
| 60 SkTBlitterAllocator* alloc); |
| 61 |
51 #endif | 62 #endif |
OLD | NEW |