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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 } | 94 } |
95 SkRect rect; | 95 SkRect rect; |
96 buffer.readRect(&rect); | 96 buffer.readRect(&rect); |
97 if (!buffer.isValid() || !buffer.validate(SkIsValidRect(rect))) { | 97 if (!buffer.isValid() || !buffer.validate(SkIsValidRect(rect))) { |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 uint32_t flags = buffer.readUInt(); | 101 uint32_t flags = buffer.readUInt(); |
102 fCropRect = CropRect(rect, flags); | 102 fCropRect = CropRect(rect, flags); |
103 if (buffer.isVersionLT(SkReadBuffer::kImageFilterUniqueID_Version)) { | 103 fUniqueID = buffer.readUInt(); |
104 fUniqueID = next_image_filter_unique_id(); | |
105 } else { | |
106 fUniqueID = buffer.readUInt(); | |
107 } | |
108 return buffer.isValid(); | 104 return buffer.isValid(); |
109 } | 105 } |
110 | 106 |
111 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 107 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
112 | 108 |
113 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
ect* cropRect, uint32_t uniqueID) | 109 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
ect* cropRect, uint32_t uniqueID) |
114 : fInputCount(inputCount), | 110 : fInputCount(inputCount), |
115 fInputs(new SkImageFilter*[inputCount]), | 111 fInputs(new SkImageFilter*[inputCount]), |
116 fUsesSrcInput(false), | 112 fUsesSrcInput(false), |
117 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)), | 113 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)), |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 488 |
493 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { | 489 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { |
494 return SkNEW_ARGS(CacheImpl, (maxBytes)); | 490 return SkNEW_ARGS(CacheImpl, (maxBytes)); |
495 } | 491 } |
496 | 492 |
497 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | 493 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
498 | 494 |
499 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 495 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
500 return cache.get(); | 496 return cache.get(); |
501 } | 497 } |
OLD | NEW |