robertphillips@google.com | f4c2c52 | 2012-04-27 12:08:47 +0000 | [diff] [blame] | 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 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 13 | class GrResourceProvider; |
robertphillips@google.com | b4f06d7 | 2012-05-15 12:10:05 +0000 | [diff] [blame] | 14 | |
| 15 | /** |
robertphillips@google.com | b4f06d7 | 2012-05-15 12:10:05 +0000 | [diff] [blame] | 16 | * 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.com | f4c2c52 | 2012-04-27 12:08:47 +0000 | [diff] [blame] | 19 | class GrSoftwarePathRenderer : public GrPathRenderer { |
| 20 | public: |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 21 | GrSoftwarePathRenderer(GrResourceProvider* resourceProvider, bool allowCaching) |
| 22 | : fResourceProvider(resourceProvider) |
bsalomon | 39ef7fb | 2016-09-21 11:16:05 -0700 | [diff] [blame] | 23 | , fAllowCaching(allowCaching) {} |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 24 | private: |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 25 | static void DrawNonAARect(GrRenderTargetContext* renderTargetContext, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 26 | GrPaint&& paint, |
robertphillips | d2b6d64 | 2016-07-21 08:55:08 -0700 | [diff] [blame] | 27 | const GrUserStencilSettings& userStencilSettings, |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 28 | const GrClip& clip, |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 29 | const SkMatrix& viewMatrix, |
| 30 | const SkRect& rect, |
| 31 | const SkMatrix& localMatrix); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 32 | static void DrawAroundInvPath(GrRenderTargetContext* renderTargetContext, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 33 | GrPaint&& paint, |
robertphillips | d2b6d64 | 2016-07-21 08:55:08 -0700 | [diff] [blame] | 34 | const GrUserStencilSettings& userStencilSettings, |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 35 | const GrClip& clip, |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 36 | const SkMatrix& viewMatrix, |
| 37 | const SkIRect& devClipBounds, |
| 38 | const SkIRect& devPathBounds); |
| 39 | |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 40 | StencilSupport onGetStencilSupport(const GrShape&) const override { |
robertphillips | e7d4b2f | 2015-08-13 07:57:10 -0700 | [diff] [blame] | 41 | return GrPathRenderer::kNoSupport_StencilSupport; |
| 42 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 43 | |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 44 | bool onCanDrawPath(const CanDrawPathArgs&) const override; |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 45 | |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 46 | bool onDrawPath(const DrawPathArgs&) override; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 47 | |
robertphillips@google.com | f4c2c52 | 2012-04-27 12:08:47 +0000 | [diff] [blame] | 48 | private: |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 49 | GrResourceProvider* fResourceProvider; |
bsalomon | 39ef7fb | 2016-09-21 11:16:05 -0700 | [diff] [blame] | 50 | bool fAllowCaching; |
robertphillips@google.com | f4c2c52 | 2012-04-27 12:08:47 +0000 | [diff] [blame] | 51 | |
| 52 | typedef GrPathRenderer INHERITED; |
| 53 | }; |
| 54 | |
| 55 | #endif |