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 of from shader B as its "src". | 27 "dst", and the result of 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 setContext(const SkBitmap&, const SkPaint&, | 37 virtual bool validContext(const SkBitmap&, const SkPaint&, |
38 const SkMatrix&) SK_OVERRIDE; | 38 const SkMatrix&, SkMatrix* totalInverse = NULL) co nst SK_OVERRIDE; |
39 virtual void endContext() SK_OVERRIDE; | 39 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, |
40 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; | 40 const SkMatrix&, void*) const SK_OV ERRIDE; |
41 virtual size_t contextSize() const SK_OVERRIDE; | |
42 | |
43 class ComposeShaderContext : public SkShader::Context { | |
44 public: | |
45 // Takes ownership of contextA and contextB, and calls their destructors . | |
scroggo
2014/04/03 15:35:54
nit: As with the bitmap proc shader/state, I think
Dominik Grewe
2014/04/04 10:59:41
Comment updated.
| |
46 ComposeShaderContext(const SkComposeShader&, const SkBitmap&, | |
47 const SkPaint&, const SkMatrix&, | |
48 SkShader::Context* contextA, SkShader::Context* con textB); | |
49 | |
50 SkShader::Context* getShaderContextA() const { return fShaderContextA; } | |
51 SkShader::Context* getShaderContextB() const { return fShaderContextB; } | |
52 | |
53 virtual ~ComposeShaderContext(); | |
54 | |
55 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE ; | |
56 private: | |
57 SkShader::Context* fShaderContextA; | |
58 SkShader::Context* fShaderContextB; | |
59 | |
60 typedef SkShader::Context INHERITED; | |
61 }; | |
62 | |
63 #if SK_DEBUG | |
64 SkShader* getShaderA() { return fShaderA; } | |
65 SkShader* getShaderB() { return fShaderB; } | |
66 #endif | |
41 | 67 |
42 SK_TO_STRING_OVERRIDE() | 68 SK_TO_STRING_OVERRIDE() |
43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) | 69 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
44 | 70 |
45 protected: | 71 protected: |
46 SkComposeShader(SkReadBuffer& ); | 72 SkComposeShader(SkReadBuffer& ); |
47 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 73 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
48 | 74 |
49 private: | 75 private: |
50 | 76 |
51 SkShader* fShaderA; | 77 SkShader* fShaderA; |
52 SkShader* fShaderB; | 78 SkShader* fShaderB; |
53 SkXfermode* fMode; | 79 SkXfermode* fMode; |
54 | 80 |
81 friend class ComposeImpl; | |
82 | |
55 typedef SkShader INHERITED; | 83 typedef SkShader INHERITED; |
56 }; | 84 }; |
57 | 85 |
58 #endif | 86 #endif |
OLD | NEW |