Flutter Engine
flutter::RasterCacheResult Class Reference

#include <raster_cache.h>

Inheritance diagram for flutter::RasterCacheResult:
flutter::testing::MockRasterCacheResult

Public Member Functions

 RasterCacheResult (sk_sp< SkImage > image, const SkRect &logical_rect)
 
virtual ~RasterCacheResult ()=default
 
virtual void draw (SkCanvas &canvas, const SkPaint *paint) const
 
virtual SkISize image_dimensions () const
 
virtual int64_t image_bytes () const
 

Detailed Description

Definition at line 19 of file raster_cache.h.

Constructor & Destructor Documentation

◆ RasterCacheResult()

flutter::RasterCacheResult::RasterCacheResult ( sk_sp< SkImage >  image,
const SkRect &  logical_rect 
)

Definition at line 22 of file raster_cache.cc.

24  : image_(std::move(image)), logical_rect_(logical_rect) {}

◆ ~RasterCacheResult()

virtual flutter::RasterCacheResult::~RasterCacheResult ( )
virtualdefault

Member Function Documentation

◆ draw()

void flutter::RasterCacheResult::draw ( SkCanvas &  canvas,
const SkPaint *  paint 
) const
virtual

Reimplemented in flutter::testing::MockRasterCacheResult.

Definition at line 26 of file raster_cache.cc.

References FML_DCHECK, flutter::RasterCache::GetDeviceBounds(), and TRACE_EVENT0.

26  {
27  TRACE_EVENT0("flutter", "RasterCacheResult::draw");
28  SkAutoCanvasRestore auto_restore(&canvas, true);
29  SkIRect bounds =
30  RasterCache::GetDeviceBounds(logical_rect_, canvas.getTotalMatrix());
31  FML_DCHECK(
32  std::abs(bounds.size().width() - image_->dimensions().width()) <= 1 &&
33  std::abs(bounds.size().height() - image_->dimensions().height()) <= 1);
34  canvas.resetMatrix();
35  canvas.drawImage(image_, bounds.fLeft, bounds.fTop, paint);
36 }
static SkIRect GetDeviceBounds(const SkRect &rect, const SkMatrix &ctm)
Definition: raster_cache.h:98
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ image_bytes()

virtual int64_t flutter::RasterCacheResult::image_bytes ( ) const
inlinevirtual

Reimplemented in flutter::testing::MockRasterCacheResult.

Definition at line 31 of file raster_cache.h.

31  {
32  return image_ ? image_->imageInfo().computeMinByteSize() : 0;
33  };

◆ image_dimensions()

virtual SkISize flutter::RasterCacheResult::image_dimensions ( ) const
inlinevirtual

Reimplemented in flutter::testing::MockRasterCacheResult.

Definition at line 27 of file raster_cache.h.

27  {
28  return image_ ? image_->dimensions() : SkISize::Make(0, 0);
29  };

The documentation for this class was generated from the following files: