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 |