diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/include/gpu/GrClipData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/include/gpu/GrClipData.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright 2010 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrClip_DEFINED +#define GrClip_DEFINED + +#include "SkClipStack.h" + +class GrSurface; +struct SkIRect; + +/** + * GrClipData encapsulates the information required to construct the clip + * masks. 'fOrigin' is only non-zero when saveLayer has been called + * with an offset bounding box. The clips in 'fClipStack' are in + * device coordinates (i.e., they have been translated by -fOrigin w.r.t. + * the canvas' device coordinates). + */ +class GrClipData : public SkNoncopyable { +public: + const SkClipStack* fClipStack; + SkIPoint fOrigin; + + GrClipData() + : fClipStack(NULL) { + fOrigin.setZero(); + } + + bool operator==(const GrClipData& other) const { + if (fOrigin != other.fOrigin) { + return false; + } + + if (NULL != fClipStack && NULL != other.fClipStack) { + return *fClipStack == *other.fClipStack; + } + + return fClipStack == other.fClipStack; + } + + bool operator!=(const GrClipData& other) const { + return !(*this == other); + } + + void getConservativeBounds(const GrSurface* surface, + SkIRect* devResult, + bool* isIntersectionOfRects = NULL) const; +}; + +#endif