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 GrFragmentProcessor; | 15 class GrFragmentProcessor; |
16 | 16 |
17 class SkLocalMatrixShader : public SkShader { | 17 class SkLocalMatrixShader : public SkShader { |
18 public: | 18 public: |
19 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) | 19 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) |
20 : INHERITED(&localMatrix) | 20 : INHERITED(&localMatrix) |
21 , fProxyShader(SkRef(proxy)) | 21 , fProxyShader(SkRef(proxy)) |
22 {} | 22 {} |
23 | 23 |
24 GradientType asAGradient(GradientInfo* info) const override { | 24 GradientType asAGradient(GradientInfo* info) const override { |
25 return fProxyShader->asAGradient(info); | 25 return fProxyShader->asAGradient(info); |
26 } | 26 } |
27 | 27 |
28 #if SK_SUPPORT_GPU | 28 #if SK_SUPPORT_GPU |
29 sk_sp<GrFragmentProcessor> asFragmentProcessor( | 29 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const overri
de; |
30 GrContext* context, const SkMatrix&
viewM, | |
31 const SkMatrix* localMatrix, SkFilte
rQuality fq, | |
32 SkSourceGammaTreatment gammaTreatmen
t) const override; | |
33 #endif | 30 #endif |
34 | 31 |
35 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 32 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
36 if (localMatrix) { | 33 if (localMatrix) { |
37 *localMatrix = this->getLocalMatrix(); | 34 *localMatrix = this->getLocalMatrix(); |
38 } | 35 } |
39 return SkRef(fProxyShader.get()); | 36 return SkRef(fProxyShader.get()); |
40 } | 37 } |
41 | 38 |
42 SK_TO_STRING_OVERRIDE() | 39 SK_TO_STRING_OVERRIDE() |
(...skipping 11 matching lines...) Expand all Loading... |
54 return fProxyShader->isABitmap(bitmap, matrix, mode); | 51 return fProxyShader->isABitmap(bitmap, matrix, mode); |
55 } | 52 } |
56 | 53 |
57 private: | 54 private: |
58 SkAutoTUnref<SkShader> fProxyShader; | 55 SkAutoTUnref<SkShader> fProxyShader; |
59 | 56 |
60 typedef SkShader INHERITED; | 57 typedef SkShader INHERITED; |
61 }; | 58 }; |
62 | 59 |
63 #endif | 60 #endif |
OLD | NEW |