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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added ImageFilter derived classes safety checks (retry) Created 7 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 | Annotate | Revision Log
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 buffer.writeBool(fModes != NULL); 150 buffer.writeBool(fModes != NULL);
151 if (fModes) { 151 if (fModes) {
152 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0])); 152 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
153 } 153 }
154 } 154 }
155 155
156 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI TED(buffer) { 156 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI TED(buffer) {
157 bool hasModes = buffer.readBool(); 157 bool hasModes = buffer.readBool();
158 if (hasModes) { 158 if (hasModes) {
159 this->initAllocModes(); 159 this->initAllocModes();
160 SkASSERT(buffer.getArrayCount() == countInputs() * sizeof(fModes[0])); 160 int nbInputs = countInputs();
161 SkASSERT(buffer.getArrayCount() == nbInputs * sizeof(fModes[0]));
161 buffer.readByteArray(fModes); 162 buffer.readByteArray(fModes);
163 for (int i = 0; i < nbInputs; ++i) {
164 buffer.validateData(SkXfermode::IsValidMode((SkXfermode::Mode)fModes [i]));
165 }
162 } else { 166 } else {
163 fModes = 0; 167 fModes = 0;
164 } 168 }
165 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698