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

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

Issue 503833002: Reimplement deserialization of SkImageFilter's uniqueID. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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) : INHERITED(cou nt, filters, cropRect) { 45 const CropRect* cropRect,
46 uint32_t uniqueID)
47 : INHERITED(count, filters, cropRect, uniqueID) {
46 SkASSERT(count >= 0); 48 SkASSERT(count >= 0);
47 this->initModes(modes); 49 this->initModes(modes);
48 } 50 }
49 51
50 SkMergeImageFilter::~SkMergeImageFilter() { 52 SkMergeImageFilter::~SkMergeImageFilter() {
51 53
52 if (fModes != SkTCast<uint8_t*>(fStorage)) { 54 if (fModes != SkTCast<uint8_t*>(fStorage)) {
53 sk_free(fModes); 55 sk_free(fModes);
54 } 56 }
55 } 57 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!buffer.readByteArray(modes8.get(), count)) { 121 if (!buffer.readByteArray(modes8.get(), count)) {
120 return NULL; 122 return NULL;
121 } 123 }
122 for (int i = 0; i < count; ++i) { 124 for (int i = 0; i < count; ++i) {
123 modes[i] = (SkXfermode::Mode)modes8[i]; 125 modes[i] = (SkXfermode::Mode)modes8[i];
124 buffer.validate(SkIsValidMode(modes[i])); 126 buffer.validate(SkIsValidMode(modes[i]));
125 } 127 }
126 if (!buffer.isValid()) { 128 if (!buffer.isValid()) {
127 return NULL; 129 return NULL;
128 } 130 }
129 return Create(common.inputs(), count, modes.get(), &common.cropRect()); 131 return Create(common.inputs(), count, modes.get(), &common.cropRect(), c ommon.uniqueID());
130 } 132 }
131 return Create(common.inputs(), count, NULL, &common.cropRect()); 133 return Create(common.inputs(), count, NULL, &common.cropRect(), common.uniqu eID());
132 } 134 }
133 135
134 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const { 136 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
135 this->INHERITED::flatten(buffer); 137 this->INHERITED::flatten(buffer);
136 buffer.writeBool(fModes != NULL); 138 buffer.writeBool(fModes != NULL);
137 if (fModes) { 139 if (fModes) {
138 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0])); 140 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
139 } 141 }
140 } 142 }
141 143
(...skipping 10 matching lines...) Expand all
152 buffer.readByteArray(fModes, size)) { 154 buffer.readByteArray(fModes, size)) {
153 for (int i = 0; i < nbInputs; ++i) { 155 for (int i = 0; i < nbInputs; ++i) {
154 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); 156 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
155 } 157 }
156 } 158 }
157 } else { 159 } else {
158 fModes = 0; 160 fModes = 0;
159 } 161 }
160 } 162 }
161 #endif 163 #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