1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/GrReducedClip.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2012 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 +#include "SkClipStack.h" 1.13 +#include "SkTLList.h" 1.14 + 1.15 +namespace GrReducedClip { 1.16 + 1.17 +typedef SkTLList<SkClipStack::Element> ElementList; 1.18 + 1.19 +enum InitialState { 1.20 + kAllIn_InitialState, 1.21 + kAllOut_InitialState, 1.22 +}; 1.23 + 1.24 +/** 1.25 + * This function takes a clip stack and a query rectangle and it produces a reduced set of 1.26 + * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The clip 1.27 + * stack generation id that represents the list of elements is returned in resultGenID. The 1.28 + * initial state of the query rectangle before the first clip element is applied is returned via 1.29 + * initialState. Optionally, the caller can request a tighter bounds on the clip be returned via 1.30 + * tighterBounds. If not NULL, tighterBounds will always be contained by queryBounds after return. 1.31 + * If tighterBounds is specified then it is assumed that the caller will implicitly clip against it. 1.32 + * If the caller specifies non-NULL for requiresAA then it will indicate whether anti-aliasing is 1.33 + * required to process any of the elements in the result. 1.34 + * 1.35 + * This may become a member function of SkClipStack when its interface is determined to be stable. 1.36 + * Marked SK_API so that SkLua can call this in a shared library build. 1.37 + */ 1.38 +SK_API void ReduceClipStack(const SkClipStack& stack, 1.39 + const SkIRect& queryBounds, 1.40 + ElementList* result, 1.41 + int32_t* resultGenID, 1.42 + InitialState* initialState, 1.43 + SkIRect* tighterBounds = NULL, 1.44 + bool* requiresAA = NULL); 1.45 + 1.46 +} // namespace GrReducedClip