Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: src/core/SkComposeShader.cpp

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkDescriptor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkDescriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698