Flutter Engine
flutter::testing::MockRasterCacheResult Class Reference

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

#include <mock_raster_cache.h>

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

Public Member Functions

 MockRasterCacheResult (SkIRect device_rect)
 
void draw (SkCanvas &canvas, const SkPaint *paint=nullptr) const override
 
SkISize image_dimensions () const override
 
int64_t image_bytes () const override
 
- Public Member Functions inherited from flutter::RasterCacheResult
 RasterCacheResult (sk_sp< SkImage > image, const SkRect &logical_rect)
 
virtual ~RasterCacheResult ()=default
 

Detailed Description

A RasterCacheResult implementation that represents a cached Layer or SkPicture 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 22 of file mock_raster_cache.h.

Constructor & Destructor Documentation

◆ MockRasterCacheResult()

flutter::testing::MockRasterCacheResult::MockRasterCacheResult ( SkIRect  device_rect)

Definition at line 12 of file mock_raster_cache.cc.

13  : RasterCacheResult(nullptr, SkRect::MakeEmpty()),
14  device_rect_(device_rect) {}
RasterCacheResult(sk_sp< SkImage > image, const SkRect &logical_rect)
Definition: raster_cache.cc:22

Member Function Documentation

◆ draw()

void flutter::testing::MockRasterCacheResult::draw ( SkCanvas &  canvas,
const SkPaint *  paint = nullptr 
) const
inlineoverridevirtual

Reimplemented from flutter::RasterCacheResult.

Definition at line 26 of file mock_raster_cache.h.

26 {};

◆ image_bytes()

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

Reimplemented from flutter::RasterCacheResult.

Definition at line 30 of file mock_raster_cache.h.

References image_dimensions().

30  {
31  return image_dimensions().area() *
32  SkColorTypeBytesPerPixel(kBGRA_8888_SkColorType);
33  }
SkISize image_dimensions() const override

◆ image_dimensions()

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

Reimplemented from flutter::RasterCacheResult.

Definition at line 28 of file mock_raster_cache.h.

Referenced by image_bytes().

28 { return device_rect_.size(); };

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