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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Simplified SkRect/SkIRect validity tests 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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkFlattenableBuffers.h" 11 #include "SkFlattenableBuffers.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 #include "SkValidationUtils.h"
13 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
14 #include "GrContext.h" 15 #include "GrContext.h"
15 #include "GrTexture.h" 16 #include "GrTexture.h"
16 #include "SkImageFilterUtils.h" 17 #include "SkImageFilterUtils.h"
17 #endif 18 #endif
18 19
19 SK_DEFINE_INST_COUNT(SkImageFilter) 20 SK_DEFINE_INST_COUNT(SkImageFilter)
20 21
21 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const SkIRe ct* cropRect) 22 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const SkIRe ct* cropRect)
22 : fInputCount(inputCount), 23 : fInputCount(inputCount),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer) 56 SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer)
56 : fInputCount(buffer.readInt()), fInputs(new SkImageFilter*[fInputCount]) { 57 : fInputCount(buffer.readInt()), fInputs(new SkImageFilter*[fInputCount]) {
57 for (int i = 0; i < fInputCount; i++) { 58 for (int i = 0; i < fInputCount; i++) {
58 if (buffer.readBool()) { 59 if (buffer.readBool()) {
59 fInputs[i] = static_cast<SkImageFilter*>(buffer.readFlattenable()); 60 fInputs[i] = static_cast<SkImageFilter*>(buffer.readFlattenable());
60 } else { 61 } else {
61 fInputs[i] = NULL; 62 fInputs[i] = NULL;
62 } 63 }
63 } 64 }
64 buffer.readIRect(&fCropRect); 65 buffer.readIRect(&fCropRect);
66 buffer.validateData(SkIsValidRect(fCropRect));
Stephen White 2013/09/09 17:43:00 Should we also be validating the number of input S
65 } 67 }
66 68
67 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 69 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
68 buffer.writeInt(fInputCount); 70 buffer.writeInt(fInputCount);
69 for (int i = 0; i < fInputCount; i++) { 71 for (int i = 0; i < fInputCount; i++) {
70 SkImageFilter* input = getInput(i); 72 SkImageFilter* input = getInput(i);
71 buffer.writeBool(input != NULL); 73 buffer.writeBool(input != NULL);
72 if (input != NULL) { 74 if (input != NULL) {
73 buffer.writeFlattenable(input); 75 buffer.writeFlattenable(input);
74 } 76 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return true; 175 return true;
174 } 176 }
175 177
176 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons t { 178 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons t {
177 return false; 179 return false;
178 } 180 }
179 181
180 bool SkImageFilter::asColorFilter(SkColorFilter**) const { 182 bool SkImageFilter::asColorFilter(SkColorFilter**) const {
181 return false; 183 return false;
182 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698