michael@0: michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #include "SkClipStack.h" michael@0: #include "SkTLList.h" michael@0: michael@0: namespace GrReducedClip { michael@0: michael@0: typedef SkTLList ElementList; michael@0: michael@0: enum InitialState { michael@0: kAllIn_InitialState, michael@0: kAllOut_InitialState, michael@0: }; michael@0: michael@0: /** michael@0: * This function takes a clip stack and a query rectangle and it produces a reduced set of michael@0: * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The clip michael@0: * stack generation id that represents the list of elements is returned in resultGenID. The michael@0: * initial state of the query rectangle before the first clip element is applied is returned via michael@0: * initialState. Optionally, the caller can request a tighter bounds on the clip be returned via michael@0: * tighterBounds. If not NULL, tighterBounds will always be contained by queryBounds after return. michael@0: * If tighterBounds is specified then it is assumed that the caller will implicitly clip against it. michael@0: * If the caller specifies non-NULL for requiresAA then it will indicate whether anti-aliasing is michael@0: * required to process any of the elements in the result. michael@0: * michael@0: * This may become a member function of SkClipStack when its interface is determined to be stable. michael@0: * Marked SK_API so that SkLua can call this in a shared library build. michael@0: */ michael@0: SK_API void ReduceClipStack(const SkClipStack& stack, michael@0: const SkIRect& queryBounds, michael@0: ElementList* result, michael@0: int32_t* resultGenID, michael@0: InitialState* initialState, michael@0: SkIRect* tighterBounds = NULL, michael@0: bool* requiresAA = NULL); michael@0: michael@0: } // namespace GrReducedClip