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 15 matching lines...) Expand all Loading... |
26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, | 26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, |
27 TileMode* mode) const override { | 27 TileMode* mode) const override { |
28 return fProxyShader->asABitmap(bitmap, matrix, mode); | 28 return fProxyShader->asABitmap(bitmap, matrix, mode); |
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 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, |
37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, | 37 const SkMatrix* localMatrix, SkFilterQua
lity fq, |
38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, | 38 GrProcessorDataManager* procDataManager)
const override { |
39 GrColor* grColor, GrProcessorDataManager* p
rocDataManager, | |
40 GrFragmentProcessor** fp) const override { | |
41 SkMatrix tmp = this->getLocalMatrix(); | 39 SkMatrix tmp = this->getLocalMatrix(); |
42 if (localMatrix) { | 40 if (localMatrix) { |
43 tmp.preConcat(*localMatrix); | 41 tmp.preConcat(*localMatrix); |
44 } | 42 } |
45 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, | 43 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, procD
ataManager); |
46 procDataManager, fp); | |
47 } | 44 } |
48 | |
49 #else | |
50 | |
51 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, | |
52 const SkMatrix*, GrColor*, GrProcessorDataM
anager*, | |
53 GrFragmentProcessor**) const override { | |
54 SkDEBUGFAIL("Should not call in GPU-less build"); | |
55 return false; | |
56 } | |
57 | |
58 #endif | 45 #endif |
59 | 46 |
60 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 47 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
61 if (localMatrix) { | 48 if (localMatrix) { |
62 *localMatrix = this->getLocalMatrix(); | 49 *localMatrix = this->getLocalMatrix(); |
63 } | 50 } |
64 return SkRef(fProxyShader.get()); | 51 return SkRef(fProxyShader.get()); |
65 } | 52 } |
66 | 53 |
67 SK_TO_STRING_OVERRIDE() | 54 SK_TO_STRING_OVERRIDE() |
68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
69 | 56 |
70 protected: | 57 protected: |
71 void flatten(SkWriteBuffer&) const override; | 58 void flatten(SkWriteBuffer&) const override; |
72 Context* onCreateContext(const ContextRec&, void*) const override; | 59 Context* onCreateContext(const ContextRec&, void*) const override; |
73 | 60 |
74 private: | 61 private: |
75 SkAutoTUnref<SkShader> fProxyShader; | 62 SkAutoTUnref<SkShader> fProxyShader; |
76 | 63 |
77 typedef SkShader INHERITED; | 64 typedef SkShader INHERITED; |
78 }; | 65 }; |
79 | 66 |
80 #endif | 67 #endif |
OLD | NEW |