| 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 #ifndef SkBitmapProcShader_DEFINED | 7 #ifndef SkBitmapProcShader_DEFINED |
| 8 #define SkBitmapProcShader_DEFINED | 8 #define SkBitmapProcShader_DEFINED |
| 9 | 9 |
| 10 #include "SkImagePriv.h" | 10 #include "SkImagePriv.h" |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 #include "SkSmallAllocator.h" | |
| 13 | 12 |
| 14 struct SkBitmapProcState; | |
| 15 class SkBitmapProvider; | 13 class SkBitmapProvider; |
| 16 | 14 |
| 17 class SkBitmapProcLegacyShader : public SkShader { | 15 class SkBitmapProcLegacyShader : public SkShader { |
| 18 private: | 16 private: |
| 19 friend class SkImageShader; | 17 friend class SkImageShader; |
| 20 | 18 |
| 21 static size_t ContextSize(const ContextRec&, const SkImageInfo& srcInfo); | 19 static size_t ContextSize(const ContextRec&, const SkImageInfo& srcInfo); |
| 22 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, | 20 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, |
| 23 const SkBitmapProvider&, const ContextRec&, void
* storage); | 21 const SkBitmapProvider&, const ContextRec&, void
* storage); |
| 24 | 22 |
| 25 typedef SkShader INHERITED; | 23 typedef SkShader INHERITED; |
| 26 }; | 24 }; |
| 27 | 25 |
| 28 enum {kSkBlitterContextSize = 3332}; | |
| 29 | |
| 30 // Commonly used allocator. It currently is only used to allocate up to 3 object
s. The total | |
| 31 // bytes requested is calculated using one of our large shaders, its context siz
e plus the size of | |
| 32 // an Sk3DBlitter in SkDraw.cpp | |
| 33 // Note that some contexts may contain other contexts (e.g. for compose shaders)
, but we've not | |
| 34 // yet found a situation where the size below isn't big enough. | |
| 35 typedef SkSmallAllocator<3, kSkBlitterContextSize> SkTBlitterAllocator; | |
| 36 | |
| 37 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a
nd MUST outlive | |
| 38 // the SkShader. | |
| 39 sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkShader::TileMode, SkSh
ader::TileMode, | |
| 40 const SkMatrix* localMatrix, SkCopyPixelsMode
, | |
| 41 SkTBlitterAllocator* alloc); | |
| 42 | |
| 43 #endif | 26 #endif |
| OLD | NEW |