Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::testing::MockRasterCacheResult Class Reference

A RasterCacheResult implementation that represents a cached Layer or DisplayList without the overhead of storage. More...

#include <mock_raster_cache.h>

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

Public Member Functions

 MockRasterCacheResult (SkRect device_rect)
 
void draw (DlCanvas &canvas, const DlPaint *paint=nullptr, bool preserve_rtree=false) const override
 
SkISize image_dimensions () const override
 
int64_t image_bytes () const override
 
- Public Member Functions inherited from flutter::RasterCacheResult
 RasterCacheResult (sk_sp< DlImage > image, const SkRect &logical_rect, const char *type, sk_sp< const DlRTree > rtree=nullptr)
 
virtual ~RasterCacheResult ()=default
 
virtual void draw (DlCanvas &canvas, const DlPaint *paint, bool preserve_rtree) const
 
virtual SkISize image_dimensions () const
 
virtual int64_t image_bytes () const
 

Detailed Description

A RasterCacheResult implementation that represents a cached Layer or DisplayList without the overhead of storage.

This implementation is used by MockRasterCache only for testing proper usage of the RasterCache in layer unit tests.

Definition at line 28 of file mock_raster_cache.h.

Constructor & Destructor Documentation

◆ MockRasterCacheResult()

flutter::testing::MockRasterCacheResult::MockRasterCacheResult ( SkRect  device_rect)
explicit

Definition at line 16 of file mock_raster_cache.cc.

17 : RasterCacheResult(nullptr, SkRect::MakeEmpty(), "RasterCacheFlow::test"),
18 device_rect_(device_rect) {}
RasterCacheResult(sk_sp< DlImage > image, const SkRect &logical_rect, const char *type, sk_sp< const DlRTree > rtree=nullptr)
Definition: raster_cache.cc:29
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595

Member Function Documentation

◆ draw()

void flutter::testing::MockRasterCacheResult::draw ( DlCanvas canvas,
const DlPaint paint = nullptr,
bool  preserve_rtree = false 
) const
inlineoverridevirtual

Reimplemented from flutter::RasterCacheResult.

Definition at line 32 of file mock_raster_cache.h.

34 {};

◆ image_bytes()

int64_t flutter::testing::MockRasterCacheResult::image_bytes ( ) const
inlineoverridevirtual

Reimplemented from flutter::RasterCacheResult.

Definition at line 40 of file mock_raster_cache.h.

40 {
41 return image_dimensions().area() *
43 }
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
Definition: SkImageInfo.cpp:16
SkISize image_dimensions() const override
constexpr int64_t area() const
Definition: SkSize.h:39

◆ image_dimensions()

SkISize flutter::testing::MockRasterCacheResult::image_dimensions ( ) const
inlineoverridevirtual

Reimplemented from flutter::RasterCacheResult.

Definition at line 36 of file mock_raster_cache.h.

36 {
37 return SkSize::Make(device_rect_.width(), device_rect_.height()).toCeil();
38 };
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762
static constexpr SkSize Make(SkScalar w, SkScalar h)
Definition: SkSize.h:56
SkISize toCeil() const
Definition: SkSize.h:83

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