blob: c8d2f8b8d80235fdbb50ccca088e658026073580 [file] [log] [blame]
robertphillips@google.comf4c2c522012-04-27 12:08:47 +00001/*
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
Brian Osman32342f02017-03-04 08:12:46 -050013class GrResourceProvider;
robertphillips@google.comb4f06d72012-05-15 12:10:05 +000014
15/**
robertphillips@google.comb4f06d72012-05-15 12:10:05 +000016 * This class uses the software side to render a path to an SkBitmap and
17 * then uploads the result to the gpu
18 */
robertphillips@google.comf4c2c522012-04-27 12:08:47 +000019class GrSoftwarePathRenderer : public GrPathRenderer {
20public:
Brian Osman32342f02017-03-04 08:12:46 -050021 GrSoftwarePathRenderer(GrResourceProvider* resourceProvider, bool allowCaching)
22 : fResourceProvider(resourceProvider)
bsalomon39ef7fb2016-09-21 11:16:05 -070023 , fAllowCaching(allowCaching) {}
bsalomon0aff2fa2015-07-31 06:48:27 -070024private:
Brian Osman11052242016-10-27 14:47:55 -040025 static void DrawNonAARect(GrRenderTargetContext* renderTargetContext,
Brian Salomon82f44312017-01-11 13:42:54 -050026 GrPaint&& paint,
robertphillipsd2b6d642016-07-21 08:55:08 -070027 const GrUserStencilSettings& userStencilSettings,
robertphillips976f5f02016-06-03 10:59:20 -070028 const GrClip& clip,
robertphillips976f5f02016-06-03 10:59:20 -070029 const SkMatrix& viewMatrix,
30 const SkRect& rect,
31 const SkMatrix& localMatrix);
Brian Osman11052242016-10-27 14:47:55 -040032 static void DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
Brian Salomon82f44312017-01-11 13:42:54 -050033 GrPaint&& paint,
robertphillipsd2b6d642016-07-21 08:55:08 -070034 const GrUserStencilSettings& userStencilSettings,
robertphillips976f5f02016-06-03 10:59:20 -070035 const GrClip& clip,
robertphillips976f5f02016-06-03 10:59:20 -070036 const SkMatrix& viewMatrix,
37 const SkIRect& devClipBounds,
38 const SkIRect& devPathBounds);
39
bsalomon8acedde2016-06-24 10:42:16 -070040 StencilSupport onGetStencilSupport(const GrShape&) const override {
robertphillipse7d4b2f2015-08-13 07:57:10 -070041 return GrPathRenderer::kNoSupport_StencilSupport;
42 }
halcanary9d524f22016-03-29 09:03:52 -070043
bsalomon0aff2fa2015-07-31 06:48:27 -070044 bool onCanDrawPath(const CanDrawPathArgs&) const override;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000045
bsalomon0aff2fa2015-07-31 06:48:27 -070046 bool onDrawPath(const DrawPathArgs&) override;
rmistry@google.comd6176b02012-08-23 18:14:13 +000047
robertphillips@google.comf4c2c522012-04-27 12:08:47 +000048private:
Brian Osman32342f02017-03-04 08:12:46 -050049 GrResourceProvider* fResourceProvider;
bsalomon39ef7fb2016-09-21 11:16:05 -070050 bool fAllowCaching;
robertphillips@google.comf4c2c522012-04-27 12:08:47 +000051
52 typedef GrPathRenderer INHERITED;
53};
54
55#endif