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