robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef GrClipMaskManager_DEFINED |
| 10 | #define GrClipMaskManager_DEFINED |
| 11 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 12 | #include "GrContext.h" |
bsalomon@google.com | 411dad0 | 2012-06-05 20:24:20 +0000 | [diff] [blame] | 13 | #include "GrNoncopyable.h" |
| 14 | #include "GrRect.h" |
| 15 | #include "GrStencil.h" |
| 16 | #include "GrTexture.h" |
| 17 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 18 | #include "SkClipStack.h" |
bsalomon@google.com | 411dad0 | 2012-06-05 20:24:20 +0000 | [diff] [blame] | 19 | #include "SkDeque.h" |
| 20 | #include "SkPath.h" |
| 21 | #include "SkRefCnt.h" |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 22 | |
| 23 | class GrGpu; |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 24 | class GrPathRenderer; |
| 25 | class GrPathRendererChain; |
| 26 | class SkPath; |
robertphillips@google.com | f294b77 | 2012-04-27 14:29:26 +0000 | [diff] [blame] | 27 | class GrTexture; |
| 28 | class GrDrawState; |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 29 | |
| 30 | /** |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 31 | * The stencil buffer stores the last clip path - providing a single entry |
| 32 | * "cache". This class provides similar functionality for AA clip paths |
| 33 | */ |
| 34 | class GrClipMaskCache : public GrNoncopyable { |
| 35 | public: |
robertphillips@google.com | f8d904a | 2012-07-31 12:18:16 +0000 | [diff] [blame] | 36 | GrClipMaskCache(); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 37 | |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 38 | ~GrClipMaskCache() { |
| 39 | |
| 40 | while (!fStack.empty()) { |
| 41 | GrClipStackFrame* temp = (GrClipStackFrame*) fStack.back(); |
| 42 | temp->~GrClipStackFrame(); |
| 43 | fStack.pop_back(); |
| 44 | } |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 45 | } |
| 46 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 47 | bool canReuse(const SkClipStack& clip, int width, int height) { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 48 | |
| 49 | if (fStack.empty()) { |
| 50 | GrAssert(false); |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 55 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 56 | if (back->fLastMask.texture() && |
| 57 | back->fLastMask.texture()->width() >= width && |
| 58 | back->fLastMask.texture()->height() >= height && |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 59 | clip == back->fLastClip) { |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 60 | return true; |
| 61 | } |
| 62 | |
| 63 | return false; |
| 64 | } |
| 65 | |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 66 | void reset() { |
| 67 | if (fStack.empty()) { |
robertphillips@google.com | 87baf89 | 2012-05-23 12:02:21 +0000 | [diff] [blame] | 68 | // GrAssert(false); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 69 | return; |
| 70 | } |
| 71 | |
| 72 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 73 | |
| 74 | back->reset(); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * After a "push" the clip state is entirely open. Currently, the |
| 79 | * entire clip stack will be re-rendered into a new clip mask. |
| 80 | * TODO: can we take advantage of the nested nature of the clips to |
| 81 | * reduce the mask creation cost? |
| 82 | */ |
robertphillips@google.com | f8d904a | 2012-07-31 12:18:16 +0000 | [diff] [blame] | 83 | void push(); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 84 | |
| 85 | void pop() { |
robertphillips@google.com | 87baf89 | 2012-05-23 12:02:21 +0000 | [diff] [blame] | 86 | //GrAssert(!fStack.empty()); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 87 | |
| 88 | if (!fStack.empty()) { |
| 89 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 90 | |
| 91 | back->~GrClipStackFrame(); |
| 92 | fStack.pop_back(); |
| 93 | } |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 94 | } |
| 95 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 96 | void getLastClip(SkClipStack* clip) const { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 97 | |
| 98 | if (fStack.empty()) { |
| 99 | GrAssert(false); |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 100 | clip->reset(); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 101 | return; |
| 102 | } |
| 103 | |
| 104 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 105 | |
| 106 | *clip = back->fLastClip; |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | GrTexture* getLastMask() { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 110 | |
| 111 | if (fStack.empty()) { |
| 112 | GrAssert(false); |
| 113 | return NULL; |
| 114 | } |
| 115 | |
| 116 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 117 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 118 | return back->fLastMask.texture(); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | const GrTexture* getLastMask() const { |
| 122 | |
| 123 | if (fStack.empty()) { |
| 124 | GrAssert(false); |
| 125 | return NULL; |
| 126 | } |
| 127 | |
| 128 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 129 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 130 | return back->fLastMask.texture(); |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 131 | } |
| 132 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 133 | void acquireMask(const SkClipStack& clip, |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 134 | const GrTextureDesc& desc, |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 135 | const GrIRect& bound) { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 136 | |
| 137 | if (fStack.empty()) { |
| 138 | GrAssert(false); |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 139 | return; |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 143 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 144 | back->acquireMask(fContext, clip, desc, bound); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | int getLastMaskWidth() const { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 148 | |
| 149 | if (fStack.empty()) { |
| 150 | GrAssert(false); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 151 | return -1; |
| 152 | } |
| 153 | |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 154 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 155 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 156 | if (NULL == back->fLastMask.texture()) { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 157 | return -1; |
| 158 | } |
| 159 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 160 | return back->fLastMask.texture()->width(); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | int getLastMaskHeight() const { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 164 | |
| 165 | if (fStack.empty()) { |
| 166 | GrAssert(false); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 167 | return -1; |
| 168 | } |
| 169 | |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 170 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 171 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 172 | if (NULL == back->fLastMask.texture()) { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 173 | return -1; |
| 174 | } |
| 175 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 176 | return back->fLastMask.texture()->height(); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 177 | } |
| 178 | |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 179 | void getLastBound(GrIRect* bound) const { |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 180 | |
| 181 | if (fStack.empty()) { |
| 182 | GrAssert(false); |
| 183 | bound->setEmpty(); |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 188 | |
| 189 | *bound = back->fLastBound; |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 190 | } |
| 191 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 192 | void setContext(GrContext* context) { |
| 193 | fContext = context; |
| 194 | } |
| 195 | |
| 196 | GrContext* getContext() { |
| 197 | return fContext; |
| 198 | } |
| 199 | |
| 200 | void releaseResources() { |
| 201 | |
| 202 | SkDeque::F2BIter iter(fStack); |
| 203 | for (GrClipStackFrame* frame = (GrClipStackFrame*) iter.next(); |
| 204 | frame != NULL; |
| 205 | frame = (GrClipStackFrame*) iter.next()) { |
| 206 | frame->reset(); |
| 207 | } |
| 208 | } |
| 209 | |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 210 | protected: |
| 211 | private: |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 212 | struct GrClipStackFrame { |
| 213 | |
| 214 | GrClipStackFrame() { |
| 215 | reset(); |
| 216 | } |
| 217 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 218 | void acquireMask(GrContext* context, |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 219 | const SkClipStack& clip, |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 220 | const GrTextureDesc& desc, |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 221 | const GrIRect& bound) { |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 222 | |
| 223 | fLastClip = clip; |
| 224 | |
| 225 | fLastMask.set(context, desc); |
| 226 | |
| 227 | fLastBound = bound; |
| 228 | } |
| 229 | |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 230 | void reset () { |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 231 | fLastClip.reset(); |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 232 | |
robertphillips@google.com | 75b3c96 | 2012-06-07 12:08:45 +0000 | [diff] [blame] | 233 | GrTextureDesc desc; |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 234 | |
| 235 | fLastMask.set(NULL, desc); |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 236 | fLastBound.setEmpty(); |
| 237 | } |
| 238 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 239 | SkClipStack fLastClip; |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 240 | // The mask's width & height values are used in setupDrawStateAAClip to |
| 241 | // correctly scale the uvs for geometry drawn with this mask |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 242 | GrAutoScratchTexture fLastMask; |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 243 | // fLastBound stores the bounding box of the clip mask in canvas |
| 244 | // space. The left and top fields are used to offset the uvs for |
| 245 | // geometry drawn with this mask (in setupDrawStateAAClip) |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 246 | GrIRect fLastBound; |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 247 | }; |
| 248 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 249 | GrContext* fContext; |
robertphillips@google.com | beeb97c | 2012-05-09 21:15:28 +0000 | [diff] [blame] | 250 | SkDeque fStack; |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 251 | |
| 252 | typedef GrNoncopyable INHERITED; |
| 253 | }; |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 254 | |
| 255 | /** |
| 256 | * The clip mask creator handles the generation of the clip mask. If anti |
| 257 | * aliasing is requested it will (in the future) generate a single channel |
| 258 | * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit |
| 259 | * mask in the stencil buffer. In the non anti-aliasing case, if the clip |
| 260 | * mask can be represented as a rectangle then scissoring is used. In all |
| 261 | * cases scissoring is used to bound the range of the clip mask. |
| 262 | */ |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 263 | class GrClipMaskManager : public GrNoncopyable { |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 264 | public: |
robertphillips@google.com | 46a8600 | 2012-08-08 10:42:44 +0000 | [diff] [blame^] | 265 | GR_DECLARE_RESOURCE_CACHE_DOMAIN(GetAlphaMaskDomain) |
| 266 | |
bsalomon@google.com | 13b85aa | 2012-06-15 21:09:40 +0000 | [diff] [blame] | 267 | GrClipMaskManager(GrGpu* gpu) |
| 268 | : fGpu(gpu) |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 269 | , fCurrClipMaskType(kNone_ClipMaskType) { |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 270 | } |
| 271 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 272 | /** |
| 273 | * Creates a clip mask if necessary as a stencil buffer or alpha texture |
| 274 | * and sets the GrGpu's scissor and stencil state. If the return is false |
| 275 | * then the draw can be skipped. |
| 276 | */ |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 277 | bool setupClipping(const GrClipData* clipDataIn); |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 278 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 279 | void releaseResources(); |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 280 | |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 281 | bool isClipInStencil() const { |
| 282 | return kStencil_ClipMaskType == fCurrClipMaskType; |
| 283 | } |
| 284 | bool isClipInAlpha() const { |
| 285 | return kAlpha_ClipMaskType == fCurrClipMaskType; |
| 286 | } |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 287 | |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 288 | void invalidateStencilMask() { |
| 289 | if (kStencil_ClipMaskType == fCurrClipMaskType) { |
| 290 | fCurrClipMaskType = kNone_ClipMaskType; |
| 291 | } |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 292 | } |
| 293 | |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 294 | void setContext(GrContext* context) { |
| 295 | fAACache.setContext(context); |
| 296 | } |
| 297 | |
robertphillips@google.com | 2c75681 | 2012-05-22 20:28:23 +0000 | [diff] [blame] | 298 | GrContext* getContext() { |
| 299 | return fAACache.getContext(); |
| 300 | } |
| 301 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 302 | private: |
bsalomon@google.com | 411dad0 | 2012-06-05 20:24:20 +0000 | [diff] [blame] | 303 | /** |
| 304 | * Informs the helper function adjustStencilParams() about how the stencil |
| 305 | * buffer clip is being used. |
| 306 | */ |
| 307 | enum StencilClipMode { |
| 308 | // Draw to the clip bit of the stencil buffer |
| 309 | kModifyClip_StencilClipMode, |
| 310 | // Clip against the existing representation of the clip in the high bit |
| 311 | // of the stencil buffer. |
| 312 | kRespectClip_StencilClipMode, |
| 313 | // Neither writing to nor clipping against the clip bit. |
| 314 | kIgnoreClip_StencilClipMode, |
| 315 | }; |
| 316 | |
bsalomon@google.com | 13b85aa | 2012-06-15 21:09:40 +0000 | [diff] [blame] | 317 | GrGpu* fGpu; |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 318 | |
| 319 | /** |
| 320 | * We may represent the clip as a mask in the stencil buffer or as an alpha |
| 321 | * texture. It may be neither because the scissor rect suffices or we |
| 322 | * haven't yet examined the clip. |
| 323 | */ |
| 324 | enum ClipMaskType { |
| 325 | kNone_ClipMaskType, |
| 326 | kStencil_ClipMaskType, |
| 327 | kAlpha_ClipMaskType, |
| 328 | } fCurrClipMaskType; |
| 329 | |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 330 | GrClipMaskCache fAACache; // cache for the AA path |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 331 | |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 332 | bool createStencilClipMask(const GrClipData& clipDataIn, |
robertphillips@google.com | 7b11289 | 2012-07-31 15:18:21 +0000 | [diff] [blame] | 333 | const GrIRect& devClipBounds); |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 334 | bool createAlphaClipMask(const GrClipData& clipDataIn, |
robertphillips@google.com | a72eef3 | 2012-05-01 17:22:59 +0000 | [diff] [blame] | 335 | GrTexture** result, |
robertphillips@google.com | 7b11289 | 2012-07-31 15:18:21 +0000 | [diff] [blame] | 336 | GrIRect *devResultBounds); |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 337 | bool createSoftwareClipMask(const GrClipData& clipDataIn, |
robertphillips@google.com | 6b70a7b | 2012-05-11 15:32:48 +0000 | [diff] [blame] | 338 | GrTexture** result, |
robertphillips@google.com | 7b11289 | 2012-07-31 15:18:21 +0000 | [diff] [blame] | 339 | GrIRect *devResultBounds); |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 340 | bool clipMaskPreamble(const GrClipData& clipDataIn, |
robertphillips@google.com | 6b70a7b | 2012-05-11 15:32:48 +0000 | [diff] [blame] | 341 | GrTexture** result, |
robertphillips@google.com | 7b11289 | 2012-07-31 15:18:21 +0000 | [diff] [blame] | 342 | GrIRect *devResultBounds); |
robertphillips@google.com | f294b77 | 2012-04-27 14:29:26 +0000 | [diff] [blame] | 343 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 344 | bool useSWOnlyPath(const SkClipStack& clipIn); |
robertphillips@google.com | fa66294 | 2012-05-17 12:20:22 +0000 | [diff] [blame] | 345 | |
bsalomon@google.com | 13b85aa | 2012-06-15 21:09:40 +0000 | [diff] [blame] | 346 | bool drawClipShape(GrTexture* target, |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 347 | const SkClipStack::Iter::Clip* clip, |
robertphillips@google.com | 366f1c6 | 2012-06-29 21:38:47 +0000 | [diff] [blame] | 348 | const GrIRect& resultBounds); |
robertphillips@google.com | f294b77 | 2012-04-27 14:29:26 +0000 | [diff] [blame] | 349 | |
bsalomon@google.com | 13b85aa | 2012-06-15 21:09:40 +0000 | [diff] [blame] | 350 | void drawTexture(GrTexture* target, |
robertphillips@google.com | f294b77 | 2012-04-27 14:29:26 +0000 | [diff] [blame] | 351 | GrTexture* texture); |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 352 | |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 353 | void getTemp(const GrIRect& bounds, GrAutoScratchTexture* temp); |
robertphillips@google.com | f105b10 | 2012-05-14 12:18:26 +0000 | [diff] [blame] | 354 | |
robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 355 | void setupCache(const SkClipStack& clip, |
robertphillips@google.com | 6623fcd | 2012-05-15 16:47:23 +0000 | [diff] [blame] | 356 | const GrIRect& bounds); |
robertphillips@google.com | 6d62df4 | 2012-05-07 18:07:36 +0000 | [diff] [blame] | 357 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 358 | /** |
| 359 | * Called prior to return control back the GrGpu in setupClipping. It |
| 360 | * updates the GrGpu with stencil settings that account stencil-based |
| 361 | * clipping. |
| 362 | */ |
| 363 | void setGpuStencil(); |
| 364 | |
| 365 | /** |
| 366 | * Adjusts the stencil settings to account for interaction with stencil |
| 367 | * clipping. |
| 368 | */ |
| 369 | void adjustStencilParams(GrStencilSettings* settings, |
| 370 | StencilClipMode mode, |
| 371 | int stencilBitCnt); |
| 372 | |
robertphillips@google.com | fd6daf5 | 2012-05-02 19:32:32 +0000 | [diff] [blame] | 373 | typedef GrNoncopyable INHERITED; |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 374 | }; |
| 375 | |
| 376 | #endif // GrClipMaskManager_DEFINED |