OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkComposeShader_DEFINED | 10 #ifndef SkComposeShader_DEFINED |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 /** Create a new compose shader, given shaders A, B, and a combining xfermod
e mode. | 25 /** Create a new compose shader, given shaders A, B, and a combining xfermod
e mode. |
26 When the xfermode is called, it will be given the result from shader A a
s its | 26 When the xfermode is called, it will be given the result from shader A a
s its |
27 "dst", and the result from shader B as its "src". | 27 "dst", and the result from shader B as its "src". |
28 mode->xfer32(sA_result, sB_result, ...) | 28 mode->xfer32(sA_result, sB_result, ...) |
29 @param shaderA The colors from this shader are seen as the "dst" by the
xfermode | 29 @param shaderA The colors from this shader are seen as the "dst" by the
xfermode |
30 @param shaderB The colors from this shader are seen as the "src" by the
xfermode | 30 @param shaderB The colors from this shader are seen as the "src" by the
xfermode |
31 @param mode The xfermode that combines the colors from the two shade
rs. If mode | 31 @param mode The xfermode that combines the colors from the two shade
rs. If mode |
32 is null, then SRC_OVER is assumed. | 32 is null, then SRC_OVER is assumed. |
33 */ | 33 */ |
34 SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL); | 34 SkComposeShader(sk_sp<SkShader> sA, sk_sp<SkShader> sB, SkXfermode* mode = N
ULL); |
35 virtual ~SkComposeShader(); | 35 virtual ~SkComposeShader(); |
36 | 36 |
37 #if SK_SUPPORT_GPU | 37 #if SK_SUPPORT_GPU |
38 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 38 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
39 const SkMatrix& viewM, | 39 const SkMatrix& viewM, |
40 const SkMatrix* localMatrix, | 40 const SkMatrix* localMatrix, |
41 SkFilterQuality) const overr
ide; | 41 SkFilterQuality) const overr
ide; |
42 #endif | 42 #endif |
43 | 43 |
44 class ComposeShaderContext : public SkShader::Context { | 44 class ComposeShaderContext : public SkShader::Context { |
(...skipping 11 matching lines...) Expand all Loading... |
56 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 56 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
57 | 57 |
58 private: | 58 private: |
59 SkShader::Context* fShaderContextA; | 59 SkShader::Context* fShaderContextA; |
60 SkShader::Context* fShaderContextB; | 60 SkShader::Context* fShaderContextB; |
61 | 61 |
62 typedef SkShader::Context INHERITED; | 62 typedef SkShader::Context INHERITED; |
63 }; | 63 }; |
64 | 64 |
65 #ifdef SK_DEBUG | 65 #ifdef SK_DEBUG |
66 SkShader* getShaderA() { return fShaderA; } | 66 SkShader* getShaderA() { return fShaderA.get(); } |
67 SkShader* getShaderB() { return fShaderB; } | 67 SkShader* getShaderB() { return fShaderB.get(); } |
68 #endif | 68 #endif |
69 | 69 |
70 bool asACompose(ComposeRec* rec) const override; | 70 bool asACompose(ComposeRec* rec) const override; |
71 | 71 |
72 SK_TO_STRING_OVERRIDE() | 72 SK_TO_STRING_OVERRIDE() |
73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) | 73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
74 | 74 |
75 protected: | 75 protected: |
76 SkComposeShader(SkReadBuffer& ); | 76 SkComposeShader(SkReadBuffer& ); |
77 void flatten(SkWriteBuffer&) const override; | 77 void flatten(SkWriteBuffer&) const override; |
78 size_t onContextSize(const ContextRec&) const override; | 78 size_t onContextSize(const ContextRec&) const override; |
79 Context* onCreateContext(const ContextRec&, void*) const override; | 79 Context* onCreateContext(const ContextRec&, void*) const override; |
80 | 80 |
81 private: | 81 private: |
82 SkShader* fShaderA; | 82 sk_sp<SkShader> fShaderA; |
83 SkShader* fShaderB; | 83 sk_sp<SkShader> fShaderB; |
84 SkXfermode* fMode; | 84 SkXfermode* fMode; |
85 | 85 |
86 typedef SkShader INHERITED; | 86 typedef SkShader INHERITED; |
87 }; | 87 }; |
88 | 88 |
89 #endif | 89 #endif |
OLD | NEW |