1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/gpu/GrClipData.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* 1.5 + * Copyright 2010 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef GrClip_DEFINED 1.12 +#define GrClip_DEFINED 1.13 + 1.14 +#include "SkClipStack.h" 1.15 + 1.16 +class GrSurface; 1.17 +struct SkIRect; 1.18 + 1.19 +/** 1.20 + * GrClipData encapsulates the information required to construct the clip 1.21 + * masks. 'fOrigin' is only non-zero when saveLayer has been called 1.22 + * with an offset bounding box. The clips in 'fClipStack' are in 1.23 + * device coordinates (i.e., they have been translated by -fOrigin w.r.t. 1.24 + * the canvas' device coordinates). 1.25 + */ 1.26 +class GrClipData : public SkNoncopyable { 1.27 +public: 1.28 + const SkClipStack* fClipStack; 1.29 + SkIPoint fOrigin; 1.30 + 1.31 + GrClipData() 1.32 + : fClipStack(NULL) { 1.33 + fOrigin.setZero(); 1.34 + } 1.35 + 1.36 + bool operator==(const GrClipData& other) const { 1.37 + if (fOrigin != other.fOrigin) { 1.38 + return false; 1.39 + } 1.40 + 1.41 + if (NULL != fClipStack && NULL != other.fClipStack) { 1.42 + return *fClipStack == *other.fClipStack; 1.43 + } 1.44 + 1.45 + return fClipStack == other.fClipStack; 1.46 + } 1.47 + 1.48 + bool operator!=(const GrClipData& other) const { 1.49 + return !(*this == other); 1.50 + } 1.51 + 1.52 + void getConservativeBounds(const GrSurface* surface, 1.53 + SkIRect* devResult, 1.54 + bool* isIntersectionOfRects = NULL) const; 1.55 +}; 1.56 + 1.57 +#endif