Skip to content

Commit

Permalink
Capture fractional pixel coordinates in the bounds of raster cache bi…
Browse files Browse the repository at this point in the history
…tmaps (flutter#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.
  • Loading branch information
jason-simmons authored Aug 10, 2017
1 parent 06f6a98 commit a7ae2ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flow/raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down

0 comments on commit a7ae2ab

Please sign in to comment.