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 16 matching lines...) Expand all Loading... |
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(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL); |
35 virtual ~SkComposeShader(); | 35 virtual ~SkComposeShader(); |
36 | 36 |
37 virtual bool validContext(const ContextRec&, SkMatrix* totalInverse = NULL)
const SK_OVERRIDE; | |
38 virtual SkShader::Context* createContext(const ContextRec&, void*) const SK_
OVERRIDE; | |
39 virtual size_t contextSize() const SK_OVERRIDE; | 37 virtual size_t contextSize() const SK_OVERRIDE; |
40 | 38 |
41 class ComposeShaderContext : public SkShader::Context { | 39 class ComposeShaderContext : public SkShader::Context { |
42 public: | 40 public: |
43 // When this object gets destroyed, it will call contextA and contextB's
destructor | 41 // When this object gets destroyed, it will call contextA and contextB's
destructor |
44 // but it will NOT free the memory. | 42 // but it will NOT free the memory. |
45 ComposeShaderContext(const SkComposeShader&, const ContextRec&, | 43 ComposeShaderContext(const SkComposeShader&, const ContextRec&, |
46 SkShader::Context* contextA, SkShader::Context* con
textB); | 44 SkShader::Context* contextA, SkShader::Context* con
textB); |
47 | 45 |
48 SkShader::Context* getShaderContextA() const { return fShaderContextA; } | 46 SkShader::Context* getShaderContextA() const { return fShaderContextA; } |
(...skipping 14 matching lines...) Expand all Loading... |
63 SkShader* getShaderA() { return fShaderA; } | 61 SkShader* getShaderA() { return fShaderA; } |
64 SkShader* getShaderB() { return fShaderB; } | 62 SkShader* getShaderB() { return fShaderB; } |
65 #endif | 63 #endif |
66 | 64 |
67 SK_TO_STRING_OVERRIDE() | 65 SK_TO_STRING_OVERRIDE() |
68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) | 66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
69 | 67 |
70 protected: | 68 protected: |
71 SkComposeShader(SkReadBuffer& ); | 69 SkComposeShader(SkReadBuffer& ); |
72 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 70 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 71 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE
; |
73 | 72 |
74 private: | 73 private: |
75 SkShader* fShaderA; | 74 SkShader* fShaderA; |
76 SkShader* fShaderB; | 75 SkShader* fShaderB; |
77 SkXfermode* fMode; | 76 SkXfermode* fMode; |
78 | 77 |
79 typedef SkShader INHERITED; | 78 typedef SkShader INHERITED; |
80 }; | 79 }; |
81 | 80 |
82 #endif | 81 #endif |
OLD | NEW |