Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / gpu / ganesh / ops / SoftwarePathRenderer.h
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
11 #include "src/gpu/ganesh/GrSurfaceProxyView.h"
12 #include "src/gpu/ganesh/v1/PathRenderer.h"
13
14 class GrProxyProvider;
15
16 namespace skgpu::v1 {
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  */
22 class SoftwarePathRenderer final : public PathRenderer {
23 public:
24     const char* name() const override { return "SW"; }
25
26     SoftwarePathRenderer(GrProxyProvider* proxyProvider, bool allowCaching)
27             : fProxyProvider(proxyProvider)
28             , fAllowCaching(allowCaching) {
29     }
30
31     static bool GetShapeAndClipBounds(SurfaceDrawContext*,
32                                       const GrClip*,
33                                       const GrStyledShape&,
34                                       const SkMatrix& viewMatrix,
35                                       SkIRect* unclippedDevShapeBounds,
36                                       SkIRect* clippedDevShapeBounds,
37                                       SkIRect* devClipBounds);
38
39 private:
40     static void DrawNonAARect(SurfaceDrawContext*,
41                               GrPaint&&,
42                               const GrUserStencilSettings&,
43                               const GrClip*,
44                               const SkMatrix& viewMatrix,
45                               const SkRect& rect,
46                               const SkMatrix& localMatrix);
47     static void DrawAroundInvPath(SurfaceDrawContext*,
48                                   GrPaint&&,
49                                   const GrUserStencilSettings&,
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,
59                                           SurfaceDrawContext*,
60                                           GrPaint&&,
61                                           const GrUserStencilSettings&,
62                                           const GrClip*,
63                                           const SkMatrix& viewMatrix,
64                                           const SkIPoint& textureOriginInDeviceSpace,
65                                           const SkIRect& deviceSpaceRectToDraw);
66
67     StencilSupport onGetStencilSupport(const GrStyledShape&) const override {
68         return PathRenderer::kNoSupport_StencilSupport;
69     }
70
71     CanDrawPath onCanDrawPath(const CanDrawPathArgs&) const override;
72
73     bool onDrawPath(const DrawPathArgs&) override;
74
75 private:
76     GrProxyProvider* fProxyProvider;
77     bool             fAllowCaching;
78 };
79
80 } // namespace skgpu::v1
81
82 #endif // SoftwarePathRenderer_DEFINED