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

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

Issue 1839833003: Add medium image quality to software predecode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments. Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "cc/tiles/software_image_decode_controller.h" 5 #include "cc/tiles/software_image_decode_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm>
9 #include <functional> 10 #include <functional>
10 11
11 #include "base/format_macros.h" 12 #include "base/format_macros.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/discardable_memory.h" 14 #include "base/memory/discardable_memory.h"
14 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
18 #include "base/trace_event/memory_dump_manager.h" 19 #include "base/trace_event/memory_dump_manager.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 private: 91 private:
91 SoftwareImageDecodeController* controller_; 92 SoftwareImageDecodeController* controller_;
92 SoftwareImageDecodeController::ImageKey image_key_; 93 SoftwareImageDecodeController::ImageKey image_key_;
93 DrawImage image_; 94 DrawImage image_;
94 const ImageDecodeController::TracingInfo tracing_info_; 95 const ImageDecodeController::TracingInfo tracing_info_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(ImageDecodeTaskImpl); 97 DISALLOW_COPY_AND_ASSIGN(ImageDecodeTaskImpl);
97 }; 98 };
98 99
100 // Most images are scaled from the source image's size to the target size.
101 // But in the case of mipmaps, we are scaling from the mip level which is
102 // larger than we need.
103 // This function gets the scale of the mip level which will be used.
104 SkSize GetMipMapScaleAdjustment(const gfx::Size& src_size,
105 const gfx::Size& target_size) {
106 int src_height = src_size.height();
107 int src_width = src_size.width();
108 int target_height = target_size.height();
109 int target_width = target_size.width();
110 if (target_height == 0 || target_width == 0) {
111 return SkSize::Make(-1.f, -1.f);
112 }
113
114 int next_mip_height = src_height;
115 int next_mip_width = src_width;
116 for (int current_mip_level = 0;; current_mip_level++) {
117 int mip_height = next_mip_height;
118 int mip_width = next_mip_width;
119
120 next_mip_height = std::max(1, src_height / (1 << (current_mip_level + 1)));
121 next_mip_width = std::max(1, src_width / (1 << (current_mip_level + 1)));
122
123 // Check if an axis on the next mip level would be smaller than the target.
124 // If so, use the current mip level.
125 // This effectively always uses the larger image and always scales down.
126 if (next_mip_height < target_height || next_mip_width < target_width) {
127 SkScalar y_scale = static_cast<float>(mip_height) / src_height;
128 SkScalar x_scale = static_cast<float>(mip_width) / src_width;
129
130 return SkSize::Make(x_scale, y_scale);
131 }
132
133 if (mip_height == 1 && mip_width == 1) {
134 // We have reached the final mip level
135 if (target_height == 1 && target_width == 1) {
vmpstr 2016/05/02 23:13:16 nit: don't need this if anymore
cblume 2016/05/02 23:35:14 Wait, I think we might, right? This isn't for 1.0x
vmpstr 2016/05/02 23:39:06 Right, it has to be 1x1 here, since if it's > then
cblume 2016/05/02 23:59:20 Done.
136 SkScalar y_scale = static_cast<float>(mip_height) / src_height;
137 SkScalar x_scale = static_cast<float>(mip_width) / src_width;
138
139 return SkSize::Make(x_scale, y_scale);
140 }
141
142 break;
143 }
144 }
145
146 NOTREACHED();
147 return SkSize::Make(-1.f, -1.f);
148 }
149
99 SkSize GetScaleAdjustment(const ImageDecodeControllerKey& key) { 150 SkSize GetScaleAdjustment(const ImageDecodeControllerKey& key) {
100 // If the requested filter quality did not require scale, then the adjustment 151 // If the requested filter quality did not require scale, then the adjustment
101 // is identity. 152 // is identity.
102 if (key.can_use_original_decode()) 153 if (key.can_use_original_decode()) {
103 return SkSize::Make(1.f, 1.f); 154 return SkSize::Make(1.f, 1.f);
104 155 } else if (key.filter_quality() == kMedium_SkFilterQuality) {
105 float x_scale = 156 return GetMipMapScaleAdjustment(key.src_rect().size(), key.target_size());
106 key.target_size().width() / static_cast<float>(key.src_rect().width()); 157 } else {
107 float y_scale = 158 float x_scale =
108 key.target_size().height() / static_cast<float>(key.src_rect().height()); 159 key.target_size().width() / static_cast<float>(key.src_rect().width());
109 return SkSize::Make(x_scale, y_scale); 160 float y_scale = key.target_size().height() /
161 static_cast<float>(key.src_rect().height());
162 return SkSize::Make(x_scale, y_scale);
163 }
110 } 164 }
111 165
112 SkFilterQuality GetDecodedFilterQuality(const ImageDecodeControllerKey& key) { 166 SkFilterQuality GetDecodedFilterQuality(const ImageDecodeControllerKey& key) {
113 return std::min(key.filter_quality(), kLow_SkFilterQuality); 167 return std::min(key.filter_quality(), kLow_SkFilterQuality);
114 } 168 }
115 169
116 SkImageInfo CreateImageInfo(size_t width, 170 SkImageInfo CreateImageInfo(size_t width,
117 size_t height, 171 size_t height,
118 ResourceFormat format) { 172 ResourceFormat format) {
119 return SkImageInfo::Make(width, height, 173 return SkImageInfo::Make(width, height,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 "SoftwareImageDecodeController::GetTaskForImageAndRef", "key", 235 "SoftwareImageDecodeController::GetTaskForImageAndRef", "key",
182 key.ToString()); 236 key.ToString());
183 237
184 // If the target size is empty, we can skip this image during draw (and thus 238 // If the target size is empty, we can skip this image during draw (and thus
185 // we don't need to decode it or ref it). 239 // we don't need to decode it or ref it).
186 if (key.target_size().IsEmpty()) { 240 if (key.target_size().IsEmpty()) {
187 *task = nullptr; 241 *task = nullptr;
188 return false; 242 return false;
189 } 243 }
190 244
191 // If we're not going to do a scale, we will just create a task to preroll the
192 // image the first time we see it. This doesn't need to account for memory.
193 // TODO(vmpstr): We can also lock the original sized image, in which case it
194 // does require memory bookkeeping.
195 if (!CanHandleImage(key)) {
196 base::AutoLock lock(lock_);
197 if (prerolled_images_.count(key.image_id()) == 0) {
198 scoped_refptr<TileTask>& existing_task = pending_image_tasks_[key];
199 if (!existing_task) {
200 existing_task = make_scoped_refptr(
201 new ImageDecodeTaskImpl(this, key, image, tracing_info));
202 }
203 *task = existing_task;
204 } else {
205 *task = nullptr;
206 }
207 return false;
208 }
209
210 base::AutoLock lock(lock_); 245 base::AutoLock lock(lock_);
211 246
212 // If we already have the image in cache, then we can return it. 247 // If we already have the image in cache, then we can return it.
213 auto decoded_it = decoded_images_.Get(key); 248 auto decoded_it = decoded_images_.Get(key);
214 bool new_image_fits_in_memory = 249 bool new_image_fits_in_memory =
215 locked_images_budget_.AvailableMemoryBytes() >= key.locked_bytes(); 250 locked_images_budget_.AvailableMemoryBytes() >= key.locked_bytes();
216 if (decoded_it != decoded_images_.end()) { 251 if (decoded_it != decoded_images_.end()) {
217 bool image_was_locked = decoded_it->second->is_locked(); 252 bool image_was_locked = decoded_it->second->is_locked();
218 if (image_was_locked || 253 if (image_was_locked ||
219 (new_image_fits_in_memory && decoded_it->second->Lock())) { 254 (new_image_fits_in_memory && decoded_it->second->Lock())) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 317 }
283 318
284 void SoftwareImageDecodeController::UnrefImage(const DrawImage& image) { 319 void SoftwareImageDecodeController::UnrefImage(const DrawImage& image) {
285 // When we unref the image, there are several situations we need to consider: 320 // When we unref the image, there are several situations we need to consider:
286 // 1. The ref did not reach 0, which means we have to keep the image locked. 321 // 1. The ref did not reach 0, which means we have to keep the image locked.
287 // 2. The ref reached 0, we should unlock it. 322 // 2. The ref reached 0, we should unlock it.
288 // 2a. The image isn't in the locked cache because we didn't get to decode 323 // 2a. The image isn't in the locked cache because we didn't get to decode
289 // it yet (or failed to decode it). 324 // it yet (or failed to decode it).
290 // 2b. Unlock the image but keep it in list. 325 // 2b. Unlock the image but keep it in list.
291 const ImageKey& key = ImageKey::FromDrawImage(image); 326 const ImageKey& key = ImageKey::FromDrawImage(image);
292 DCHECK(CanHandleImage(key)) << key.ToString();
293 TRACE_EVENT1("disabled-by-default-cc.debug", 327 TRACE_EVENT1("disabled-by-default-cc.debug",
294 "SoftwareImageDecodeController::UnrefImage", "key", 328 "SoftwareImageDecodeController::UnrefImage", "key",
295 key.ToString()); 329 key.ToString());
296 330
297 base::AutoLock lock(lock_); 331 base::AutoLock lock(lock_);
298 auto ref_count_it = decoded_images_ref_counts_.find(key); 332 auto ref_count_it = decoded_images_ref_counts_.find(key);
299 DCHECK(ref_count_it != decoded_images_ref_counts_.end()); 333 DCHECK(ref_count_it != decoded_images_ref_counts_.end());
300 334
301 --ref_count_it->second; 335 --ref_count_it->second;
302 if (ref_count_it->second == 0) { 336 if (ref_count_it->second == 0) {
(...skipping 10 matching lines...) Expand all
313 DCHECK(decoded_image_it->second->is_locked()); 347 DCHECK(decoded_image_it->second->is_locked());
314 decoded_image_it->second->Unlock(); 348 decoded_image_it->second->Unlock();
315 } 349 }
316 SanityCheckState(__LINE__, true); 350 SanityCheckState(__LINE__, true);
317 } 351 }
318 352
319 void SoftwareImageDecodeController::DecodeImage(const ImageKey& key, 353 void SoftwareImageDecodeController::DecodeImage(const ImageKey& key,
320 const DrawImage& image) { 354 const DrawImage& image) {
321 TRACE_EVENT1("cc", "SoftwareImageDecodeController::DecodeImage", "key", 355 TRACE_EVENT1("cc", "SoftwareImageDecodeController::DecodeImage", "key",
322 key.ToString()); 356 key.ToString());
323 if (!CanHandleImage(key)) {
324 image.image()->preroll();
325
326 base::AutoLock lock(lock_);
327 prerolled_images_.insert(key.image_id());
328 // Erase the pending task from the queue, since the task won't be doing
329 // anything useful after this function terminates. Since we don't preroll
330 // images twice, this is actually not necessary but it behaves similar to
331 // the other code path: when this function finishes, the task isn't in the
332 // pending_image_tasks_ list.
333 pending_image_tasks_.erase(key);
334 return;
335 }
336
337 base::AutoLock lock(lock_); 357 base::AutoLock lock(lock_);
338 AutoRemoveKeyFromTaskMap remove_key_from_task_map(&pending_image_tasks_, key); 358 AutoRemoveKeyFromTaskMap remove_key_from_task_map(&pending_image_tasks_, key);
339 359
340 // We could have finished all of the raster tasks (cancelled) while the task 360 // We could have finished all of the raster tasks (cancelled) while the task
341 // was just starting to run. Since this task already started running, it 361 // was just starting to run. Since this task already started running, it
342 // wasn't cancelled. So, if the ref count for the image is 0 then we can just 362 // wasn't cancelled. So, if the ref count for the image is 0 then we can just
343 // abort. 363 // abort.
344 if (decoded_images_ref_counts_.find(key) == 364 if (decoded_images_ref_counts_.find(key) ==
345 decoded_images_ref_counts_.end()) { 365 decoded_images_ref_counts_.end()) {
346 return; 366 return;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 key.ToString()); 418 key.ToString());
399 sk_sp<const SkImage> image = draw_image.image(); 419 sk_sp<const SkImage> image = draw_image.image();
400 if (!image) 420 if (!image)
401 return nullptr; 421 return nullptr;
402 422
403 switch (key.filter_quality()) { 423 switch (key.filter_quality()) {
404 case kNone_SkFilterQuality: 424 case kNone_SkFilterQuality:
405 case kLow_SkFilterQuality: 425 case kLow_SkFilterQuality:
406 return GetOriginalImageDecode(key, std::move(image)); 426 return GetOriginalImageDecode(key, std::move(image));
407 case kMedium_SkFilterQuality: 427 case kMedium_SkFilterQuality:
408 NOTIMPLEMENTED();
409 return nullptr;
410 case kHigh_SkFilterQuality: 428 case kHigh_SkFilterQuality:
411 return GetScaledImageDecode(key, std::move(image)); 429 return GetScaledImageDecode(key, std::move(image));
412 default: 430 default:
413 NOTREACHED(); 431 NOTREACHED();
414 return nullptr; 432 return nullptr;
415 } 433 }
416 } 434 }
417 435
418 DecodedDrawImage SoftwareImageDecodeController::GetDecodedImageForDraw( 436 DecodedDrawImage SoftwareImageDecodeController::GetDecodedImageForDraw(
419 const DrawImage& draw_image) { 437 const DrawImage& draw_image) {
420 ImageKey key = ImageKey::FromDrawImage(draw_image); 438 ImageKey key = ImageKey::FromDrawImage(draw_image);
421 TRACE_EVENT1("disabled-by-default-cc.debug", 439 TRACE_EVENT1("disabled-by-default-cc.debug",
422 "SoftwareImageDecodeController::GetDecodedImageForDraw", "key", 440 "SoftwareImageDecodeController::GetDecodedImageForDraw", "key",
423 key.ToString()); 441 key.ToString());
424 // If the target size is empty, we can skip this image draw. 442 // If the target size is empty, we can skip this image draw.
425 if (key.target_size().IsEmpty()) 443 if (key.target_size().IsEmpty())
426 return DecodedDrawImage(nullptr, kNone_SkFilterQuality); 444 return DecodedDrawImage(nullptr, kNone_SkFilterQuality);
427 445
428 if (!CanHandleImage(key))
429 return DecodedDrawImage(draw_image.image(), draw_image.filter_quality());
430
431 return GetDecodedImageForDrawInternal(key, draw_image); 446 return GetDecodedImageForDrawInternal(key, draw_image);
432 } 447 }
433 448
434 DecodedDrawImage SoftwareImageDecodeController::GetDecodedImageForDrawInternal( 449 DecodedDrawImage SoftwareImageDecodeController::GetDecodedImageForDrawInternal(
435 const ImageKey& key, 450 const ImageKey& key,
436 const DrawImage& draw_image) { 451 const DrawImage& draw_image) {
437 TRACE_EVENT1("disabled-by-default-cc.debug", 452 TRACE_EVENT1("disabled-by-default-cc.debug",
438 "SoftwareImageDecodeController::GetDecodedImageForDrawInternal", 453 "SoftwareImageDecodeController::GetDecodedImageForDrawInternal",
439 "key", key.ToString()); 454 "key", key.ToString());
440 base::AutoLock lock(lock_); 455 base::AutoLock lock(lock_);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 { 613 {
599 TRACE_EVENT0( 614 TRACE_EVENT0(
600 "disabled-by-default-cc.debug", 615 "disabled-by-default-cc.debug",
601 "SoftwareImageDecodeController::ScaleImage - allocate scaled pixels"); 616 "SoftwareImageDecodeController::ScaleImage - allocate scaled pixels");
602 scaled_pixels = base::DiscardableMemoryAllocator::GetInstance() 617 scaled_pixels = base::DiscardableMemoryAllocator::GetInstance()
603 ->AllocateLockedDiscardableMemory( 618 ->AllocateLockedDiscardableMemory(
604 scaled_info.minRowBytes() * scaled_info.height()); 619 scaled_info.minRowBytes() * scaled_info.height());
605 } 620 }
606 SkPixmap scaled_pixmap(scaled_info, scaled_pixels->data(), 621 SkPixmap scaled_pixmap(scaled_info, scaled_pixels->data(),
607 scaled_info.minRowBytes()); 622 scaled_info.minRowBytes());
608 // TODO(vmpstr): Start handling more than just high filter quality. 623 DCHECK(key.filter_quality() == kHigh_SkFilterQuality ||
609 DCHECK_EQ(kHigh_SkFilterQuality, key.filter_quality()); 624 key.filter_quality() == kMedium_SkFilterQuality);
610 { 625 {
611 TRACE_EVENT0("disabled-by-default-cc.debug", 626 TRACE_EVENT0("disabled-by-default-cc.debug",
612 "SoftwareImageDecodeController::ScaleImage - scale pixels"); 627 "SoftwareImageDecodeController::ScaleImage - scale pixels");
613 bool result = 628 bool result =
614 decoded_pixmap.scalePixels(scaled_pixmap, key.filter_quality()); 629 decoded_pixmap.scalePixels(scaled_pixmap, key.filter_quality());
615 DCHECK(result) << key.ToString(); 630 DCHECK(result) << key.ToString();
616 } 631 }
617 632
618 // Release the original sized decode. Any other intermediate result to release 633 // Release the original sized decode. Any other intermediate result to release
619 // would be the subrect memory. However, that's in a scoped_ptr and will be 634 // would be the subrect memory. However, that's in a scoped_ptr and will be
620 // deleted automatically when we return. 635 // deleted automatically when we return.
621 DrawWithImageFinished(original_size_draw_image, decoded_draw_image); 636 DrawWithImageFinished(original_size_draw_image, decoded_draw_image);
622 637
623 return base::WrapUnique( 638 return base::WrapUnique(
624 new DecodedImage(scaled_info, std::move(scaled_pixels), 639 new DecodedImage(scaled_info, std::move(scaled_pixels),
625 SkSize::Make(-key.src_rect().x(), -key.src_rect().y()), 640 SkSize::Make(-key.src_rect().x(), -key.src_rect().y()),
626 next_tracing_id_.GetNext())); 641 next_tracing_id_.GetNext()));
627 } 642 }
628 643
629 void SoftwareImageDecodeController::DrawWithImageFinished( 644 void SoftwareImageDecodeController::DrawWithImageFinished(
630 const DrawImage& image, 645 const DrawImage& image,
631 const DecodedDrawImage& decoded_image) { 646 const DecodedDrawImage& decoded_image) {
632 TRACE_EVENT1("disabled-by-default-cc.debug", 647 TRACE_EVENT1("disabled-by-default-cc.debug",
633 "SoftwareImageDecodeController::DrawWithImageFinished", "key", 648 "SoftwareImageDecodeController::DrawWithImageFinished", "key",
634 ImageKey::FromDrawImage(image).ToString()); 649 ImageKey::FromDrawImage(image).ToString());
635 ImageKey key = ImageKey::FromDrawImage(image); 650 ImageKey key = ImageKey::FromDrawImage(image);
636 if (!decoded_image.image() || !CanHandleImage(key)) 651 if (!decoded_image.image())
637 return; 652 return;
638 653
639 if (decoded_image.is_at_raster_decode()) 654 if (decoded_image.is_at_raster_decode())
640 UnrefAtRasterImage(key); 655 UnrefAtRasterImage(key);
641 else 656 else
642 UnrefImage(image); 657 UnrefImage(image);
643 SanityCheckState(__LINE__, false); 658 SanityCheckState(__LINE__, false);
644 } 659 }
645 660
646 void SoftwareImageDecodeController::RefAtRasterImage(const ImageKey& key) { 661 void SoftwareImageDecodeController::RefAtRasterImage(const ImageKey& key) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 DCHECK(decoded_images_ref_counts_.find(key) == 708 DCHECK(decoded_images_ref_counts_.find(key) ==
694 decoded_images_ref_counts_.end()); 709 decoded_images_ref_counts_.end());
695 at_raster_image_it->second->Unlock(); 710 at_raster_image_it->second->Unlock();
696 decoded_images_.Erase(image_it); 711 decoded_images_.Erase(image_it);
697 decoded_images_.Put(key, std::move(at_raster_image_it->second)); 712 decoded_images_.Put(key, std::move(at_raster_image_it->second));
698 } 713 }
699 at_raster_decoded_images_.Erase(at_raster_image_it); 714 at_raster_decoded_images_.Erase(at_raster_image_it);
700 } 715 }
701 } 716 }
702 717
703 bool SoftwareImageDecodeController::CanHandleImage(const ImageKey& key) {
704 // TODO(vmpstr): Start handling medium filter quality as well.
705 return key.filter_quality() != kMedium_SkFilterQuality;
706 }
707
708 void SoftwareImageDecodeController::ReduceCacheUsage() { 718 void SoftwareImageDecodeController::ReduceCacheUsage() {
709 TRACE_EVENT0("cc", "SoftwareImageDecodeController::ReduceCacheUsage"); 719 TRACE_EVENT0("cc", "SoftwareImageDecodeController::ReduceCacheUsage");
710 base::AutoLock lock(lock_); 720 base::AutoLock lock(lock_);
711 size_t num_to_remove = (decoded_images_.size() > kMaxItemsInCache) 721 size_t num_to_remove = (decoded_images_.size() > kMaxItemsInCache)
712 ? (decoded_images_.size() - kMaxItemsInCache) 722 ? (decoded_images_.size() - kMaxItemsInCache)
713 : 0; 723 : 0;
714 for (auto it = decoded_images_.rbegin(); 724 for (auto it = decoded_images_.rbegin();
715 num_to_remove != 0 && it != decoded_images_.rend();) { 725 num_to_remove != 0 && it != decoded_images_.rend();) {
716 if (it->second->is_locked()) { 726 if (it->second->is_locked()) {
717 ++it; 727 ++it;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 bool can_use_original_decode = 859 bool can_use_original_decode =
850 quality == kLow_SkFilterQuality || quality == kNone_SkFilterQuality; 860 quality == kLow_SkFilterQuality || quality == kNone_SkFilterQuality;
851 861
852 // If we're going to use the original decode, then the target size should be 862 // If we're going to use the original decode, then the target size should be
853 // the full image size, since that will allow for proper memory accounting. 863 // the full image size, since that will allow for proper memory accounting.
854 // Note we skip the decode if the target size is empty altogether, so don't 864 // Note we skip the decode if the target size is empty altogether, so don't
855 // update the target size in that case. 865 // update the target size in that case.
856 if (can_use_original_decode && !target_size.IsEmpty()) 866 if (can_use_original_decode && !target_size.IsEmpty())
857 target_size = gfx::Size(image.image()->width(), image.image()->height()); 867 target_size = gfx::Size(image.image()->width(), image.image()->height());
858 868
869 if (quality == kMedium_SkFilterQuality && !target_size.IsEmpty()) {
870 SkSize mip_target_size =
871 GetMipMapScaleAdjustment(src_rect.size(), target_size);
vmpstr 2016/05/02 23:13:16 nit: dcheck mipmap scale != -1?
cblume 2016/05/02 23:35:14 Done.
872 target_size.set_width(src_rect.width() * mip_target_size.width());
873 target_size.set_height(src_rect.height() * mip_target_size.height());
874 }
875
859 return ImageDecodeControllerKey(image.image()->uniqueID(), src_rect, 876 return ImageDecodeControllerKey(image.image()->uniqueID(), src_rect,
860 target_size, quality, 877 target_size, quality,
861 can_use_original_decode); 878 can_use_original_decode);
862 } 879 }
863 880
864 ImageDecodeControllerKey::ImageDecodeControllerKey( 881 ImageDecodeControllerKey::ImageDecodeControllerKey(
865 uint32_t image_id, 882 uint32_t image_id,
866 const gfx::Rect& src_rect, 883 const gfx::Rect& src_rect,
867 const gfx::Size& target_size, 884 const gfx::Size& target_size,
868 SkFilterQuality filter_quality, 885 SkFilterQuality filter_quality,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() { 978 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() {
962 current_usage_bytes_ = 0; 979 current_usage_bytes_ = 0;
963 } 980 }
964 981
965 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe() 982 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe()
966 const { 983 const {
967 return current_usage_bytes_.ValueOrDie(); 984 return current_usage_bytes_.ValueOrDie();
968 } 985 }
969 986
970 } // namespace cc 987 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/software_image_decode_controller.h ('k') | cc/tiles/software_image_decode_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698