Chromium Code Reviews| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // Get the decoded draw image for the given key and draw_image. Note that this | 180 // Get the decoded draw image for the given key and draw_image. Note that this |
| 181 // function has to be called with no lock acquired, since it will acquire its | 181 // function has to be called with no lock acquired, since it will acquire its |
| 182 // own locks and might call DecodeImageInternal above. Also note that this | 182 // own locks and might call DecodeImageInternal above. Also note that this |
| 183 // function will use the provided key, even if | 183 // function will use the provided key, even if |
| 184 // ImageKey::FromDrawImage(draw_image) would return a different key. | 184 // ImageKey::FromDrawImage(draw_image) would return a different key. |
| 185 // Note that when used internally, we still require that | 185 // Note that when used internally, we still require that |
| 186 // DrawWithImageFinished() is called afterwards. | 186 // DrawWithImageFinished() is called afterwards. |
| 187 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, | 187 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, |
| 188 const DrawImage& draw_image); | 188 const DrawImage& draw_image); |
| 189 | 189 |
| 190 struct DecodedImageResult { | |
|
vmpstr
2016/03/31 19:54:32
Can you move types to the top (next to other types
cblume
2016/04/09 06:48:54
Done.
The extra type was just to facilitate the s
| |
| 191 DecodedImageResult(SkPixmap decoded_pixmap, | |
| 192 DrawImage original_size_draw_image, | |
| 193 DecodedDrawImage decoded_draw_image); | |
| 194 | |
| 195 SkPixmap decoded_pixmap_; | |
|
vmpstr
2016/03/31 19:54:32
Typically, struct members that are public are name
cblume
2016/04/09 06:48:54
Done.
| |
| 196 DrawImage original_size_draw_image_; | |
| 197 DecodedDrawImage decoded_draw_image_; | |
| 198 }; | |
| 199 | |
| 200 scoped_ptr<DecodedImage> DecodeImageMediumQuality(const ImageKey& key, | |
|
vmpstr
2016/03/31 19:54:33
Add comments for each of the functions please. Spe
cblume
2016/04/09 06:48:54
Done.
| |
| 201 const SkImage& image); | |
| 202 scoped_ptr<DecodedImage> DecodeImageHighQuality(const ImageKey& key, | |
| 203 const SkImage& image); | |
| 204 | |
| 205 scoped_ptr<DecodedImage> GetOriginalImageDecode(const ImageKey& key, | |
| 206 const SkImage& image); | |
| 207 | |
| 208 DecodedImageResult DecodeImageOrUseCache(const ImageKey& key, | |
|
vmpstr
2016/03/31 19:54:33
This is named somewhat awkwardly. I don't really k
| |
| 209 const SkImage& image); | |
| 210 | |
| 211 scoped_ptr<DecodedImage> ScaleImage( | |
| 212 const ImageKey& key, | |
| 213 const DecodedImageResult& decoded_image_result); | |
| 214 | |
| 190 void SanityCheckState(int line, bool lock_acquired); | 215 void SanityCheckState(int line, bool lock_acquired); |
| 191 void RefImage(const ImageKey& key); | 216 void RefImage(const ImageKey& key); |
| 192 void RefAtRasterImage(const ImageKey& key); | 217 void RefAtRasterImage(const ImageKey& key); |
| 193 void UnrefAtRasterImage(const ImageKey& key); | 218 void UnrefAtRasterImage(const ImageKey& key); |
| 194 | 219 |
| 195 // These functions indicate whether the images can be handled and cached by | 220 // These functions indicate whether the images can be handled and cached by |
| 196 // ImageDecodeController or whether they will fall through to Skia (with | 221 // ImageDecodeController or whether they will fall through to Skia (with |
| 197 // exception of possibly prerolling them). Over time these should return | 222 // exception of possibly prerolling them). Over time these should return |
| 198 // "false" in less cases, as the ImageDecodeController should start handling | 223 // "false" in less cases, as the ImageDecodeController should start handling |
| 199 // more of them. | 224 // more of them. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 224 // image the first time we see it. This mimics the previous behavior and | 249 // image the first time we see it. This mimics the previous behavior and |
| 225 // should over time change as the compositor starts to handle more cases. | 250 // should over time change as the compositor starts to handle more cases. |
| 226 std::unordered_set<uint32_t> prerolled_images_; | 251 std::unordered_set<uint32_t> prerolled_images_; |
| 227 | 252 |
| 228 ResourceFormat format_; | 253 ResourceFormat format_; |
| 229 }; | 254 }; |
| 230 | 255 |
| 231 } // namespace cc | 256 } // namespace cc |
| 232 | 257 |
| 233 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 258 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |