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

Unified Diff: cc/playback/pixel_ref_map.cc

Issue 1266103005: cc: Handle overflow/underflow in MathUtil::RoundUp/RoundDown functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small nit. Created 5 years, 4 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/layers/picture_layer_impl.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/pixel_ref_map.cc
diff --git a/cc/playback/pixel_ref_map.cc b/cc/playback/pixel_ref_map.cc
index a5c8f05f453ba592d0f281f803775e6a553b3e78..cf8c93503aad37f5f85b0c2bf04ef3b5038fac6e 100644
--- a/cc/playback/pixel_ref_map.cc
+++ b/cc/playback/pixel_ref_map.cc
@@ -33,14 +33,15 @@ void PixelRefMap::GatherPixelRefsFromPicture(SkPicture* picture) {
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture, &pixel_refs);
for (skia::DiscardablePixelRefList::const_iterator it = pixel_refs.begin();
it != pixel_refs.end(); ++it) {
- gfx::Point min(MathUtil::RoundDown(static_cast<int>(it->pixel_ref_rect.x()),
- cell_size_.width()),
- MathUtil::RoundDown(static_cast<int>(it->pixel_ref_rect.y()),
- cell_size_.height()));
- gfx::Point max(MathUtil::RoundDown(
+ gfx::Point min(
+ MathUtil::UncheckedRoundDown(static_cast<int>(it->pixel_ref_rect.x()),
+ cell_size_.width()),
+ MathUtil::UncheckedRoundDown(static_cast<int>(it->pixel_ref_rect.y()),
+ cell_size_.height()));
+ gfx::Point max(MathUtil::UncheckedRoundDown(
static_cast<int>(std::ceil(it->pixel_ref_rect.right())),
cell_size_.width()),
- MathUtil::RoundDown(
+ MathUtil::UncheckedRoundDown(
static_cast<int>(std::ceil(it->pixel_ref_rect.bottom())),
cell_size_.height()));
@@ -148,12 +149,13 @@ void PixelRefMap::Iterator::PointToFirstPixelRef(const gfx::Rect& rect) {
gfx::Size cell_size(target_pixel_ref_map_->cell_size_);
// We have to find a cell_size aligned point that corresponds to
// query_rect. Point is a multiple of cell_size.
- min_point_ =
- gfx::Point(MathUtil::RoundDown(query_rect.x(), cell_size.width()),
- MathUtil::RoundDown(query_rect.y(), cell_size.height()));
+ min_point_ = gfx::Point(
+ MathUtil::UncheckedRoundDown(query_rect.x(), cell_size.width()),
+ MathUtil::UncheckedRoundDown(query_rect.y(), cell_size.height()));
max_point_ = gfx::Point(
- MathUtil::RoundDown(query_rect.right() - 1, cell_size.width()),
- MathUtil::RoundDown(query_rect.bottom() - 1, cell_size.height()));
+ MathUtil::UncheckedRoundDown(query_rect.right() - 1, cell_size.width()),
+ MathUtil::UncheckedRoundDown(query_rect.bottom() - 1,
+ cell_size.height()));
// Limit the points to known pixel ref boundaries.
min_point_ = gfx::Point(
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698