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

Side by Side Diff: src/effects/SkMergeImageFilter.cpp

Issue 1019493002: Remove uniqueID from all filter serialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Null out fUniqueID deserialization Created 5 years, 9 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
« no previous file with comments | « src/effects/SkMatrixImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('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 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMergeImageFilter.h" 8 #include "SkMergeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 24 matching lines...) Expand all
35 for (int i = 0; i < inputCount; ++i) { 35 for (int i = 0; i < inputCount; ++i) {
36 fModes[i] = SkToU8(modes[i]); 36 fModes[i] = SkToU8(modes[i]);
37 } 37 }
38 } else { 38 } else {
39 fModes = NULL; 39 fModes = NULL;
40 } 40 }
41 } 41 }
42 42
43 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count, 43 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
44 const SkXfermode::Mode modes[], 44 const SkXfermode::Mode modes[],
45 const CropRect* cropRect, 45 const CropRect* cropRect)
46 uint32_t uniqueID) 46 : INHERITED(count, filters, cropRect) {
47 : INHERITED(count, filters, cropRect, uniqueID) {
48 SkASSERT(count >= 0); 47 SkASSERT(count >= 0);
49 this->initModes(modes); 48 this->initModes(modes);
50 } 49 }
51 50
52 SkMergeImageFilter::~SkMergeImageFilter() { 51 SkMergeImageFilter::~SkMergeImageFilter() {
53 52
54 if (fModes != SkTCast<uint8_t*>(fStorage)) { 53 if (fModes != SkTCast<uint8_t*>(fStorage)) {
55 sk_free(fModes); 54 sk_free(fModes);
56 } 55 }
57 } 56 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (!buffer.readByteArray(modes8.get(), count)) { 120 if (!buffer.readByteArray(modes8.get(), count)) {
122 return NULL; 121 return NULL;
123 } 122 }
124 for (int i = 0; i < count; ++i) { 123 for (int i = 0; i < count; ++i) {
125 modes[i] = (SkXfermode::Mode)modes8[i]; 124 modes[i] = (SkXfermode::Mode)modes8[i];
126 buffer.validate(SkIsValidMode(modes[i])); 125 buffer.validate(SkIsValidMode(modes[i]));
127 } 126 }
128 if (!buffer.isValid()) { 127 if (!buffer.isValid()) {
129 return NULL; 128 return NULL;
130 } 129 }
131 return Create(common.inputs(), count, modes.get(), &common.cropRect(), c ommon.uniqueID()); 130 return Create(common.inputs(), count, modes.get(), &common.cropRect());
132 } 131 }
133 return Create(common.inputs(), count, NULL, &common.cropRect(), common.uniqu eID()); 132 return Create(common.inputs(), count, NULL, &common.cropRect());
134 } 133 }
135 134
136 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const { 135 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
137 this->INHERITED::flatten(buffer); 136 this->INHERITED::flatten(buffer);
138 buffer.writeBool(fModes != NULL); 137 buffer.writeBool(fModes != NULL);
139 if (fModes) { 138 if (fModes) {
140 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0])); 139 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
141 } 140 }
142 } 141 }
143 142
144 #ifndef SK_IGNORE_TO_STRING 143 #ifndef SK_IGNORE_TO_STRING
145 void SkMergeImageFilter::toString(SkString* str) const { 144 void SkMergeImageFilter::toString(SkString* str) const {
146 str->appendf("SkMergeImageFilter: ("); 145 str->appendf("SkMergeImageFilter: (");
147 146
148 for (int i = 0; i < this->countInputs(); ++i) { 147 for (int i = 0; i < this->countInputs(); ++i) {
149 SkImageFilter* filter = this->getInput(i); 148 SkImageFilter* filter = this->getInput(i);
150 str->appendf("%d: (", i); 149 str->appendf("%d: (", i);
151 filter->toString(str); 150 filter->toString(str);
152 str->appendf(")"); 151 str->appendf(")");
153 } 152 }
154 153
155 str->append(")"); 154 str->append(")");
156 } 155 }
157 #endif 156 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMatrixImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698