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 #include "SkComposeShader.h" | 10 #include "SkComposeShader.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 paint->setAlpha(newAlpha); | 52 paint->setAlpha(newAlpha); |
53 } | 53 } |
54 | 54 |
55 ~SkAutoAlphaRestore() { | 55 ~SkAutoAlphaRestore() { |
56 fPaint->setAlpha(fAlpha); | 56 fPaint->setAlpha(fAlpha); |
57 } | 57 } |
58 private: | 58 private: |
59 SkPaint* fPaint; | 59 SkPaint* fPaint; |
60 uint8_t fAlpha; | 60 uint8_t fAlpha; |
61 }; | 61 }; |
| 62 #define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore) |
62 | 63 |
63 void SkComposeShader::flatten(SkFlattenableWriteBuffer& buffer) const { | 64 void SkComposeShader::flatten(SkFlattenableWriteBuffer& buffer) const { |
64 this->INHERITED::flatten(buffer); | 65 this->INHERITED::flatten(buffer); |
65 buffer.writeFlattenable(fShaderA); | 66 buffer.writeFlattenable(fShaderA); |
66 buffer.writeFlattenable(fShaderB); | 67 buffer.writeFlattenable(fShaderB); |
67 buffer.writeFlattenable(fMode); | 68 buffer.writeFlattenable(fMode); |
68 } | 69 } |
69 | 70 |
70 /* We call setContext on our two worker shaders. However, we | 71 /* We call setContext on our two worker shaders. However, we |
71 always let them see opaque alpha, and if the paint really | 72 always let them see opaque alpha, and if the paint really |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 str->append(" ShaderB: "); | 184 str->append(" ShaderB: "); |
184 fShaderB->toString(str); | 185 fShaderB->toString(str); |
185 str->append(" Xfermode: "); | 186 str->append(" Xfermode: "); |
186 fMode->toString(str); | 187 fMode->toString(str); |
187 | 188 |
188 this->INHERITED::toString(str); | 189 this->INHERITED::toString(str); |
189 | 190 |
190 str->append(")"); | 191 str->append(")"); |
191 } | 192 } |
192 #endif | 193 #endif |
OLD | NEW |