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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 SkSafeRef(fInputs[1]); | 46 SkSafeRef(fInputs[1]); |
47 } | 47 } |
48 | 48 |
49 SkImageFilter::~SkImageFilter() { | 49 SkImageFilter::~SkImageFilter() { |
50 for (int i = 0; i < fInputCount; i++) { | 50 for (int i = 0; i < fInputCount; i++) { |
51 SkSafeUnref(fInputs[i]); | 51 SkSafeUnref(fInputs[i]); |
52 } | 52 } |
53 delete[] fInputs; | 53 delete[] fInputs; |
54 } | 54 } |
55 | 55 |
56 SkImageFilter::SkImageFilter(int maxInputCount, SkFlattenableReadBuffer& buffer) { | 56 SkImageFilter::SkImageFilter(int inputCount, SkFlattenableReadBuffer& buffer) { |
57 fInputCount = buffer.readInt(); | 57 fInputCount = buffer.readInt(); |
58 if (buffer.validate((fInputCount >= 0) && (fInputCount <= maxInputCount))) { | 58 if (buffer.validate(((inputCount < 0) && (fInputCount >= 0)) || (fInputCount == inputCount))) { |
Stephen White
2013/12/03 19:10:23
I think this will pass validation if a deserialize
sugoi
2013/12/03 19:21:49
Done.
| |
59 fInputs = new SkImageFilter*[fInputCount]; | 59 fInputs = new SkImageFilter*[fInputCount]; |
60 for (int i = 0; i < fInputCount; i++) { | 60 for (int i = 0; i < fInputCount; i++) { |
61 if (buffer.readBool()) { | 61 if (buffer.readBool()) { |
62 fInputs[i] = buffer.readImageFilter(); | 62 fInputs[i] = buffer.readImageFilter(); |
63 } else { | 63 } else { |
64 fInputs[i] = NULL; | 64 fInputs[i] = NULL; |
65 } | 65 } |
66 } | 66 } |
67 SkRect rect; | 67 SkRect rect; |
68 buffer.readRect(&rect); | 68 buffer.readRect(&rect); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 return true; | 187 return true; |
188 } | 188 } |
189 | 189 |
190 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons t SkIRect&) const { | 190 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons t SkIRect&) const { |
191 return false; | 191 return false; |
192 } | 192 } |
193 | 193 |
194 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 194 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
195 return false; | 195 return false; |
196 } | 196 } |
OLD | NEW |