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

Unified Diff: cc/tiles/mipmap_util.cc

Issue 2042133002: Add display-resolution caching to GPU IDC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@drt
Patch Set: combine with crrev.com/2103353002 Created 4 years, 6 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/mipmap_util.cc
diff --git a/cc/tiles/mipmap_util.cc b/cc/tiles/mipmap_util.cc
index ad35d8b0cfbd6abf8060a2c34eb7a8aaf2e804d7..d0ffbc9bf8610708622d6d88d2dfdd5fa957809e 100644
--- a/cc/tiles/mipmap_util.cc
+++ b/cc/tiles/mipmap_util.cc
@@ -55,14 +55,22 @@ SkSize MipMapUtil::GetScaleAdjustmentForLevel(const gfx::Size& src_size,
if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1)
return SkSize::Make(-1, -1);
- gfx::Size target_size(ScaleAxisToMipLevel(src_size.width(), mip_level),
- ScaleAxisToMipLevel(src_size.height(), mip_level));
+ gfx::Size target_size = GetSizeForLevel(src_size, mip_level);
return SkSize::Make(
static_cast<float>(target_size.width()) / src_size.width(),
static_cast<float>(target_size.height()) / src_size.height());
}
+gfx::Size MipMapUtil::GetSizeForLevel(const gfx::Size& src_size,
+ int mip_level) {
+ if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1)
+ return gfx::Size(-1, -1);
+
+ return gfx::Size(ScaleAxisToMipLevel(src_size.width(), mip_level),
+ ScaleAxisToMipLevel(src_size.height(), mip_level));
+}
+
SkSize MipMapUtil::GetScaleAdjustmentForSize(const gfx::Size& src_size,
const gfx::Size& target_size) {
int target_mip_level = GetLevelForSize(src_size, target_size);
« 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