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

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: 2nd proposition, with some comments adressed Created 7 years, 4 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"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer) 55 SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer)
56 : fInputCount(buffer.readInt()), fInputs(new SkImageFilter*[fInputCount]) { 56 : fInputCount(buffer.readInt()), fInputs(new SkImageFilter*[fInputCount]) {
57 for (int i = 0; i < fInputCount; i++) { 57 for (int i = 0; i < fInputCount; i++) {
58 if (buffer.readBool()) { 58 if (buffer.readBool()) {
59 fInputs[i] = static_cast<SkImageFilter*>(buffer.readFlattenable()); 59 fInputs[i] = static_cast<SkImageFilter*>(buffer.readFlattenable());
60 } else { 60 } else {
61 fInputs[i] = NULL; 61 fInputs[i] = NULL;
62 } 62 }
63 } 63 }
64 buffer.readIRect(&fCropRect); 64 buffer.readIRect(&fCropRect);
65
66 if (!SkScalarIsFinite(fCropRect.fLeft) ||
reed1 2013/08/22 15:41:14 SkIRect stores ints, so calling isfinite does not
sugoi1 2013/08/22 17:37:02 Oops, fixed.
67 !SkScalarIsFinite(fCropRect.fRight) ||
68 !SkScalarIsFinite(fCropRect.fTop) ||
69 !SkScalarIsFinite(fCropRect.fBottom) ||
70 (fCropRect.fLeft > fCropRect.fRight) ||
71 (fCropRect.fTop > fCropRect.fBottom)) {
sugoi 2013/08/21 20:19:39 Although it's counter intuitive, "top" really has
scroggo 2013/08/21 23:56:00 Depends on which way you think the y-axis should g
72 buffer.setError();
73 }
65 } 74 }
66 75
67 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 76 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
68 buffer.writeInt(fInputCount); 77 buffer.writeInt(fInputCount);
69 for (int i = 0; i < fInputCount; i++) { 78 for (int i = 0; i < fInputCount; i++) {
70 SkImageFilter* input = getInput(i); 79 SkImageFilter* input = getInput(i);
71 buffer.writeBool(input != NULL); 80 buffer.writeBool(input != NULL);
72 if (input != NULL) { 81 if (input != NULL) {
73 buffer.writeFlattenable(input); 82 buffer.writeFlattenable(input);
74 } 83 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return true; 171 return true;
163 } 172 }
164 173
165 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkIPoint& offse t) const { 174 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkIPoint& offse t) const {
166 return false; 175 return false;
167 } 176 }
168 177
169 bool SkImageFilter::asColorFilter(SkColorFilter**) const { 178 bool SkImageFilter::asColorFilter(SkColorFilter**) const {
170 return false; 179 return false;
171 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698