From 0f2c77f1948d2d5599a162860266bc725e95d370 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 10 Aug 2017 14:08:16 -0700 Subject: [PATCH] Capture fractional pixel coordinates in the bounds of raster cache bitmaps (flutter/engine#3974) The bitmap used to hold a prerolled image in the raster cache must have an integer width/height in pixels. However, the picture used to draw the image may have a non-integer width/height in physical coordinates and thus not completely fill the bitmap. The compositor should only select the subset of the bitmap that reflects the portion filled by the rendered picture. --- engine/src/flutter/flow/raster_cache.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/flow/raster_cache.cc b/engine/src/flutter/flow/raster_cache.cc index 8a805e6d59..0653519d1a 100644 --- a/engine/src/flutter/flow/raster_cache.cc +++ b/engine/src/flutter/flow/raster_cache.cc @@ -79,12 +79,12 @@ RasterCacheResult RasterizePicture(SkPicture* picture, const SkRect logical_rect = picture->cullRect(); const SkRect physical_rect = - SkRect::MakeWH(std::ceil(std::fabs(logical_rect.width() * scale.x())), - std::ceil(std::fabs(logical_rect.height() * scale.y()))); + SkRect::MakeWH(std::fabs(logical_rect.width() * scale.x()), + std::fabs(logical_rect.height() * scale.y())); const SkImageInfo image_info = - SkImageInfo::MakeN32Premul(physical_rect.width(), // physical width - physical_rect.height(), // physical height + SkImageInfo::MakeN32Premul(std::ceil(physical_rect.width()), // physical width + std::ceil(physical_rect.height()), // physical height sk_ref_sp(dst_color_space) // colorspace );