| bsalomon@google.com | 170bd79 | 2012-12-05 22:26:11 +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 | #include "SkClipStack.h" |
| 10 | #include "SkTLList.h" |
| 11 | |
| 12 | namespace GrReducedClip { |
| 13 | |
| 14 | typedef SkTLList<SkClipStack::Element> ElementList; |
| 15 | |
| 16 | enum InitialState { |
| 17 | kAllIn_InitialState, |
| 18 | kAllOut_InitialState, |
| 19 | }; |
| 20 | |
| 21 | /** |
| 22 | * This function takes a clip stack and a query rectangle and it produces a reduced set of |
| 23 | * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The |
| 24 | * initial state of the query rectangle before the first clip element is applied is returned via |
| 25 | * initialState. This function is declared here so that it can be unit-tested. It may become a |
| 26 | * member function of SkClipStack when its interface is determined to be stable. |
| 27 | */ |
| 28 | void GrReduceClipStack(const SkClipStack& stack, |
| 29 | const SkRect& queryBounds, |
| 30 | ElementList* result, |
| 31 | InitialState* initialState); |
| 32 | |
| 33 | } // namespace GrReducedClip |