OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace cc { | 26 namespace cc { |
27 | 27 |
28 // ImageDecodeControllerKey is a class that gets a cache key out of a given draw | 28 // ImageDecodeControllerKey is a class that gets a cache key out of a given draw |
29 // image. That is, this key uniquely identifies an image in the cache. Note that | 29 // image. That is, this key uniquely identifies an image in the cache. Note that |
30 // it's insufficient to use SkImage's unique id, since the same image can appear | 30 // it's insufficient to use SkImage's unique id, since the same image can appear |
31 // in the cache multiple times at different scales and filter qualities. | 31 // in the cache multiple times at different scales and filter qualities. |
32 class CC_EXPORT ImageDecodeControllerKey { | 32 class CC_EXPORT ImageDecodeControllerKey { |
33 public: | 33 public: |
34 static ImageDecodeControllerKey FromDrawImage(const DrawImage& image); | 34 static ImageDecodeControllerKey FromDrawImage(const DrawImage& image); |
35 | 35 |
| 36 ImageDecodeControllerKey(const ImageDecodeControllerKey& other); |
| 37 |
36 bool operator==(const ImageDecodeControllerKey& other) const { | 38 bool operator==(const ImageDecodeControllerKey& other) const { |
37 // The image_id always has to be the same. However, after that all original | 39 // The image_id always has to be the same. However, after that all original |
38 // decodes are the same, so if we can use the original decode, return true. | 40 // decodes are the same, so if we can use the original decode, return true. |
39 // If not, then we have to compare every field. | 41 // If not, then we have to compare every field. |
40 return image_id_ == other.image_id_ && | 42 return image_id_ == other.image_id_ && |
41 can_use_original_decode_ == other.can_use_original_decode_ && | 43 can_use_original_decode_ == other.can_use_original_decode_ && |
42 (can_use_original_decode_ || | 44 (can_use_original_decode_ || |
43 (src_rect_ == other.src_rect_ && | 45 (src_rect_ == other.src_rect_ && |
44 target_size_ == other.target_size_ && | 46 target_size_ == other.target_size_ && |
45 filter_quality_ == other.filter_quality_)); | 47 filter_quality_ == other.filter_quality_)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // image the first time we see it. This mimics the previous behavior and | 224 // image the first time we see it. This mimics the previous behavior and |
223 // should over time change as the compositor starts to handle more cases. | 225 // should over time change as the compositor starts to handle more cases. |
224 std::unordered_set<uint32_t> prerolled_images_; | 226 std::unordered_set<uint32_t> prerolled_images_; |
225 | 227 |
226 ResourceFormat format_; | 228 ResourceFormat format_; |
227 }; | 229 }; |
228 | 230 |
229 } // namespace cc | 231 } // namespace cc |
230 | 232 |
231 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 233 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
OLD | NEW |