1170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 2170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com/* 3170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * Copyright 2012 Google Inc. 4170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * 5170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * Use of this source code is governed by a BSD-style license that can be 6170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * found in the LICENSE file. 7170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com */ 8170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 9170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com#include "SkClipStack.h" 10170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com#include "SkTLList.h" 11170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 12170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.comnamespace GrReducedClip { 13170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 14170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.comtypedef SkTLList<SkClipStack::Element> ElementList; 15170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 16170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.comenum InitialState { 17170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com kAllIn_InitialState, 18170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com kAllOut_InitialState, 19170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com}; 20170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 21170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com/** 22170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * This function takes a clip stack and a query rectangle and it produces a reduced set of 23d3e5842db0cb169e10d6da1e62c94ba5cf182bb4commit-bot@chromium.org * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The clip 24d3e5842db0cb169e10d6da1e62c94ba5cf182bb4commit-bot@chromium.org * stack generation id that represents the list of elements is returned in resultGenID. The 25170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com * initial state of the query rectangle before the first clip element is applied is returned via 2634cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * initialState. Optionally, the caller can request a tighter bounds on the clip be returned via 2734cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * tighterBounds. If not NULL, tighterBounds will always be contained by queryBounds after return. 2834cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * If tighterBounds is specified then it is assumed that the caller will implicitly clip against it. 2934cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * If the caller specifies non-NULL for requiresAA then it will indicate whether anti-aliasing is 3034cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * required to process any of the elements in the result. 3134cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * 3234cd70a5810b3cf37b44de1ce080a911a8b342c8bsalomon@google.com * This may become a member function of SkClipStack when its interface is determined to be stable. 334ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com * Marked SK_API so that SkLua can call this in a shared library build. 34170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com */ 354ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.comSK_API void ReduceClipStack(const SkClipStack& stack, 364ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com const SkIRect& queryBounds, 374ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com ElementList* result, 384ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com int32_t* resultGenID, 394ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com InitialState* initialState, 404ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com SkIRect* tighterBounds = NULL, 414ebe3821888d550d8a8b89341ec251ba942f0225bsalomon@google.com bool* requiresAA = NULL); 42170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com 43170bd792e17469769d145b7dc15dea6cd01b7966bsalomon@google.com} // namespace GrReducedClip 44