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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 555643002: cc: Changed ComputeExpansionDelta to never return a delta less than zero (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete unused function Created 6 years, 3 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 | « no previous file | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling.cc
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index 8cb342488e8cc6505f97764a7c7d9eff10be92ae..0d50658061e0ed0e3b015e4d54980d9b9b38fc49 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -823,9 +823,11 @@ int ComputeExpansionDelta(int num_x_edges, int num_y_edges,
int64 c = static_cast<int64>(width) * height - target_area;
// Compute the delta for our edges using the quadratic equation.
- return a == 0 ? -c / b :
- (-b + static_cast<int>(
- std::sqrt(static_cast<int64>(b) * b - 4.0 * a * c))) / (2 * a);
+ int delta =
+ (a == 0) ? -c / b : (-b + static_cast<int>(std::sqrt(
+ static_cast<int64>(b) * b - 4.0 * a * c))) /
+ (2 * a);
+ return std::max(0, delta);
}
} // namespace
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698