| 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 "SkSmallAllocator.h" | 14 #include "SkSmallAllocator.h" |
| 15 | 15 |
| 16 struct SkBitmapProcState; | 16 struct SkBitmapProcState; |
| 17 class SkBitmapProvider; |
| 17 | 18 |
| 18 class SkBitmapProcShader : public SkShader { | 19 class SkBitmapProcShader : public SkShader { |
| 19 public: | 20 public: |
| 20 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty, | 21 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty, |
| 21 const SkMatrix* localMatrix = nullptr); | 22 const SkMatrix* localMatrix = nullptr); |
| 22 | 23 |
| 23 bool isOpaque() const override; | 24 bool isOpaque() const override; |
| 24 | 25 |
| 25 size_t contextSize() const override { return ContextSize(); } | 26 size_t contextSize() const override { return ContextSize(); } |
| 26 | 27 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 Context* onCreateContext(const ContextRec&, void* storage) const override; | 59 Context* onCreateContext(const ContextRec&, void* storage) const override; |
| 59 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; | 60 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; |
| 60 | 61 |
| 61 SkBitmap fRawBitmap; // experimental for RLE encoding | 62 SkBitmap fRawBitmap; // experimental for RLE encoding |
| 62 uint8_t fTileModeX, fTileModeY; | 63 uint8_t fTileModeX, fTileModeY; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 friend class SkImageShader; | 66 friend class SkImageShader; |
| 66 | 67 |
| 67 static size_t ContextSize(); | 68 static size_t ContextSize(); |
| 68 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, con
st SkBitmap&, | 69 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, |
| 69 const ContextRec&, void* storage); | 70 const SkBitmapProvider&, const ContextRec&, void
* storage); |
| 70 | 71 |
| 71 typedef SkShader INHERITED; | 72 typedef SkShader INHERITED; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 // Commonly used allocator. It currently is only used to allocate up to 3 object
s. The total | 75 // Commonly used allocator. It currently is only used to allocate up to 3 object
s. The total |
| 75 // bytes requested is calculated using one of our large shaders, its context siz
e plus the size of | 76 // bytes requested is calculated using one of our large shaders, its context siz
e plus the size of |
| 76 // an Sk3DBlitter in SkDraw.cpp | 77 // an Sk3DBlitter in SkDraw.cpp |
| 77 // Note that some contexts may contain other contexts (e.g. for compose shaders)
, but we've not | 78 // Note that some contexts may contain other contexts (e.g. for compose shaders)
, but we've not |
| 78 // yet found a situation where the size below isn't big enough. | 79 // yet found a situation where the size below isn't big enough. |
| 79 typedef SkSmallAllocator<3, 1160> SkTBlitterAllocator; | 80 typedef SkSmallAllocator<3, 1160> SkTBlitterAllocator; |
| 80 | 81 |
| 81 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a
nd MUST outlive | 82 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a
nd MUST outlive |
| 82 // the SkShader. | 83 // the SkShader. |
| 83 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader
::TileMode, | 84 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader
::TileMode, |
| 84 const SkMatrix* localMatrix, SkTBlitterAllocator*
alloc); | 85 const SkMatrix* localMatrix, SkTBlitterAllocator*
alloc); |
| 85 | 86 |
| 86 #endif | 87 #endif |
| OLD | NEW |