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 GradientType asAGradient(GradientInfo* info) const override { | 22 GradientType asAGradient(GradientInfo* info) const override { |
23 return fProxyShader->asAGradient(info); | 23 return fProxyShader->asAGradient(info); |
24 } | 24 } |
25 | 25 |
26 #if SK_SUPPORT_GPU | 26 #if SK_SUPPORT_GPU |
27 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 27 const GrFragmentProcessor* asFragmentProcessor( |
28 const SkMatrix* localMatrix, | 28 GrContext* context, const SkMatrix&
viewM, |
29 SkFilterQuality fq) const ove
rride { | 29 const SkMatrix* localMatrix, SkFilte
rQuality fq, |
| 30 SkSourceGammaTreatment gammaTreatmen
t) const override { |
30 SkMatrix tmp = this->getLocalMatrix(); | 31 SkMatrix tmp = this->getLocalMatrix(); |
31 if (localMatrix) { | 32 if (localMatrix) { |
32 tmp.preConcat(*localMatrix); | 33 tmp.preConcat(*localMatrix); |
33 } | 34 } |
34 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq); | 35 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gamma
Treatment); |
35 } | 36 } |
36 #endif | 37 #endif |
37 | 38 |
38 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 39 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
39 if (localMatrix) { | 40 if (localMatrix) { |
40 *localMatrix = this->getLocalMatrix(); | 41 *localMatrix = this->getLocalMatrix(); |
41 } | 42 } |
42 return SkRef(fProxyShader.get()); | 43 return SkRef(fProxyShader.get()); |
43 } | 44 } |
44 | 45 |
(...skipping 12 matching lines...) Expand all Loading... |
57 return fProxyShader->isABitmap(bitmap, matrix, mode); | 58 return fProxyShader->isABitmap(bitmap, matrix, mode); |
58 } | 59 } |
59 | 60 |
60 private: | 61 private: |
61 SkAutoTUnref<SkShader> fProxyShader; | 62 SkAutoTUnref<SkShader> fProxyShader; |
62 | 63 |
63 typedef SkShader INHERITED; | 64 typedef SkShader INHERITED; |
64 }; | 65 }; |
65 | 66 |
66 #endif | 67 #endif |
OLD | NEW |