Flutter Engine
The Flutter Engine
RasterPathUtils.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 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_RasterPathUtils_DEFINED
9#define skgpu_graphite_RasterPathUtils_DEFINED
10
12#include "src/base/SkVx.h"
14#include "src/core/SkDrawBase.h"
16#include "src/gpu/ResourceKey.h"
17
18namespace skgpu::graphite {
19
20class Shape;
21class Transform;
22
23/**
24 * The RasterMaskHelper helps generate masks using the software rendering
25 * path. It is intended to be used as:
26 *
27 * RasterMaskHelper helper(pixmapstorage);
28 * helper.init(...);
29 * helper.drawShape(...);
30 *
31 * The result of this process will be the mask rendered in the Pixmap,
32 * at the upper left hand corner of the bounds.
33 *
34 * TODO: this could be extended to support clip masks, similar to GrSWMaskHelper.
35 */
36
38public:
39 RasterMaskHelper(SkAutoPixmapStorage* pixels) : fPixels(pixels) {}
40
41 bool init(SkISize pixmapSize);
42
43 // Draw a single shape into the bitmap (as a path) at location resultBounds
44 void drawShape(const Shape& shape,
45 const Transform& transform,
46 const SkStrokeRec& strokeRec,
47 const SkIRect& resultBounds);
48
49private:
50 SkAutoPixmapStorage* fPixels;
51 SkDrawBase fDraw;
52 SkRasterClip fRasterClip;
53};
54
56 const Transform& transform,
57 const SkStrokeRec& strokeRec,
58 skvx::half2 maskSize);
59} // namespace skgpu::graphite
60
61#endif // skgpu_graphite_RasterPathUtils_DEFINED
Shape
Definition: aaxfermodes.cpp:43
bool init(SkISize pixmapSize)
void drawShape(const Shape &shape, const Transform &transform, const SkStrokeRec &strokeRec, const SkIRect &resultBounds)
RasterMaskHelper(SkAutoPixmapStorage *pixels)
skgpu::UniqueKey GeneratePathMaskKey(const Shape &shape, const Transform &transform, const SkStrokeRec &strokeRec, skvx::half2 maskSize)
skgpu::graphite::Transform Transform
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
Definition: SkRect.h:32
Definition: SkSize.h:16
Definition: SkVx.h:83