2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrReducedClip_DEFINED
9 #define GrReducedClip_DEFINED
11 #include "SkClipStack.h"
14 class SK_API GrReducedClip {
16 typedef SkTLList<SkClipStack::Element> ElementList;
24 * This function takes a clip stack and a query rectangle and it produces a
25 * reduced set of SkClipStack::Elements that are equivalent to applying the
26 * full stack to the rectangle. The clip stack generation id that represents
27 * the list of elements is returned in resultGenID. The initial state of the
28 * query rectangle before the first clip element is applied is returned via
29 * initialState. Optionally, the caller can request a tighter bounds on the
30 * clip be returned via tighterBounds. If not NULL, tighterBounds will
31 * always be contained by queryBounds after return. If tighterBounds is
32 * specified then it is assumed that the caller will implicitly clip against
33 * it. If the caller specifies non-NULL for requiresAA then it will indicate
34 * whether anti-aliasing is required to process any of the elements in the
37 * This may become a member function of SkClipStack when its interface is
38 * determined to be stable.
40 static void ReduceClipStack(const SkClipStack& stack,
41 const SkIRect& queryBounds,
44 InitialState* initialState,
45 SkIRect* tighterBounds = NULL,
46 bool* requiresAA = NULL);