OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef GrClipStackClip_DEFINED | 7 #ifndef GrClipStackClip_DEFINED |
8 #define GrClipStackClip_DEFINED | 8 #define GrClipStackClip_DEFINED |
9 | 9 |
10 #include "GrClip.h" | 10 #include "GrClip.h" |
11 #include "GrReducedClip.h" | 11 #include "GrReducedClip.h" |
12 #include "SkClipStack.h" | 12 #include "SkClipStack.h" |
13 | 13 |
14 class GrPathRenderer; | 14 class GrPathRenderer; |
15 class GrTexture; | 15 class GrTexture; |
| 16 class GrTextureProxy; |
16 class GrTextureProvider; | 17 class GrTextureProvider; |
17 class GrUniqueKey; | 18 class GrUniqueKey; |
18 | 19 |
19 /** | 20 /** |
20 * GrClipStackClip can apply a generic SkClipStack to the draw state. It may nee
d to generate an | 21 * GrClipStackClip can apply a generic SkClipStack to the draw state. It may nee
d to generate an |
21 * 8-bit alpha clip mask and/or modify the stencil buffer during apply(). | 22 * 8-bit alpha clip mask and/or modify the stencil buffer during apply(). |
22 */ | 23 */ |
23 class GrClipStackClip final : public GrClip { | 24 class GrClipStackClip final : public GrClip { |
24 public: | 25 public: |
25 GrClipStackClip(const SkClipStack* stack = nullptr, const SkIPoint* origin =
nullptr) { | 26 GrClipStackClip(const SkClipStack* stack = nullptr, const SkIPoint* origin =
nullptr) { |
(...skipping 18 matching lines...) Expand all Loading... |
44 static bool PathNeedsSWRenderer(GrContext* context, | 45 static bool PathNeedsSWRenderer(GrContext* context, |
45 bool hasUserStencilSettings, | 46 bool hasUserStencilSettings, |
46 const GrRenderTargetContext*, | 47 const GrRenderTargetContext*, |
47 const SkMatrix& viewMatrix, | 48 const SkMatrix& viewMatrix, |
48 const SkClipStack::Element* element, | 49 const SkClipStack::Element* element, |
49 GrPathRenderer** prOut, | 50 GrPathRenderer** prOut, |
50 bool needsStencil); | 51 bool needsStencil); |
51 | 52 |
52 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the | 53 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the |
53 // rect specified by clipSpaceIBounds. | 54 // rect specified by clipSpaceIBounds. |
54 static sk_sp<GrTexture> CreateAlphaClipMask(GrContext*, const GrReducedClip&
); | 55 static sk_sp<GrTextureProxy> CreateAlphaClipMask(GrContext*, const GrReduced
Clip&); |
55 | 56 |
56 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 57 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
57 static sk_sp<GrTexture> CreateSoftwareClipMask(GrTextureProvider*, const GrR
educedClip&); | 58 static sk_sp<GrTextureProxy> CreateSoftwareClipMask(GrTextureProvider*, cons
t GrReducedClip&); |
58 | 59 |
59 static bool UseSWOnlyPath(GrContext*, | 60 static bool UseSWOnlyPath(GrContext*, |
60 bool hasUserStencilSettings, | 61 bool hasUserStencilSettings, |
61 const GrRenderTargetContext*, | 62 const GrRenderTargetContext*, |
62 const GrReducedClip&); | 63 const GrReducedClip&); |
63 | 64 |
64 static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey&
key, | 65 static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey&
key, |
65 bool renderTarget); | 66 bool renderTarget); |
66 | 67 |
67 SkIPoint fOrigin; | 68 SkIPoint fOrigin; |
68 sk_sp<const SkClipStack> fStack; | 69 sk_sp<const SkClipStack> fStack; |
69 }; | 70 }; |
70 | 71 |
71 #endif // GrClipStackClip_DEFINED | 72 #endif // GrClipStackClip_DEFINED |
OLD | NEW |