Chromium Code Reviews| 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 #if SK_SUPPORT_GPU | |
| 16 #include "GrFragmentProcessor.h" | |
| 17 #endif | |
| 18 | |
| 15 class SkLocalMatrixShader : public SkShader { | 19 class SkLocalMatrixShader : public SkShader { |
| 16 public: | 20 public: |
| 17 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) | 21 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) |
| 18 : INHERITED(&localMatrix) | 22 : INHERITED(&localMatrix) |
| 19 , fProxyShader(SkRef(proxy)) | 23 , fProxyShader(SkRef(proxy)) |
| 20 {} | 24 {} |
| 21 | 25 |
| 22 GradientType asAGradient(GradientInfo* info) const override { | 26 GradientType asAGradient(GradientInfo* info) const override { |
| 23 return fProxyShader->asAGradient(info); | 27 return fProxyShader->asAGradient(info); |
| 24 } | 28 } |
| 25 | 29 |
| 26 #if SK_SUPPORT_GPU | 30 #if SK_SUPPORT_GPU |
| 27 const GrFragmentProcessor* asFragmentProcessor( | 31 sk_sp<GrFragmentProcessor> asFragmentProcessor( |
|
bungeman-skia
2016/06/08 18:22:16
If the body of this were out of line, we could jus
| |
| 28 GrContext* context, const SkMatrix& viewM, | 32 GrContext* context, const SkMatrix& viewM, |
| 29 const SkMatrix* localMatrix, SkFilte rQuality fq, | 33 const SkMatrix* localMatrix, SkFilte rQuality fq, |
| 30 SkSourceGammaTreatment gammaTreatmen t) const override { | 34 SkSourceGammaTreatment gammaTreatmen t) const override { |
| 31 SkMatrix tmp = this->getLocalMatrix(); | 35 SkMatrix tmp = this->getLocalMatrix(); |
| 32 if (localMatrix) { | 36 if (localMatrix) { |
| 33 tmp.preConcat(*localMatrix); | 37 tmp.preConcat(*localMatrix); |
| 34 } | 38 } |
| 35 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gamma Treatment); | 39 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gamma Treatment); |
| 36 } | 40 } |
| 37 #endif | 41 #endif |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 58 return fProxyShader->isABitmap(bitmap, matrix, mode); | 62 return fProxyShader->isABitmap(bitmap, matrix, mode); |
| 59 } | 63 } |
| 60 | 64 |
| 61 private: | 65 private: |
| 62 SkAutoTUnref<SkShader> fProxyShader; | 66 SkAutoTUnref<SkShader> fProxyShader; |
| 63 | 67 |
| 64 typedef SkShader INHERITED; | 68 typedef SkShader INHERITED; |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 #endif | 71 #endif |
| OLD | NEW |