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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 if (!buffer.isValid()) { | 91 if (!buffer.isValid()) { |
92 return false; | 92 return false; |
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 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 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 SkImageFilter::Cache* CreateCache() { | 488 SkImageFilter::Cache* CreateCache() { |
489 return SkImageFilter::Cache::Create(kDefaultCacheSize); | 489 return SkImageFilter::Cache::Create(kDefaultCacheSize); |
490 } | 490 } |
491 | 491 |
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 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
| 499 |
498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 500 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | |
500 return cache.get(); | 501 return cache.get(); |
501 } | 502 } |
OLD | NEW |