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

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

Issue 2823973002: GpuImageDecodeCache: Use legacy scaling (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "cc/tiles/gpu_image_decode_cache.h" 5 #include "cc/tiles/gpu_image_decode_cache.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 backing_memory = base::DiscardableMemoryAllocator::GetInstance() 1093 backing_memory = base::DiscardableMemoryAllocator::GetInstance()
1094 ->AllocateLockedDiscardableMemory(image_data->size); 1094 ->AllocateLockedDiscardableMemory(image_data->size);
1095 1095
1096 switch (image_data->mode) { 1096 switch (image_data->mode) {
1097 case DecodedDataMode::CPU: { 1097 case DecodedDataMode::CPU: {
1098 SkImageInfo image_info = CreateImageInfoForDrawImage( 1098 SkImageInfo image_info = CreateImageInfoForDrawImage(
1099 draw_image, image_data->upload_params.fPreScaleMipLevel); 1099 draw_image, image_data->upload_params.fPreScaleMipLevel);
1100 // In order to match GPU scaling quality (which uses mip-maps at high 1100 // In order to match GPU scaling quality (which uses mip-maps at high
1101 // quality), we want to use at most medium filter quality for the 1101 // quality), we want to use at most medium filter quality for the
1102 // scale. 1102 // scale.
1103 SkPixmap image_pixmap(image_info, backing_memory->data(), 1103 SkPixmap image_pixmap(image_info.makeColorSpace(nullptr),
1104 image_info.minRowBytes()); 1104 backing_memory->data(), image_info.minRowBytes());
ccameron 2017/04/17 18:40:03 Ooh, good point.
1105 // Note that scalePixels falls back to readPixels if the sale is 1x, so 1105 // Note that scalePixels falls back to readPixels if the sale is 1x, so
1106 // no need to special case that as an optimization. 1106 // no need to special case that as an optimization.
1107 if (!draw_image.image()->scalePixels( 1107 if (!draw_image.image()->scalePixels(
1108 image_pixmap, CalculateUploadScaleFilterQuality(draw_image), 1108 image_pixmap, CalculateUploadScaleFilterQuality(draw_image),
1109 SkImage::kDisallow_CachingHint)) { 1109 SkImage::kDisallow_CachingHint)) {
1110 DLOG(ERROR) << "scalePixels failed."; 1110 DLOG(ERROR) << "scalePixels failed.";
1111 backing_memory->Unlock(); 1111 backing_memory->Unlock();
1112 backing_memory.reset(); 1112 backing_memory.reset();
1113 } 1113 }
1114 break; 1114 break;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 1339
1340 void GpuImageDecodeCache::OnPurgeMemory() { 1340 void GpuImageDecodeCache::OnPurgeMemory() {
1341 base::AutoLock lock(lock_); 1341 base::AutoLock lock(lock_);
1342 // Temporary changes |memory_state_| to free up cache as much as possible. 1342 // Temporary changes |memory_state_| to free up cache as much as possible.
1343 base::AutoReset<base::MemoryState> reset(&memory_state_, 1343 base::AutoReset<base::MemoryState> reset(&memory_state_,
1344 base::MemoryState::SUSPENDED); 1344 base::MemoryState::SUSPENDED);
1345 EnsureCapacity(0); 1345 EnsureCapacity(0);
1346 } 1346 }
1347 1347
1348 } // namespace cc 1348 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698