OLD | NEW |
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 Loading... |
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 ((fCropRect.fLeft > fCropRect.fRight) || |
| 67 (fCropRect.fTop > fCropRect.fBottom)) { |
| 68 buffer.setError(); |
| 69 } |
65 } | 70 } |
66 | 71 |
67 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 72 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
68 buffer.writeInt(fInputCount); | 73 buffer.writeInt(fInputCount); |
69 for (int i = 0; i < fInputCount; i++) { | 74 for (int i = 0; i < fInputCount; i++) { |
70 SkImageFilter* input = getInput(i); | 75 SkImageFilter* input = getInput(i); |
71 buffer.writeBool(input != NULL); | 76 buffer.writeBool(input != NULL); |
72 if (input != NULL) { | 77 if (input != NULL) { |
73 buffer.writeFlattenable(input); | 78 buffer.writeFlattenable(input); |
74 } | 79 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return true; | 178 return true; |
174 } | 179 } |
175 | 180 |
176 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons
t { | 181 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons
t { |
177 return false; | 182 return false; |
178 } | 183 } |
179 | 184 |
180 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 185 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
181 return false; | 186 return false; |
182 } | 187 } |
OLD | NEW |