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

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

Issue 2107883003: Revert of Add display-resolution caching to GPU IDC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@drt
Patch Set: Created 4 years, 5 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 | « cc/tiles/mipmap_util.h ('k') | cc/tiles/mipmap_util_unittest.cc » ('j') | 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/mipmap_util.h" 5 #include "cc/tiles/mipmap_util.h"
6 6
7 namespace cc { 7 namespace cc {
8 namespace { 8 namespace {
9 // Calculates the size of |axis_base_size| at the given |mip_level| using 9 // Calculates the size of |axis_base_size| at the given |mip_level| using
10 // OpenGL rounding rules. 10 // OpenGL rounding rules.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return current_mip_level; 48 return current_mip_level;
49 } 49 }
50 } 50 }
51 } 51 }
52 52
53 SkSize MipMapUtil::GetScaleAdjustmentForLevel(const gfx::Size& src_size, 53 SkSize MipMapUtil::GetScaleAdjustmentForLevel(const gfx::Size& src_size,
54 int mip_level) { 54 int mip_level) {
55 if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1) 55 if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1)
56 return SkSize::Make(-1, -1); 56 return SkSize::Make(-1, -1);
57 57
58 gfx::Size target_size = GetSizeForLevel(src_size, mip_level); 58 gfx::Size target_size(ScaleAxisToMipLevel(src_size.width(), mip_level),
59 ScaleAxisToMipLevel(src_size.height(), mip_level));
59 60
60 return SkSize::Make( 61 return SkSize::Make(
61 static_cast<float>(target_size.width()) / src_size.width(), 62 static_cast<float>(target_size.width()) / src_size.width(),
62 static_cast<float>(target_size.height()) / src_size.height()); 63 static_cast<float>(target_size.height()) / src_size.height());
63 } 64 }
64 65
65 gfx::Size MipMapUtil::GetSizeForLevel(const gfx::Size& src_size,
66 int mip_level) {
67 if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1)
68 return gfx::Size(-1, -1);
69
70 return gfx::Size(ScaleAxisToMipLevel(src_size.width(), mip_level),
71 ScaleAxisToMipLevel(src_size.height(), mip_level));
72 }
73
74 SkSize MipMapUtil::GetScaleAdjustmentForSize(const gfx::Size& src_size, 66 SkSize MipMapUtil::GetScaleAdjustmentForSize(const gfx::Size& src_size,
75 const gfx::Size& target_size) { 67 const gfx::Size& target_size) {
76 int target_mip_level = GetLevelForSize(src_size, target_size); 68 int target_mip_level = GetLevelForSize(src_size, target_size);
77 return GetScaleAdjustmentForLevel(src_size, target_mip_level); 69 return GetScaleAdjustmentForLevel(src_size, target_mip_level);
78 } 70 }
79 71
80 } // namespace cc 72 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/mipmap_util.h ('k') | cc/tiles/mipmap_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698