• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GrSoftwarePathRenderer_DEFINED
9 #define GrSoftwarePathRenderer_DEFINED
10 
11 #include "GrPathRenderer.h"
12 
13 class GrResourceProvider;
14 
15 /**
16  * This class uses the software side to render a path to an SkBitmap and
17  * then uploads the result to the gpu
18  */
19 class GrSoftwarePathRenderer : public GrPathRenderer {
20 public:
GrSoftwarePathRenderer(GrResourceProvider * resourceProvider,bool allowCaching)21     GrSoftwarePathRenderer(GrResourceProvider* resourceProvider, bool allowCaching)
22             : fResourceProvider(resourceProvider)
23             , fAllowCaching(allowCaching) {}
24 private:
25     static void DrawNonAARect(GrRenderTargetContext* renderTargetContext,
26                               GrPaint&& paint,
27                               const GrUserStencilSettings& userStencilSettings,
28                               const GrClip& clip,
29                               const SkMatrix& viewMatrix,
30                               const SkRect& rect,
31                               const SkMatrix& localMatrix);
32     static void DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
33                                   GrPaint&& paint,
34                                   const GrUserStencilSettings& userStencilSettings,
35                                   const GrClip& clip,
36                                   const SkMatrix& viewMatrix,
37                                   const SkIRect& devClipBounds,
38                                   const SkIRect& devPathBounds);
39 
onGetStencilSupport(const GrShape &)40     StencilSupport onGetStencilSupport(const GrShape&) const override {
41         return GrPathRenderer::kNoSupport_StencilSupport;
42     }
43 
44     bool onCanDrawPath(const CanDrawPathArgs&) const override;
45 
46     bool onDrawPath(const DrawPathArgs&) override;
47 
48 private:
49     GrResourceProvider*    fResourceProvider;
50     bool                   fAllowCaching;
51 
52     typedef GrPathRenderer INHERITED;
53 };
54 
55 #endif
56