OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 SkLocalMatrixShader_DEFINED | 8 #ifndef SkLocalMatrixShader_DEFINED |
9 #define SkLocalMatrixShader_DEFINED | 9 #define SkLocalMatrixShader_DEFINED |
10 | 10 |
11 #include "SkShader.h" | 11 #include "SkShader.h" |
12 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
14 | 14 |
15 class SkLocalMatrixShader : public SkShader { | 15 class SkLocalMatrixShader : public SkShader { |
16 public: | 16 public: |
17 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) | 17 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) |
18 : INHERITED(&localMatrix) | 18 : INHERITED(&localMatrix) |
19 , fProxyShader(SkRef(proxy)) | 19 , fProxyShader(SkRef(proxy)) |
20 {} | 20 {} |
21 | 21 |
22 size_t contextSize() const override { | 22 size_t contextSize() const override { |
23 return fProxyShader->contextSize(); | 23 return fProxyShader->contextSize(); |
24 } | 24 } |
25 | 25 |
26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, | |
27 TileMode* mode) const override { | |
28 return fProxyShader->asABitmap(bitmap, matrix, mode); | |
29 } | |
30 | |
31 GradientType asAGradient(GradientInfo* info) const override { | 26 GradientType asAGradient(GradientInfo* info) const override { |
32 return fProxyShader->asAGradient(info); | 27 return fProxyShader->asAGradient(info); |
33 } | 28 } |
34 | 29 |
35 #if SK_SUPPORT_GPU | 30 #if SK_SUPPORT_GPU |
36 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 31 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, |
37 const SkMatrix* localMatrix, SkFilterQua
lity fq, | 32 const SkMatrix* localMatrix, SkFilterQua
lity fq, |
38 GrProcessorDataManager* procDataManager)
const override { | 33 GrProcessorDataManager* procDataManager)
const override { |
39 SkMatrix tmp = this->getLocalMatrix(); | 34 SkMatrix tmp = this->getLocalMatrix(); |
40 if (localMatrix) { | 35 if (localMatrix) { |
(...skipping 10 matching lines...) Expand all Loading... |
51 return SkRef(fProxyShader.get()); | 46 return SkRef(fProxyShader.get()); |
52 } | 47 } |
53 | 48 |
54 SK_TO_STRING_OVERRIDE() | 49 SK_TO_STRING_OVERRIDE() |
55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
56 | 51 |
57 protected: | 52 protected: |
58 void flatten(SkWriteBuffer&) const override; | 53 void flatten(SkWriteBuffer&) const override; |
59 Context* onCreateContext(const ContextRec&, void*) const override; | 54 Context* onCreateContext(const ContextRec&, void*) const override; |
60 | 55 |
| 56 bool onIsABitmap(SkBitmap* bitmap, SkMatrix* matrix, TileMode* mode) const o
verride { |
| 57 return fProxyShader->isABitmap(bitmap, matrix, mode); |
| 58 } |
| 59 |
61 private: | 60 private: |
62 SkAutoTUnref<SkShader> fProxyShader; | 61 SkAutoTUnref<SkShader> fProxyShader; |
63 | 62 |
64 typedef SkShader INHERITED; | 63 typedef SkShader INHERITED; |
65 }; | 64 }; |
66 | 65 |
67 #endif | 66 #endif |
OLD | NEW |