| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 GradientType asAGradient(GradientInfo* info) const override { | 31 GradientType asAGradient(GradientInfo* info) const override { |
| 32 return fProxyShader->asAGradient(info); | 32 return fProxyShader->asAGradient(info); |
| 33 } | 33 } |
| 34 | 34 |
| 35 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
| 36 | 36 |
| 37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, | 37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, |
| 38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, | 38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, |
| 39 GrColor* grColor, GrShaderDataManager* shad
erDataManager, | 39 GrColor* grColor, GrProcessorDataManager* p
rocDataManager, |
| 40 GrFragmentProcessor** fp) const override { | 40 GrFragmentProcessor** fp) const override { |
| 41 SkMatrix tmp = this->getLocalMatrix(); | 41 SkMatrix tmp = this->getLocalMatrix(); |
| 42 if (localMatrix) { | 42 if (localMatrix) { |
| 43 tmp.preConcat(*localMatrix); | 43 tmp.preConcat(*localMatrix); |
| 44 } | 44 } |
| 45 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, | 45 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, |
| 46 shaderDataManager, fp); | 46 procDataManager, fp); |
| 47 } | 47 } |
| 48 | 48 |
| 49 #else | 49 #else |
| 50 | 50 |
| 51 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, | 51 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, |
| 52 const SkMatrix*, GrColor*, GrShaderDataMana
ger*, | 52 const SkMatrix*, GrColor*, GrProcessorDataM
anager*, |
| 53 GrFragmentProcessor**) const override { | 53 GrFragmentProcessor**) const override { |
| 54 SkDEBUGFAIL("Should not call in GPU-less build"); | 54 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 60 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
| 61 if (localMatrix) { | 61 if (localMatrix) { |
| 62 *localMatrix = this->getLocalMatrix(); | 62 *localMatrix = this->getLocalMatrix(); |
| 63 } | 63 } |
| 64 return SkRef(fProxyShader.get()); | 64 return SkRef(fProxyShader.get()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 SK_TO_STRING_OVERRIDE() | 67 SK_TO_STRING_OVERRIDE() |
| 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 void flatten(SkWriteBuffer&) const override; | 71 void flatten(SkWriteBuffer&) const override; |
| 72 Context* onCreateContext(const ContextRec&, void*) const override; | 72 Context* onCreateContext(const ContextRec&, void*) const override; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 SkAutoTUnref<SkShader> fProxyShader; | 75 SkAutoTUnref<SkShader> fProxyShader; |
| 76 | 76 |
| 77 typedef SkShader INHERITED; | 77 typedef SkShader INHERITED; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif | 80 #endif |
| OLD | NEW |