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(kInvalidArgument_SkError); | |
reed1
2013/08/21 15:49:24
Should we "reset" ourselves since we're signaling
sugoi1
2013/08/21 16:52:36
I guess it depends if we intend to put error handl
| |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 return true; | 167 return true; |
163 } | 168 } |
164 | 169 |
165 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkIPoint& offse t) const { | 170 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkIPoint& offse t) const { |
166 return false; | 171 return false; |
167 } | 172 } |
168 | 173 |
169 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 174 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
170 return false; | 175 return false; |
171 } | 176 } |
OLD | NEW |