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

Unified Diff: cc/tiles/mipmap_util.cc

Issue 2105903003: Remove error handling from MipmapUtil and add DCHECKs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fixdrt
Patch Set: rebase 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 d0ffbc9bf8610708622d6d88d2dfdd5fa957809e..e20f9f0405acd1702a81aaeb491fdb87e7168852 100644
--- a/cc/tiles/mipmap_util.cc
+++ b/cc/tiles/mipmap_util.cc
@@ -22,10 +22,10 @@ int MipMapUtil::GetLevelForSize(const gfx::Size& src_size,
int src_width = src_size.width();
int target_height = target_size.height();
int target_width = target_size.width();
- bool target_invalid = target_height == 0 || target_width == 0;
- bool src_invalid = src_height == 0 || src_width == 0;
- if (target_invalid || src_invalid)
- return -1;
+ DCHECK_GT(target_height, 0);
+ DCHECK_GT(target_width, 0);
+ DCHECK_GT(src_width, 0);
+ DCHECK_GT(src_height, 0);
int next_mip_height = src_height;
int next_mip_width = src_width;
@@ -52,8 +52,9 @@ int MipMapUtil::GetLevelForSize(const gfx::Size& src_size,
SkSize MipMapUtil::GetScaleAdjustmentForLevel(const gfx::Size& src_size,
int mip_level) {
- if (src_size.width() == 0 || src_size.height() == 0 || mip_level == -1)
- return SkSize::Make(-1, -1);
+ DCHECK_GT(src_size.width(), 0);
+ DCHECK_GT(src_size.height(), 0);
+ DCHECK_GE(mip_level, 0);
gfx::Size target_size = GetSizeForLevel(src_size, mip_level);
@@ -64,8 +65,9 @@ SkSize MipMapUtil::GetScaleAdjustmentForLevel(const gfx::Size& src_size,
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);
+ DCHECK_GT(src_size.width(), 0);
+ DCHECK_GT(src_size.height(), 0);
+ DCHECK_GE(mip_level, 0);
return gfx::Size(ScaleAxisToMipLevel(src_size.width(), mip_level),
ScaleAxisToMipLevel(src_size.height(), mip_level));
« 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