| 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 SkBitmapProcShader_DEFINED | 8 #ifndef SkBitmapProcShader_DEFINED |
| 9 #define SkBitmapProcShader_DEFINED | 9 #define SkBitmapProcShader_DEFINED |
| 10 | 10 |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 #include "SkSmallAllocator.h" | 12 #include "SkSmallAllocator.h" |
| 13 | 13 |
| 14 struct SkBitmapProcState; | 14 struct SkBitmapProcState; |
| 15 class SkBitmapProvider; | 15 class SkBitmapProvider; |
| 16 | 16 |
| 17 class SkBitmapProcShader : public SkShader { | 17 class SkBitmapProcShader : public SkShader { |
| 18 public: | 18 public: |
| 19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty, | 19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty, |
| 20 const SkMatrix* localMatrix = nullptr); | 20 const SkMatrix* localMatrix = nullptr); |
| 21 | 21 |
| 22 bool isOpaque() const override; | 22 bool isOpaque() const override; |
| 23 | 23 |
| 24 SK_TO_STRING_OVERRIDE() | 24 SK_TO_STRING_OVERRIDE() |
| 25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) | 25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) |
| 26 | 26 |
| 27 #if SK_SUPPORT_GPU | 27 #if SK_SUPPORT_GPU |
| 28 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v
iewM, | 28 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v
iewM, |
| 29 const SkMatrix*, SkFilterQual
ity) const override; | 29 const SkMatrix*, SkFilterQual
ity, |
| 30 SkSourceGammaTreatment) const
override; |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 protected: | 33 protected: |
| 33 void flatten(SkWriteBuffer&) const override; | 34 void flatten(SkWriteBuffer&) const override; |
| 34 size_t onContextSize(const ContextRec& rec) const override { | 35 size_t onContextSize(const ContextRec& rec) const override { |
| 35 return ContextSize(rec, fRawBitmap.info()); | 36 return ContextSize(rec, fRawBitmap.info()); |
| 36 } | 37 } |
| 37 Context* onCreateContext(const ContextRec&, void* storage) const override; | 38 Context* onCreateContext(const ContextRec&, void* storage) const override; |
| 38 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; | 39 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; |
| 39 | 40 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 // Note that some contexts may contain other contexts (e.g. for compose shaders)
, but we've not | 59 // Note that some contexts may contain other contexts (e.g. for compose shaders)
, but we've not |
| 59 // yet found a situation where the size below isn't big enough. | 60 // yet found a situation where the size below isn't big enough. |
| 60 typedef SkSmallAllocator<3, kSkBlitterContextSize> SkTBlitterAllocator; | 61 typedef SkSmallAllocator<3, kSkBlitterContextSize> SkTBlitterAllocator; |
| 61 | 62 |
| 62 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a
nd MUST outlive | 63 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a
nd MUST outlive |
| 63 // the SkShader. | 64 // the SkShader. |
| 64 sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkShader::TileMode, SkSh
ader::TileMode, | 65 sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkShader::TileMode, SkSh
ader::TileMode, |
| 65 const SkMatrix* localMatrix, SkTBlitterAlloca
tor* alloc); | 66 const SkMatrix* localMatrix, SkTBlitterAlloca
tor* alloc); |
| 66 | 67 |
| 67 #endif | 68 #endif |
| OLD | NEW |