Flutter Engine
 
Loading...
Searching...
No Matches
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
 

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 26 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)

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 30 of file mock_raster_cache.h.

32 {};

◆ image_bytes()

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

Reimplemented from flutter::RasterCacheResult.

Definition at line 38 of file mock_raster_cache.h.

38 {
39 return image_dimensions().area() *
40 SkColorTypeBytesPerPixel(kBGRA_8888_SkColorType);
41 }

References image_dimensions().

◆ image_dimensions()

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

Reimplemented from flutter::RasterCacheResult.

Definition at line 34 of file mock_raster_cache.h.

34 {
35 return SkSize::Make(device_rect_.width(), device_rect_.height()).toCeil();
36 };

Referenced by image_bytes().


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