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

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

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | « src/core/SkAnnotation.cpp ('k') | src/pipe/SkGPipePriv.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 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 } 2092 }
2093 if (flatFlags & kHasEffects_FlatFlag) { 2093 if (flatFlags & kHasEffects_FlatFlag) {
2094 buffer.writeFlattenable(this->getPathEffect()); 2094 buffer.writeFlattenable(this->getPathEffect());
2095 buffer.writeFlattenable(this->getShader()); 2095 buffer.writeFlattenable(this->getShader());
2096 buffer.writeFlattenable(this->getXfermode()); 2096 buffer.writeFlattenable(this->getXfermode());
2097 buffer.writeFlattenable(this->getMaskFilter()); 2097 buffer.writeFlattenable(this->getMaskFilter());
2098 buffer.writeFlattenable(this->getColorFilter()); 2098 buffer.writeFlattenable(this->getColorFilter());
2099 buffer.writeFlattenable(this->getRasterizer()); 2099 buffer.writeFlattenable(this->getRasterizer());
2100 buffer.writeFlattenable(this->getLooper()); 2100 buffer.writeFlattenable(this->getLooper());
2101 buffer.writeFlattenable(this->getImageFilter()); 2101 buffer.writeFlattenable(this->getImageFilter());
2102 buffer.writeFlattenable(this->getAnnotation()); 2102
2103 if (fAnnotation) {
2104 buffer.writeBool(true);
2105 fAnnotation->writeToBuffer(buffer);
2106 } else {
2107 buffer.writeBool(false);
2108 }
2103 } 2109 }
2104 #ifdef SK_BUILD_FOR_ANDROID 2110 #ifdef SK_BUILD_FOR_ANDROID
2105 if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) { 2111 if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
2106 this->getPaintOptionsAndroid().flatten(buffer); 2112 this->getPaintOptionsAndroid().flatten(buffer);
2107 } 2113 }
2108 #endif 2114 #endif
2109 } 2115 }
2110 2116
2111 void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) { 2117 void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) {
2112 fPrivFlags = 0; 2118 fPrivFlags = 0;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 2179
2174 if (flatFlags & kHasEffects_FlatFlag) { 2180 if (flatFlags & kHasEffects_FlatFlag) {
2175 SkSafeUnref(this->setPathEffect(buffer.readFlattenableT<SkPathEffect>()) ); 2181 SkSafeUnref(this->setPathEffect(buffer.readFlattenableT<SkPathEffect>()) );
2176 SkSafeUnref(this->setShader(buffer.readFlattenableT<SkShader>())); 2182 SkSafeUnref(this->setShader(buffer.readFlattenableT<SkShader>()));
2177 SkSafeUnref(this->setXfermode(buffer.readFlattenableT<SkXfermode>())); 2183 SkSafeUnref(this->setXfermode(buffer.readFlattenableT<SkXfermode>()));
2178 SkSafeUnref(this->setMaskFilter(buffer.readFlattenableT<SkMaskFilter>()) ); 2184 SkSafeUnref(this->setMaskFilter(buffer.readFlattenableT<SkMaskFilter>()) );
2179 SkSafeUnref(this->setColorFilter(buffer.readFlattenableT<SkColorFilter>( ))); 2185 SkSafeUnref(this->setColorFilter(buffer.readFlattenableT<SkColorFilter>( )));
2180 SkSafeUnref(this->setRasterizer(buffer.readFlattenableT<SkRasterizer>()) ); 2186 SkSafeUnref(this->setRasterizer(buffer.readFlattenableT<SkRasterizer>()) );
2181 SkSafeUnref(this->setLooper(buffer.readFlattenableT<SkDrawLooper>())); 2187 SkSafeUnref(this->setLooper(buffer.readFlattenableT<SkDrawLooper>()));
2182 SkSafeUnref(this->setImageFilter(buffer.readFlattenableT<SkImageFilter>( ))); 2188 SkSafeUnref(this->setImageFilter(buffer.readFlattenableT<SkImageFilter>( )));
2183 SkSafeUnref(this->setAnnotation(buffer.readFlattenableT<SkAnnotation>()) ); 2189
2190 if (buffer.readBool()) {
2191 this->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref();
2192 }
2184 } else { 2193 } else {
2185 this->setPathEffect(NULL); 2194 this->setPathEffect(NULL);
2186 this->setShader(NULL); 2195 this->setShader(NULL);
2187 this->setXfermode(NULL); 2196 this->setXfermode(NULL);
2188 this->setMaskFilter(NULL); 2197 this->setMaskFilter(NULL);
2189 this->setColorFilter(NULL); 2198 this->setColorFilter(NULL);
2190 this->setRasterizer(NULL); 2199 this->setRasterizer(NULL);
2191 this->setLooper(NULL); 2200 this->setLooper(NULL);
2192 this->setImageFilter(NULL); 2201 this->setImageFilter(NULL);
2193 } 2202 }
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 case SkXfermode::kPlus_Mode: 2604 case SkXfermode::kPlus_Mode:
2596 return 0 == this->getAlpha(); 2605 return 0 == this->getAlpha();
2597 case SkXfermode::kDst_Mode: 2606 case SkXfermode::kDst_Mode:
2598 return true; 2607 return true;
2599 default: 2608 default:
2600 break; 2609 break;
2601 } 2610 }
2602 } 2611 }
2603 return false; 2612 return false;
2604 } 2613 }
OLDNEW
« no previous file with comments | « src/core/SkAnnotation.cpp ('k') | src/pipe/SkGPipePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698