Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
DrawList.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 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
9
13
14namespace skgpu::graphite {
15
17 // TODO: This is a pretty simple deduplication strategy and doesn't take advantage of the stack
18 // knowledge that Device has.
19 if (fTransforms.empty() || fTransforms.back() != localToDevice) {
20 fTransforms.push_back(localToDevice);
21 }
22 return fTransforms.back();
23}
24
25void DrawList::recordDraw(const Renderer* renderer,
26 const Transform& localToDevice,
27 const Geometry& geometry,
28 const Clip& clip,
29 DrawOrder ordering,
30 const PaintParams* paint,
31 const StrokeStyle* stroke) {
32 SkASSERT(localToDevice.valid());
33 SkASSERT(!geometry.isEmpty() && !clip.drawBounds().isEmptyNegativeOrNaN());
34 SkASSERT(!(renderer->depthStencilFlags() & DepthStencilFlags::kStencil) ||
36
37 // TODO: Add validation that the renderer's expected shape type and stroke params match provided
38
39 fDraws.emplace_back(renderer, this->deduplicateTransform(localToDevice),
40 geometry, clip, ordering, paint, stroke);
41 fRenderStepCount += renderer->numRenderSteps();
42
43#if defined(SK_DEBUG)
44 if (geometry.isCoverageMaskShape()) {
45 fCoverageMaskShapeDrawCount++;
46 }
47#endif
48
49 if (paint && paint->dstReadRequirement() == DstReadRequirement::kTextureCopy) {
50 fDstCopyBounds.join(clip.drawBounds());
51 }
52}
53
54} // namespace skgpu::graphite
#define SkASSERT(cond)
Definition SkAssert.h:116
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
const Transform & deduplicateTransform(const Transform &)
Definition DrawList.cpp:16
SkTBlockList< Transform, 16 > fTransforms
Definition DrawList.h:110
SkTBlockList< Draw, 16 > fDraws
Definition DrawList.h:111
void recordDraw(const Renderer *renderer, const Transform &localToDevice, const Geometry &geometry, const Clip &clip, DrawOrder ordering, const PaintParams *paint, const StrokeStyle *stroke)
Definition DrawList.cpp:25
static constexpr DisjointStencilIndex kUnassigned
Definition DrawOrder.h:115
DisjointStencilIndex stencilIndex() const
Definition DrawOrder.h:128
bool isCoverageMaskShape() const
Definition Geometry.h:100
AI Rect & join(Rect rect)
Definition Rect.h:150
const Paint & paint