Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skgpu::graphite::HybridBoundsManager Class Reference

#include <BoundsManager.h>

Inheritance diagram for skgpu::graphite::HybridBoundsManager:
skgpu::graphite::BoundsManager

Public Member Functions

 HybridBoundsManager (const SkISize &deviceSize, int gridCellSize, int maxBruteForceN, int maxGridSize=0)
 
CompressedPaintersOrder getMostRecentDraw (const Rect &bounds) const override
 
void recordDraw (const Rect &bounds, CompressedPaintersOrder order) override
 
void reset () override
 
- Public Member Functions inherited from skgpu::graphite::BoundsManager
virtual ~BoundsManager ()
 
virtual CompressedPaintersOrder getMostRecentDraw (const Rect &bounds) const =0
 
virtual void recordDraw (const Rect &bounds, CompressedPaintersOrder order)=0
 
virtual void reset ()=0
 

Detailed Description

Definition at line 243 of file BoundsManager.h.

Constructor & Destructor Documentation

◆ HybridBoundsManager()

skgpu::graphite::HybridBoundsManager::HybridBoundsManager ( const SkISize deviceSize,
int  gridCellSize,
int  maxBruteForceN,
int  maxGridSize = 0 
)
inline

Definition at line 245 of file BoundsManager.h.

249 : fDeviceSize(deviceSize)
250 , fGridCellSize(gridCellSize)
251 , fMaxBruteForceN(maxBruteForceN)
252 , fMaxGridSize(maxGridSize)
253 , fCurrentManager(&fBruteForceManager) {
254 SkASSERT(deviceSize.width() >= 1 && deviceSize.height() >= 1 &&
255 gridCellSize >= 1 && maxBruteForceN >= 1);
256 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37

Member Function Documentation

◆ getMostRecentDraw()

CompressedPaintersOrder skgpu::graphite::HybridBoundsManager::getMostRecentDraw ( const Rect bounds) const
inlineoverridevirtual

Implements skgpu::graphite::BoundsManager.

Definition at line 258 of file BoundsManager.h.

258 {
259 return fCurrentManager->getMostRecentDraw(bounds);
260 }
virtual CompressedPaintersOrder getMostRecentDraw(const Rect &bounds) const =0
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ recordDraw()

void skgpu::graphite::HybridBoundsManager::recordDraw ( const Rect bounds,
CompressedPaintersOrder  order 
)
inlineoverridevirtual

Implements skgpu::graphite::BoundsManager.

Definition at line 262 of file BoundsManager.h.

262 {
263 this->updateCurrentManagerIfNeeded();
264 fCurrentManager->recordDraw(bounds, order);
265 }
virtual void recordDraw(const Rect &bounds, CompressedPaintersOrder order)=0

◆ reset()

void skgpu::graphite::HybridBoundsManager::reset ( )
inlineoverridevirtual

Implements skgpu::graphite::BoundsManager.

Definition at line 267 of file BoundsManager.h.

267 {
268 const bool usedGrid = fCurrentManager == fGridManager.get();
269 if (usedGrid) {
270 // Reset the grid manager so it's ready to use next frame, but don't delete it.
271 fGridManager->reset();
272 // Assume brute force manager was reset when we swapped to the grid originally
273 fCurrentManager = &fBruteForceManager;
274 } else {
275 if (fGridManager) {
276 // Clean up the grid manager that was created over a frame ago without being used.
277 // This could lead to re-allocating the grid every-other frame, but it's a simple
278 // way to ensure we don't hold onto the grid in perpetuity if it's not needed.
279 fGridManager = nullptr;
280 }
281 fBruteForceManager.reset();
282 SkASSERT(fCurrentManager == &fBruteForceManager);
283 }
284 }

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