Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
graphite
RasterPathAtlas.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef skgpu_graphite_RasterPathAtlas_DEFINED
9
#define skgpu_graphite_RasterPathAtlas_DEFINED
10
11
#include "
src/gpu/graphite/PathAtlas.h
"
12
13
namespace
skgpu::graphite
{
14
15
/**
16
* PathAtlas class that rasterizes coverage masks on the CPU.
17
*
18
* When a new shape gets added, its path is rasterized in preparation for upload. These
19
* uploads are recorded by `recordUploads()` and subsequently added to an UploadTask.
20
*
21
* Shapes are cached for future frames to avoid the cost of raster pipeline rendering. Multiple
22
* textures (or Pages) are used to cache masks, so if the atlas is full we can reset a Page and
23
* start adding new shapes for a future atlas render.
24
*/
25
class
RasterPathAtlas
:
public
PathAtlas
{
26
public
:
27
explicit
RasterPathAtlas
(
Recorder
* recorder);
28
~RasterPathAtlas
()
override
{}
29
void
recordUploads
(
DrawContext
*);
30
31
void
postFlush
() {
32
fCachedAtlasMgr.postFlush(
fRecorder
);
33
fSmallPathAtlasMgr.postFlush(
fRecorder
);
34
fUncachedAtlasMgr.postFlush(
fRecorder
);
35
}
36
37
protected
:
38
const
TextureProxy
*
onAddShape
(
const
Shape
&,
39
const
Transform
&
transform
,
40
const
SkStrokeRec
&,
41
skvx::half2
maskSize,
42
skvx::half2
* outPos)
override
;
43
private
:
44
class
RasterAtlasMgr :
public
PathAtlas::DrawAtlasMgr
{
45
public
:
46
RasterAtlasMgr(
size_t
width
,
size_t
height
,
47
size_t
plotWidth,
size_t
plotHeight,
48
const
Caps
* caps)
49
:
PathAtlas
::DrawAtlasMgr(
width
,
height
, plotWidth, plotHeight,
50
/*label=*/
"RasterPathAtlas"
, caps) {}
51
52
protected
:
53
bool
onAddToAtlas(
const
Shape
&,
54
const
Transform&
transform
,
55
const
SkStrokeRec
&,
56
SkIRect
shapeBounds,
57
const
AtlasLocator
&)
override
;
58
};
59
60
RasterAtlasMgr fCachedAtlasMgr;
61
RasterAtlasMgr fSmallPathAtlasMgr;
62
RasterAtlasMgr fUncachedAtlasMgr;
63
};
64
65
}
// namespace skgpu::graphite
66
67
#endif
// skgpu_graphite_RasterPathAtlas_DEFINED
PathAtlas.h
Shape
Shape
Definition
aaxfermodes.cpp:46
SkStrokeRec
Definition
SkStrokeRec.h:22
skgpu::AtlasLocator
Definition
AtlasTypes.h:292
skgpu::graphite::Caps
Definition
Caps.h:70
skgpu::graphite::DrawContext
Definition
DrawContext.h:44
skgpu::graphite::PathAtlas::DrawAtlasMgr
Definition
PathAtlas.h:113
skgpu::graphite::PathAtlas
Definition
PathAtlas.h:41
skgpu::graphite::PathAtlas::height
uint32_t height() const
Definition
PathAtlas.h:95
skgpu::graphite::PathAtlas::fRecorder
Recorder * fRecorder
Definition
PathAtlas.h:167
skgpu::graphite::PathAtlas::width
uint32_t width() const
Definition
PathAtlas.h:94
skgpu::graphite::RasterPathAtlas
Definition
RasterPathAtlas.h:25
skgpu::graphite::RasterPathAtlas::recordUploads
void recordUploads(DrawContext *)
Definition
RasterPathAtlas.cpp:37
skgpu::graphite::RasterPathAtlas::postFlush
void postFlush()
Definition
RasterPathAtlas.h:31
skgpu::graphite::RasterPathAtlas::~RasterPathAtlas
~RasterPathAtlas() override
Definition
RasterPathAtlas.h:28
skgpu::graphite::RasterPathAtlas::onAddShape
const TextureProxy * onAddShape(const Shape &, const Transform &transform, const SkStrokeRec &, skvx::half2 maskSize, skvx::half2 *outPos) override
Definition
RasterPathAtlas.cpp:43
skgpu::graphite::Recorder
Definition
Recorder.h:74
skgpu::graphite::Shape
Definition
Shape.h:28
skgpu::graphite::TextureProxy
Definition
TextureProxy.h:27
skgpu::graphite::Transform
Definition
Transform_graphite.h:19
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
transform
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition
p3.cpp:47
SkIRect
Definition
SkRect.h:32
skvx::Vec
Definition
SkVx.h:83
Generated on Fri Apr 26 2024 06:17:19 for Flutter Engine by
1.9.8