| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrClipMaskManager_DEFINED | 7 #ifndef GrClipMaskManager_DEFINED |
| 8 #define GrClipMaskManager_DEFINED | 8 #define GrClipMaskManager_DEFINED |
| 9 | 9 |
| 10 #include "GrPipelineBuilder.h" | 10 #include "GrPipelineBuilder.h" |
| 11 #include "GrReducedClip.h" | 11 #include "GrReducedClip.h" |
| 12 #include "GrTexture.h" | |
| 13 #include "SkClipStack.h" | 12 #include "SkClipStack.h" |
| 14 #include "SkDeque.h" | |
| 15 #include "SkPath.h" | |
| 16 #include "SkRefCnt.h" | |
| 17 #include "SkTLList.h" | |
| 18 #include "SkTypes.h" | 13 #include "SkTypes.h" |
| 19 | 14 |
| 20 class GrAppliedClip; | 15 class GrAppliedClip; |
| 21 class GrClipStackClip; | 16 class GrClipStackClip; |
| 22 class GrDrawTarget; | 17 class GrDrawTarget; |
| 23 class GrPathRenderer; | 18 class GrPathRenderer; |
| 24 class GrPathRendererChain; | 19 class GrPathRendererChain; |
| 25 class GrResourceProvider; | 20 class GrResourceProvider; |
| 26 class GrTexture; | 21 class GrTexture; |
| 27 class SkPath; | 22 class GrTextureProvider; |
| 28 | 23 |
| 29 /** | 24 /** |
| 30 * The clip mask creator handles the generation of the clip mask. If anti | 25 * The clip mask creator handles the generation of the clip mask. If anti |
| 31 * aliasing is requested it will (in the future) generate a single channel | 26 * aliasing is requested it will (in the future) generate a single channel |
| 32 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit | 27 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit |
| 33 * mask in the stencil buffer. In the non anti-aliasing case, if the clip | 28 * mask in the stencil buffer. In the non anti-aliasing case, if the clip |
| 34 * mask can be represented as a rectangle then scissoring is used. In all | 29 * mask can be represented as a rectangle then scissoring is used. In all |
| 35 * cases scissoring is used to bound the range of the clip mask. | 30 * cases scissoring is used to bound the range of the clip mask. |
| 36 */ | 31 */ |
| 37 class GrClipMaskManager : SkNoncopyable { | 32 class GrClipMaskManager : SkNoncopyable { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the | 81 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the |
| 87 // rect specified by clipSpaceIBounds. | 82 // rect specified by clipSpaceIBounds. |
| 88 static sk_sp<GrTexture> CreateAlphaClipMask(GrContext*, | 83 static sk_sp<GrTexture> CreateAlphaClipMask(GrContext*, |
| 89 int32_t elementsGenID, | 84 int32_t elementsGenID, |
| 90 GrReducedClip::InitialState init
ialState, | 85 GrReducedClip::InitialState init
ialState, |
| 91 const GrReducedClip::ElementList
& elements, | 86 const GrReducedClip::ElementList
& elements, |
| 92 const SkVector& clipToMaskOffset
, | 87 const SkVector& clipToMaskOffset
, |
| 93 const SkIRect& clipSpaceIBounds)
; | 88 const SkIRect& clipSpaceIBounds)
; |
| 94 | 89 |
| 95 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 90 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
| 96 static sk_sp<GrTexture> CreateSoftwareClipMask(GrContext*, | 91 static sk_sp<GrTexture> CreateSoftwareClipMask(GrTextureProvider*, |
| 97 int32_t elementsGenID, | 92 int32_t elementsGenID, |
| 98 GrReducedClip::InitialState i
nitialState, | 93 GrReducedClip::InitialState i
nitialState, |
| 99 const GrReducedClip::ElementL
ist& elements, | 94 const GrReducedClip::ElementL
ist& elements, |
| 100 const SkVector& clipToMaskOff
set, | 95 const SkVector& clipToMaskOff
set, |
| 101 const SkIRect& clipSpaceIBoun
ds); | 96 const SkIRect& clipSpaceIBoun
ds); |
| 102 | 97 |
| 103 static bool UseSWOnlyPath(GrContext*, | 98 static bool UseSWOnlyPath(GrContext*, |
| 104 const GrPipelineBuilder&, | 99 const GrPipelineBuilder&, |
| 105 const GrRenderTarget* rt, | 100 const GrRenderTarget* rt, |
| 106 const SkVector& clipToMaskOffset, | 101 const SkVector& clipToMaskOffset, |
| 107 const GrReducedClip::ElementList& elements); | 102 const GrReducedClip::ElementList& elements); |
| 108 | 103 |
| 109 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); | 104 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); |
| 110 | 105 |
| 111 static const int kMaxAnalyticElements = 4; | 106 static const int kMaxAnalyticElements = 4; |
| 112 | 107 |
| 113 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 108 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
| 114 | 109 |
| 115 typedef SkNoncopyable INHERITED; | 110 typedef SkNoncopyable INHERITED; |
| 116 }; | 111 }; |
| 117 #endif // GrClipMaskManager_DEFINED | 112 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |