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 GrReducedClip_DEFINED 10#define GrReducedClip_DEFINED 11 12#include "SkClipStack.h" 13#include "SkTLList.h" 14 15namespace GrReducedClip { 16 17typedef SkTLList<SkClipStack::Element> ElementList; 18 19enum InitialState { 20 kAllIn_InitialState, 21 kAllOut_InitialState, 22}; 23 24/** 25 * This function takes a clip stack and a query rectangle and it produces a reduced set of 26 * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The clip 27 * stack generation id that represents the list of elements is returned in resultGenID. The 28 * initial state of the query rectangle before the first clip element is applied is returned via 29 * initialState. Optionally, the caller can request a tighter bounds on the clip be returned via 30 * tighterBounds. If not NULL, tighterBounds will always be contained by queryBounds after return. 31 * If tighterBounds is specified then it is assumed that the caller will implicitly clip against it. 32 * If the caller specifies non-NULL for requiresAA then it will indicate whether anti-aliasing is 33 * required to process any of the elements in the result. 34 * 35 * This may become a member function of SkClipStack when its interface is determined to be stable. 36 * Marked SK_API so that SkLua can call this in a shared library build. 37 */ 38SK_API void ReduceClipStack(const SkClipStack& stack, 39 const SkIRect& queryBounds, 40 ElementList* result, 41 int32_t* resultGenID, 42 InitialState* initialState, 43 SkIRect* tighterBounds = NULL, 44 bool* requiresAA = NULL); 45 46} // namespace GrReducedClip 47 48#endif 49