@@ -32,9 +32,11 @@ void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const {
3232 TRACE_EVENT0 (" flutter" , " RasterCacheResult::draw" );
3333 SkAutoCanvasRestore auto_restore (&canvas, true );
3434
35+ SkRect raw_bounds = RasterCacheUtil::GetRawDeviceBounds (
36+ logical_rect_, canvas.getTotalMatrix ());
37+ #ifndef NDEBUG
3538 SkIRect bounds =
3639 RasterCacheUtil::GetDeviceBounds (logical_rect_, canvas.getTotalMatrix ());
37- #ifndef NDEBUG
3840 // The image dimensions should always be larger than the device bounds and
3941 // smaller than the device bounds plus one pixel, at the same time, we must
4042 // introduce epsilon to solve the round-off error. The value of epsilon is
@@ -47,8 +49,8 @@ void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const {
4749#endif
4850 canvas.resetMatrix ();
4951 flow_.Step ();
50- canvas.drawImage (image_, bounds .fLeft , bounds. fTop , SkSamplingOptions () ,
51- paint);
52+ canvas.drawImage (image_, raw_bounds .fLeft , raw_bounds. fRight ,
53+ SkSamplingOptions (), paint);
5254}
5355
5456RasterCache::RasterCache (size_t access_threshold,
@@ -67,6 +69,8 @@ std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(
6769
6870 SkIRect cache_rect =
6971 RasterCacheUtil::GetDeviceBounds (context.logical_rect , context.matrix );
72+ SkRect raw_cache_rect =
73+ RasterCacheUtil::GetRawDeviceBounds (context.logical_rect , context.matrix );
7074 const SkImageInfo image_info =
7175 SkImageInfo::MakeN32Premul (cache_rect.width (), cache_rect.height (),
7276 sk_ref_sp (context.dst_color_space ));
@@ -82,7 +86,7 @@ std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(
8286
8387 SkCanvas* canvas = surface->getCanvas ();
8488 canvas->clear (SK_ColorTRANSPARENT);
85- canvas->translate (-cache_rect .left (), -cache_rect .top ());
89+ canvas->translate (-raw_cache_rect .left (), -raw_cache_rect .top ());
8690 canvas->concat (context.matrix );
8791 draw_function (canvas);
8892
0 commit comments