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

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

Issue 264793014: guard against self-assignment (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months 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 | « no previous file | no next file » | 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 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 SkSafeUnref(fXfermode); 146 SkSafeUnref(fXfermode);
147 SkSafeUnref(fMaskFilter); 147 SkSafeUnref(fMaskFilter);
148 SkSafeUnref(fColorFilter); 148 SkSafeUnref(fColorFilter);
149 SkSafeUnref(fRasterizer); 149 SkSafeUnref(fRasterizer);
150 SkSafeUnref(fLooper); 150 SkSafeUnref(fLooper);
151 SkSafeUnref(fImageFilter); 151 SkSafeUnref(fImageFilter);
152 SkSafeUnref(fAnnotation); 152 SkSafeUnref(fAnnotation);
153 } 153 }
154 154
155 SkPaint& SkPaint::operator=(const SkPaint& src) { 155 SkPaint& SkPaint::operator=(const SkPaint& src) {
156 if (this == &src) {
157 return *this;
158 }
159
156 #define COPY(field) field = src.field 160 #define COPY(field) field = src.field
157 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field) 161 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field)
158 162
159 SkASSERT(&src); 163 SkASSERT(&src);
160 164
161 REF_COPY(fTypeface); 165 REF_COPY(fTypeface);
162 REF_COPY(fPathEffect); 166 REF_COPY(fPathEffect);
163 REF_COPY(fShader); 167 REF_COPY(fShader);
164 REF_COPY(fXfermode); 168 REF_COPY(fXfermode);
165 REF_COPY(fMaskFilter); 169 REF_COPY(fMaskFilter);
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 } 2731 }
2728 #ifdef SK_BUILD_FOR_ANDROID 2732 #ifdef SK_BUILD_FOR_ANDROID
2729 if (dirty & kPaintOptionsAndroid_DirtyBit) { 2733 if (dirty & kPaintOptionsAndroid_DirtyBit) {
2730 SkPaintOptionsAndroid options; 2734 SkPaintOptionsAndroid options;
2731 options.unflatten(buffer); 2735 options.unflatten(buffer);
2732 paint->setPaintOptionsAndroid(options); 2736 paint->setPaintOptionsAndroid(options);
2733 } 2737 }
2734 #endif 2738 #endif
2735 SkASSERT(dirty == paint->fDirtyBits); 2739 SkASSERT(dirty == paint->fDirtyBits);
2736 } 2740 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698