Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: cc/tiles/software_image_decode_controller.h

Issue 1839833003: Add medium image quality to software predecode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving CLZ to a separate CL. Making changes as per CR comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Get the decoded draw image for the given key and draw_image. Note that this 177 // Get the decoded draw image for the given key and draw_image. Note that this
178 // function has to be called with no lock acquired, since it will acquire its 178 // function has to be called with no lock acquired, since it will acquire its
179 // own locks and might call DecodeImageInternal above. Also note that this 179 // own locks and might call DecodeImageInternal above. Also note that this
180 // function will use the provided key, even if 180 // function will use the provided key, even if
181 // ImageKey::FromDrawImage(draw_image) would return a different key. 181 // ImageKey::FromDrawImage(draw_image) would return a different key.
182 // Note that when used internally, we still require that 182 // Note that when used internally, we still require that
183 // DrawWithImageFinished() is called afterwards. 183 // DrawWithImageFinished() is called afterwards.
184 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, 184 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key,
185 const DrawImage& draw_image); 185 const DrawImage& draw_image);
186 186
187 struct DecodedImageResult {
188 DecodedImageResult(SkPixmap decoded_pixmap,
189 DrawImage original_size_draw_image,
190 DecodedDrawImage decoded_draw_image);
191
192 SkPixmap decoded_pixmap_;
193 DrawImage original_size_draw_image_;
194 DecodedDrawImage decoded_draw_image_;
195 };
196
197 scoped_ptr<DecodedImage> DecodeImageMediumQuality(const ImageKey& key,
198 const SkImage& image);
199 scoped_ptr<DecodedImage> DecodeImageHighQuality(const ImageKey& key,
200 const SkImage& image);
201
202 scoped_ptr<DecodedImage> AttemptToUseOriginalImage(const ImageKey& key,
203 const SkImage& image);
204
205 DecodedImageResult DecodeImageOrUseCache(const ImageKey& key,
206 const SkImage& image);
207
208 scoped_ptr<DecodedImage> ScaleImage(
209 const ImageKey& key,
210 const DecodedImageResult& decoded_image_result);
211
187 void SanityCheckState(int line, bool lock_acquired); 212 void SanityCheckState(int line, bool lock_acquired);
188 void RefImage(const ImageKey& key); 213 void RefImage(const ImageKey& key);
189 void RefAtRasterImage(const ImageKey& key); 214 void RefAtRasterImage(const ImageKey& key);
190 void UnrefAtRasterImage(const ImageKey& key); 215 void UnrefAtRasterImage(const ImageKey& key);
191 216
192 // These functions indicate whether the images can be handled and cached by
193 // ImageDecodeController or whether they will fall through to Skia (with
194 // exception of possibly prerolling them). Over time these should return
195 // "false" in less cases, as the ImageDecodeController should start handling
196 // more of them.
197 bool CanHandleImage(const ImageKey& key);
198
199 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash> 217 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash>
200 pending_image_tasks_; 218 pending_image_tasks_;
201 219
202 // The members below this comment can only be accessed if the lock is held to 220 // The members below this comment can only be accessed if the lock is held to
203 // ensure that they are safe to access on multiple threads. 221 // ensure that they are safe to access on multiple threads.
204 base::Lock lock_; 222 base::Lock lock_;
205 223
206 using ImageMRUCache = 224 using ImageMRUCache =
207 base::HashingMRUCache<ImageKey, scoped_ptr<DecodedImage>, ImageKeyHash>; 225 base::HashingMRUCache<ImageKey, scoped_ptr<DecodedImage>, ImageKeyHash>;
208 226
(...skipping 12 matching lines...) Expand all
221 // image the first time we see it. This mimics the previous behavior and 239 // image the first time we see it. This mimics the previous behavior and
222 // should over time change as the compositor starts to handle more cases. 240 // should over time change as the compositor starts to handle more cases.
223 std::unordered_set<uint32_t> prerolled_images_; 241 std::unordered_set<uint32_t> prerolled_images_;
224 242
225 ResourceFormat format_; 243 ResourceFormat format_;
226 }; 244 };
227 245
228 } // namespace cc 246 } // namespace cc
229 247
230 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 248 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/software_image_decode_controller.cc » ('j') | cc/tiles/software_image_decode_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698