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 size_t contextSize() const SK_OVERRIDE; | 37 size_t contextSize() const SK_OVERRIDE; |
38 | 38 |
39 class ComposeShaderContext : public SkShader::Context { | 39 class ComposeShaderContext : public SkShader::Context { |
40 public: | 40 public: |
41 // 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 |
42 // but it will NOT free the memory. | 42 // but it will NOT free the memory. |
43 ComposeShaderContext(const SkComposeShader&, const ContextRec&, | 43 ComposeShaderContext(const SkComposeShader&, const ContextRec&, |
44 SkShader::Context* contextA, SkShader::Context* con
textB); | 44 SkShader::Context* contextA, SkShader::Context* con
textB); |
45 | 45 |
46 SkShader::Context* getShaderContextA() const { return fShaderContextA; } | 46 SkShader::Context* getShaderContextA() const { return fShaderContextA; } |
47 SkShader::Context* getShaderContextB() const { return fShaderContextB; } | 47 SkShader::Context* getShaderContextB() const { return fShaderContextB; } |
48 | 48 |
49 virtual ~ComposeShaderContext(); | 49 virtual ~ComposeShaderContext(); |
50 | 50 |
51 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE
; | 51 void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; |
52 | 52 |
53 private: | 53 private: |
54 SkShader::Context* fShaderContextA; | 54 SkShader::Context* fShaderContextA; |
55 SkShader::Context* fShaderContextB; | 55 SkShader::Context* fShaderContextB; |
56 | 56 |
57 typedef SkShader::Context INHERITED; | 57 typedef SkShader::Context INHERITED; |
58 }; | 58 }; |
59 | 59 |
60 #ifdef SK_DEBUG | 60 #ifdef SK_DEBUG |
61 SkShader* getShaderA() { return fShaderA; } | 61 SkShader* getShaderA() { return fShaderA; } |
62 SkShader* getShaderB() { return fShaderB; } | 62 SkShader* getShaderB() { return fShaderB; } |
63 #endif | 63 #endif |
64 | 64 |
65 virtual bool asACompose(ComposeRec* rec) const SK_OVERRIDE; | 65 bool asACompose(ComposeRec* rec) const SK_OVERRIDE; |
66 | 66 |
67 SK_TO_STRING_OVERRIDE() | 67 SK_TO_STRING_OVERRIDE() |
68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
69 | 69 |
70 protected: | 70 protected: |
71 SkComposeShader(SkReadBuffer& ); | 71 SkComposeShader(SkReadBuffer& ); |
72 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 72 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
73 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE
; | 73 Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE; |
74 | 74 |
75 private: | 75 private: |
76 SkShader* fShaderA; | 76 SkShader* fShaderA; |
77 SkShader* fShaderB; | 77 SkShader* fShaderB; |
78 SkXfermode* fMode; | 78 SkXfermode* fMode; |
79 | 79 |
80 typedef SkShader INHERITED; | 80 typedef SkShader INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 #endif | 83 #endif |
OLD | NEW |