Flutter Engine
The Flutter Engine
SoftwarePathRenderer.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 Google Inc.
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 SoftwarePathRenderer_DEFINED
9#define SoftwarePathRenderer_DEFINED
10
13
14class GrProxyProvider;
15
16namespace skgpu::ganesh {
17
18/**
19 * This class uses the software side to render a path to an SkBitmap and
20 * then uploads the result to the gpu
21 */
22class SoftwarePathRenderer final : public PathRenderer {
23public:
24 const char* name() const override { return "SW"; }
25
26 SoftwarePathRenderer(GrProxyProvider* proxyProvider, bool allowCaching)
27 : fProxyProvider(proxyProvider)
28 , fAllowCaching(allowCaching) {
29 }
30
32 const GrClip*,
33 const GrStyledShape&,
34 const SkMatrix& viewMatrix,
35 SkIRect* unclippedDevShapeBounds,
36 SkIRect* clippedDevShapeBounds,
37 SkIRect* devClipBounds);
38
39private:
40 static void DrawNonAARect(SurfaceDrawContext*,
41 GrPaint&&,
43 const GrClip*,
44 const SkMatrix& viewMatrix,
45 const SkRect& rect,
46 const SkMatrix& localMatrix);
47 static void DrawAroundInvPath(SurfaceDrawContext*,
48 GrPaint&&,
50 const GrClip*,
51 const SkMatrix& viewMatrix,
52 const SkIRect& devClipBounds,
53 const SkIRect& devPathBounds);
54
55 // This utility draws a path mask using a provided paint. The rectangle is drawn in device
56 // space. The 'viewMatrix' will be used to ensure the correct local coords are provided to
57 // any fragment processors in the paint.
58 static void DrawToTargetWithShapeMask(GrSurfaceProxyView,
60 GrPaint&&,
62 const GrClip*,
63 const SkMatrix& viewMatrix,
64 const SkIPoint& textureOriginInDeviceSpace,
65 const SkIRect& deviceSpaceRectToDraw);
66
67 StencilSupport onGetStencilSupport(const GrStyledShape&) const override {
69 }
70
71 CanDrawPath onCanDrawPath(const CanDrawPathArgs&) const override;
72
73 bool onDrawPath(const DrawPathArgs&) override;
74
75private:
76 GrProxyProvider* fProxyProvider;
77 bool fAllowCaching;
78};
79
80} // namespace skgpu::ganesh
81
82#endif // SoftwarePathRenderer_DEFINED
Definition: GrClip.h:29
const char * name() const override
SoftwarePathRenderer(GrProxyProvider *proxyProvider, bool allowCaching)
static bool GetShapeAndClipBounds(SurfaceDrawContext *, const GrClip *, const GrStyledShape &, const SkMatrix &viewMatrix, SkIRect *unclippedDevShapeBounds, SkIRect *clippedDevShapeBounds, SkIRect *devClipBounds)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
Definition: SkRect.h:32