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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (buffer.isVersionLT(SkReadBuffer::kImageFilterUniqueID_Version)) { | 103 if (buffer.isVersionLT(SkReadBuffer::kImageFilterUniqueID_Version)) { |
104 fUniqueID = next_image_filter_unique_id(); | 104 fUniqueID = next_image_filter_unique_id(); |
105 } else { | 105 } else { |
106 fUniqueID = buffer.readUInt(); | 106 fUniqueID = buffer.readUInt(); |
107 } | 107 } |
108 return buffer.isValid(); | 108 return buffer.isValid(); |
109 } | 109 } |
110 | 110 |
111 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 111 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
112 | 112 |
113 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
ect* cropRect) | 113 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
ect* cropRect, uint32_t uniqueID) |
114 : fInputCount(inputCount), | 114 : fInputCount(inputCount), |
115 fInputs(new SkImageFilter*[inputCount]), | 115 fInputs(new SkImageFilter*[inputCount]), |
116 fUsesSrcInput(false), | 116 fUsesSrcInput(false), |
117 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)), | 117 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)), |
118 fUniqueID(next_image_filter_unique_id()) { | 118 fUniqueID(uniqueID ? uniqueID : next_image_filter_unique_id()) { |
119 for (int i = 0; i < inputCount; ++i) { | 119 for (int i = 0; i < inputCount; ++i) { |
120 if (NULL == inputs[i] || inputs[i]->usesSrcInput()) { | 120 if (NULL == inputs[i] || inputs[i]->usesSrcInput()) { |
121 fUsesSrcInput = true; | 121 fUsesSrcInput = true; |
122 } | 122 } |
123 fInputs[i] = inputs[i]; | 123 fInputs[i] = inputs[i]; |
124 SkSafeRef(fInputs[i]); | 124 SkSafeRef(fInputs[i]); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 SkImageFilter::~SkImageFilter() { | 128 SkImageFilter::~SkImageFilter() { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } // namespace | 492 } // namespace |
493 | 493 |
494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { | 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { |
495 return SkNEW_ARGS(CacheImpl, (maxBytes)); | 495 return SkNEW_ARGS(CacheImpl, (maxBytes)); |
496 } | 496 } |
497 | 497 |
498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | 499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
500 return cache.get(); | 500 return cache.get(); |
501 } | 501 } |
OLD | NEW |