Coverage Report

Created: 2024-09-14 07:19

/src/skia/src/gpu/graphite/DrawList.cpp
Line
Count
Source (jump to first uncovered line)
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
8
#include "src/gpu/graphite/DrawList.h"
9
10
#include "src/gpu/BufferWriter.h"
11
#include "src/gpu/graphite/Renderer.h"
12
#include "src/gpu/graphite/geom/Shape.h"
13
14
namespace skgpu::graphite {
15
16
0
const Transform& DrawList::deduplicateTransform(const Transform& localToDevice) {
17
    // TODO: This is a pretty simple deduplication strategy and doesn't take advantage of the stack
18
    // knowledge that Device has.
19
0
    if (fTransforms.empty() || fTransforms.back() != localToDevice) {
20
0
        fTransforms.push_back(localToDevice);
21
0
    }
22
0
    return fTransforms.back();
23
0
}
24
25
void 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
0
                          const StrokeStyle* stroke) {
32
0
    SkASSERT(localToDevice.valid());
33
0
    SkASSERT(!geometry.isEmpty() && !clip.drawBounds().isEmptyNegativeOrNaN());
34
0
    SkASSERT(!(renderer->depthStencilFlags() & DepthStencilFlags::kStencil) ||
35
0
             ordering.stencilIndex() != DrawOrder::kUnassigned);
36
37
    // TODO: Add validation that the renderer's expected shape type and stroke params match provided
38
39
0
    fDraws.emplace_back(renderer, this->deduplicateTransform(localToDevice),
40
0
                        geometry, clip, ordering, paint, stroke);
41
0
    fRenderStepCount += renderer->numRenderSteps();
42
43
#if defined(SK_DEBUG)
44
0
    if (geometry.isCoverageMaskShape()) {
45
0
        fCoverageMaskShapeDrawCount++;
46
0
    }
47
#endif
48
49
0
    if (paint && paint->dstReadRequirement() == DstReadRequirement::kTextureCopy) {
50
0
        fDstCopyBounds.join(clip.drawBounds());
51
0
    }
52
0
}
Unexecuted instantiation: skgpu::graphite::DrawList::recordDraw(skgpu::graphite::Renderer const*, skgpu::graphite::Transform const&, skgpu::graphite::Geometry const&, skgpu::graphite::Clip const&, skgpu::graphite::DrawOrder, skgpu::graphite::PaintParams const*, skgpu::graphite::StrokeStyle const*)
Unexecuted instantiation: skgpu::graphite::DrawList::recordDraw(skgpu::graphite::Renderer const*, skgpu::graphite::Transform const&, skgpu::graphite::Geometry const&, skgpu::graphite::Clip const&, skgpu::graphite::DrawOrder, skgpu::graphite::PaintParams const*, skgpu::graphite::StrokeStyle const*)
53
54
} // namespace skgpu::graphite