Chromium Code Reviews| 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" |
| 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 CropR ect* cropRect) | 22 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR ect* cropRect) |
| 22 : fInputCount(inputCount), | 23 : fInputCount(inputCount), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 if (buffer.readBool()) { | 59 if (buffer.readBool()) { |
| 59 fInputs[i] = buffer.readImageFilter(); | 60 fInputs[i] = buffer.readImageFilter(); |
| 60 } else { | 61 } else { |
| 61 fInputs[i] = NULL; | 62 fInputs[i] = NULL; |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 SkRect rect; | 65 SkRect rect; |
| 65 buffer.readRect(&rect); | 66 buffer.readRect(&rect); |
| 66 uint32_t flags = buffer.readUInt(); | 67 uint32_t flags = buffer.readUInt(); |
| 67 fCropRect = CropRect(rect, flags); | 68 fCropRect = CropRect(rect, flags); |
| 69 // Do not use SkIsValidRect() here, since width() and height() are allowed | |
| 70 // to be larger than SK_MaxS32 in this specific case. Check inversion instea d. | |
|
Stephen White
2013/10/16 20:27:24
Actually, this should no longer be the case. The "
sugoi1
2013/10/17 15:20:39
Done.
| |
| 71 buffer.validate(!rect.isInverted()); | |
| 68 } | 72 } |
| 69 | 73 |
| 70 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 74 void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
| 71 buffer.writeInt(fInputCount); | 75 buffer.writeInt(fInputCount); |
| 72 for (int i = 0; i < fInputCount; i++) { | 76 for (int i = 0; i < fInputCount; i++) { |
| 73 SkImageFilter* input = getInput(i); | 77 SkImageFilter* input = getInput(i); |
| 74 buffer.writeBool(input != NULL); | 78 buffer.writeBool(input != NULL); |
| 75 if (input != NULL) { | 79 if (input != NULL) { |
| 76 buffer.writeFlattenable(input); | 80 buffer.writeFlattenable(input); |
| 77 } | 81 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 return true; | 182 return true; |
| 179 } | 183 } |
| 180 | 184 |
| 181 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons t { | 185 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&) cons t { |
| 182 return false; | 186 return false; |
| 183 } | 187 } |
| 184 | 188 |
| 185 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 189 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
| 186 return false; | 190 return false; |
| 187 } | 191 } |
| OLD | NEW |