michael@0: /* michael@0: * Copyright 2010 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: #ifndef GrClip_DEFINED michael@0: #define GrClip_DEFINED michael@0: michael@0: #include "SkClipStack.h" michael@0: michael@0: class GrSurface; michael@0: struct SkIRect; michael@0: michael@0: /** michael@0: * GrClipData encapsulates the information required to construct the clip michael@0: * masks. 'fOrigin' is only non-zero when saveLayer has been called michael@0: * with an offset bounding box. The clips in 'fClipStack' are in michael@0: * device coordinates (i.e., they have been translated by -fOrigin w.r.t. michael@0: * the canvas' device coordinates). michael@0: */ michael@0: class GrClipData : public SkNoncopyable { michael@0: public: michael@0: const SkClipStack* fClipStack; michael@0: SkIPoint fOrigin; michael@0: michael@0: GrClipData() michael@0: : fClipStack(NULL) { michael@0: fOrigin.setZero(); michael@0: } michael@0: michael@0: bool operator==(const GrClipData& other) const { michael@0: if (fOrigin != other.fOrigin) { michael@0: return false; michael@0: } michael@0: michael@0: if (NULL != fClipStack && NULL != other.fClipStack) { michael@0: return *fClipStack == *other.fClipStack; michael@0: } michael@0: michael@0: return fClipStack == other.fClipStack; michael@0: } michael@0: michael@0: bool operator!=(const GrClipData& other) const { michael@0: return !(*this == other); michael@0: } michael@0: michael@0: void getConservativeBounds(const GrSurface* surface, michael@0: SkIRect* devResult, michael@0: bool* isIntersectionOfRects = NULL) const; michael@0: }; michael@0: michael@0: #endif