2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2005 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkRegion_DEFINED
|
|
|
|
#define SkRegion_DEFINED
|
|
|
|
|
|
|
|
#include "SkRect.h"
|
|
|
|
|
|
|
|
class SkPath;
|
|
|
|
class SkRgnBuilder;
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
class Region;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SkRegion_gEmptyRunHeadPtr ((SkRegion::RunHead*)-1)
|
|
|
|
#define SkRegion_gRectRunHeadPtr 0
|
|
|
|
|
|
|
|
/** \class SkRegion
|
|
|
|
|
|
|
|
The SkRegion class encapsulates the geometric region used to specify
|
|
|
|
clipping areas for drawing.
|
|
|
|
*/
|
2011-03-15 21:27:08 +00:00
|
|
|
class SK_API SkRegion {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
typedef int32_t RunType;
|
|
|
|
enum {
|
|
|
|
kRunTypeSentinel = 0x7FFFFFFF
|
|
|
|
};
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkRegion();
|
|
|
|
SkRegion(const SkRegion&);
|
|
|
|
explicit SkRegion(const SkIRect&);
|
|
|
|
~SkRegion();
|
|
|
|
|
|
|
|
SkRegion& operator=(const SkRegion&);
|
2011-03-18 14:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the two regions are equal. i.e. The enclose exactly
|
|
|
|
* the same area.
|
|
|
|
*/
|
2012-01-25 21:53:53 +00:00
|
|
|
bool operator==(const SkRegion& other) const;
|
2011-03-18 14:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the two regions are not equal.
|
|
|
|
*/
|
2012-01-25 21:53:53 +00:00
|
|
|
bool operator!=(const SkRegion& other) const {
|
|
|
|
return !(*this == other);
|
2008-12-17 15:59:43 +00:00
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Replace this region with the specified region, and return true if the
|
|
|
|
* resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool set(const SkRegion& src) {
|
|
|
|
SkASSERT(&src);
|
|
|
|
*this = src;
|
|
|
|
return !this->isEmpty();
|
|
|
|
}
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Swap the contents of this and the specified region. This operation
|
|
|
|
* is gauarenteed to never fail.
|
|
|
|
*/
|
|
|
|
void swap(SkRegion&);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
/** Return true if this region is empty */
|
2011-03-18 14:44:42 +00:00
|
|
|
bool isEmpty() const { return fRunHead == SkRegion_gEmptyRunHeadPtr; }
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/** Return true if this region is a single, non-empty rectangle */
|
2011-03-18 14:44:42 +00:00
|
|
|
bool isRect() const { return fRunHead == SkRegion_gRectRunHeadPtr; }
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/** Return true if this region consists of more than 1 rectangular area */
|
2011-03-18 14:44:42 +00:00
|
|
|
bool isComplex() const { return !this->isEmpty() && !this->isRect(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the bounds of this region. If the region is empty, returns an
|
|
|
|
* empty rectangle.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
const SkIRect& getBounds() const { return fBounds; }
|
|
|
|
|
2013-07-17 21:39:28 +00:00
|
|
|
/**
|
|
|
|
* Returns a value that grows approximately linearly with the number of
|
|
|
|
* intervals comprised in the region. Empty region will return 0, Rect
|
|
|
|
* will return 1, Complex will return a value > 1.
|
|
|
|
*
|
|
|
|
* Use this to compare two regions, where the larger count likely
|
|
|
|
* indicates a more complex region.
|
|
|
|
*/
|
|
|
|
int computeRegionComplexity() const;
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
2012-01-03 14:52:37 +00:00
|
|
|
* Returns true if the region is non-empty, and if so, appends the
|
|
|
|
* boundary(s) of the region to the specified path.
|
|
|
|
* If the region is empty, returns false, and path is left unmodified.
|
2011-03-18 14:44:42 +00:00
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool getBoundaryPath(SkPath* path) const;
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set the region to be empty, and return false, since the resulting
|
|
|
|
* region is empty
|
|
|
|
*/
|
|
|
|
bool setEmpty();
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* If rect is non-empty, set this region to that rectangle and return true,
|
|
|
|
* otherwise set this region to empty and return false.
|
|
|
|
*/
|
|
|
|
bool setRect(const SkIRect&);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* If left < right and top < bottom, set this region to that rectangle and
|
|
|
|
* return true, otherwise set this region to empty and return false.
|
|
|
|
*/
|
|
|
|
bool setRect(int32_t left, int32_t top, int32_t right, int32_t bottom);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set this region to the union of an array of rects. This is generally
|
|
|
|
* faster than calling region.op(rect, kUnion_Op) in a loop. If count is
|
|
|
|
* 0, then this region is set to the empty region.
|
|
|
|
* @return true if the resulting region is non-empty
|
2010-07-13 18:35:14 +00:00
|
|
|
*/
|
|
|
|
bool setRects(const SkIRect rects[], int count);
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set this region to the specified region, and return true if it is
|
|
|
|
* non-empty.
|
|
|
|
*/
|
|
|
|
bool setRegion(const SkRegion&);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set this region to the area described by the path, clipped.
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
* This produces a region that is identical to the pixels that would be
|
|
|
|
* drawn by the path (with no antialiasing) with the specified clip.
|
|
|
|
*/
|
|
|
|
bool setPath(const SkPath&, const SkRegion& clip);
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the specified rectangle has a non-empty intersection
|
|
|
|
* with this region.
|
|
|
|
*/
|
|
|
|
bool intersects(const SkIRect&) const;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the specified region has a non-empty intersection
|
|
|
|
* with this region.
|
|
|
|
*/
|
|
|
|
bool intersects(const SkRegion&) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the specified x,y coordinate is inside the region.
|
|
|
|
*/
|
|
|
|
bool contains(int32_t x, int32_t y) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the specified rectangle is completely inside the region.
|
|
|
|
* This works for simple (rectangular) and complex regions, and always
|
|
|
|
* returns the correct result. Note: if either this region or the rectangle
|
|
|
|
* is empty, contains() returns false.
|
|
|
|
*/
|
|
|
|
bool contains(const SkIRect&) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the specified region is completely inside the region.
|
|
|
|
* This works for simple (rectangular) and complex regions, and always
|
|
|
|
* returns the correct result. Note: if either region is empty, contains()
|
|
|
|
* returns false.
|
|
|
|
*/
|
|
|
|
bool contains(const SkRegion&) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this region is a single rectangle (not complex) and the
|
|
|
|
* specified rectangle is contained by this region. Returning false is not
|
|
|
|
* a guarantee that the rectangle is not contained by this region, but
|
|
|
|
* return true is a guarantee that the rectangle is contained by this region.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool quickContains(const SkIRect& r) const {
|
|
|
|
return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom);
|
|
|
|
}
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Return true if this region is a single rectangle (not complex) and the
|
|
|
|
* specified rectangle is contained by this region. Returning false is not
|
|
|
|
* a guarantee that the rectangle is not contained by this region, but
|
|
|
|
* return true is a guarantee that the rectangle is contained by this
|
|
|
|
* region.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool quickContains(int32_t left, int32_t top, int32_t right,
|
|
|
|
int32_t bottom) const {
|
|
|
|
SkASSERT(this->isEmpty() == fBounds.isEmpty()); // valid region
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
return left < right && top < bottom &&
|
|
|
|
fRunHead == SkRegion_gRectRunHeadPtr && // this->isRect()
|
|
|
|
/* fBounds.contains(left, top, right, bottom); */
|
|
|
|
fBounds.fLeft <= left && fBounds.fTop <= top &&
|
|
|
|
fBounds.fRight >= right && fBounds.fBottom >= bottom;
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Return true if this region is empty, or if the specified rectangle does
|
|
|
|
* not intersect the region. Returning false is not a guarantee that they
|
|
|
|
* intersect, but returning true is a guarantee that they do not.
|
|
|
|
*/
|
|
|
|
bool quickReject(const SkIRect& rect) const {
|
2008-12-17 15:59:43 +00:00
|
|
|
return this->isEmpty() || rect.isEmpty() ||
|
|
|
|
!SkIRect::Intersects(fBounds, rect);
|
|
|
|
}
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Return true if this region, or rgn, is empty, or if their bounds do not
|
|
|
|
* intersect. Returning false is not a guarantee that they intersect, but
|
|
|
|
* returning true is a guarantee that they do not.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool quickReject(const SkRegion& rgn) const {
|
|
|
|
return this->isEmpty() || rgn.isEmpty() ||
|
|
|
|
!SkIRect::Intersects(fBounds, rgn.fBounds);
|
|
|
|
}
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/** Translate the region by the specified (dx, dy) amount. */
|
2008-12-17 15:59:43 +00:00
|
|
|
void translate(int dx, int dy) { this->translate(dx, dy, this); }
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Translate the region by the specified (dx, dy) amount, writing the
|
|
|
|
* resulting region into dst. Note: it is legal to pass this region as the
|
|
|
|
* dst parameter, effectively translating the region in place. If dst is
|
|
|
|
* null, nothing happens.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
void translate(int dx, int dy, SkRegion* dst) const;
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* The logical operations that can be performed when combining two regions.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
enum Op {
|
|
|
|
kDifference_Op, //!< subtract the op region from the first region
|
|
|
|
kIntersect_Op, //!< intersect the two regions
|
|
|
|
kUnion_Op, //!< union (inclusive-or) the two regions
|
|
|
|
kXOR_Op, //!< exclusive-or the two regions
|
|
|
|
/** subtract the first region from the op region */
|
|
|
|
kReverseDifference_Op,
|
|
|
|
kReplace_Op //!< replace the dst region with the op region
|
|
|
|
};
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to this region and the
|
|
|
|
* specified rectangle: this = (this op rect).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(const SkIRect& rect, Op op) { return this->op(*this, rect, op); }
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to this region and the
|
|
|
|
* specified rectangle: this = (this op rect).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(int left, int top, int right, int bottom, Op op) {
|
|
|
|
SkIRect rect;
|
|
|
|
rect.set(left, top, right, bottom);
|
|
|
|
return this->op(*this, rect, op);
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to this region and the
|
|
|
|
* specified region: this = (this op rgn).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(const SkRegion& rgn, Op op) { return this->op(*this, rgn, op); }
|
2011-03-18 14:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to the specified
|
|
|
|
* rectangle and region: this = (rect op rgn).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(const SkIRect& rect, const SkRegion& rgn, Op);
|
2011-03-18 14:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to the specified
|
|
|
|
* region and rectangle: this = (rgn op rect).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(const SkRegion& rgn, const SkIRect& rect, Op);
|
2011-03-18 14:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set this region to the result of applying the Op to the specified
|
|
|
|
* regions: this = (rgna op rgnb).
|
|
|
|
* Return true if the resulting region is non-empty.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op);
|
|
|
|
|
2011-11-08 19:00:26 +00:00
|
|
|
#ifdef SK_BUILD_FOR_ANDROID
|
2011-03-14 20:30:14 +00:00
|
|
|
/** Returns a new char* containing the list of rectangles in this region
|
|
|
|
*/
|
|
|
|
char* toString();
|
|
|
|
#endif
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the sequence of rectangles, sorted in Y and X, that make up
|
|
|
|
* this region.
|
|
|
|
*/
|
2011-03-15 21:27:08 +00:00
|
|
|
class SK_API Iterator {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
Iterator() : fRgn(NULL), fDone(true) {}
|
|
|
|
Iterator(const SkRegion&);
|
|
|
|
// if we have a region, reset to it and return true, else return false
|
|
|
|
bool rewind();
|
|
|
|
// reset the iterator, using the new region
|
|
|
|
void reset(const SkRegion&);
|
2011-03-03 13:54:13 +00:00
|
|
|
bool done() const { return fDone; }
|
2008-12-17 15:59:43 +00:00
|
|
|
void next();
|
|
|
|
const SkIRect& rect() const { return fRect; }
|
2010-12-20 18:26:13 +00:00
|
|
|
// may return null
|
|
|
|
const SkRegion* rgn() const { return fRgn; }
|
2011-03-18 14:44:42 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
const SkRegion* fRgn;
|
|
|
|
const RunType* fRuns;
|
|
|
|
SkIRect fRect;
|
|
|
|
bool fDone;
|
|
|
|
};
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the sequence of rectangles, sorted in Y and X, that make up
|
|
|
|
* this region intersected with the specified clip rectangle.
|
|
|
|
*/
|
2011-03-15 21:27:08 +00:00
|
|
|
class SK_API Cliperator {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
Cliperator(const SkRegion&, const SkIRect& clip);
|
2011-03-18 14:44:42 +00:00
|
|
|
bool done() { return fDone; }
|
|
|
|
void next();
|
2008-12-17 15:59:43 +00:00
|
|
|
const SkIRect& rect() const { return fRect; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Iterator fIter;
|
|
|
|
SkIRect fClip;
|
|
|
|
SkIRect fRect;
|
|
|
|
bool fDone;
|
|
|
|
};
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the sequence of runs that make up this region for the specified
|
|
|
|
* Y scanline, clipped to the specified left and right X values.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
class Spanerator {
|
|
|
|
public:
|
|
|
|
Spanerator(const SkRegion&, int y, int left, int right);
|
2011-03-18 14:44:42 +00:00
|
|
|
bool next(int* left, int* right);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const SkRegion::RunType* fRuns;
|
|
|
|
int fLeft, fRight;
|
|
|
|
bool fDone;
|
|
|
|
};
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
|
|
|
* Write the region to the buffer, and return the number of bytes written.
|
|
|
|
* If buffer is NULL, it still returns the number of bytes.
|
|
|
|
*/
|
2013-11-04 21:35:55 +00:00
|
|
|
uint32_t writeToMemory(void* buffer) const;
|
|
|
|
|
2011-03-18 14:44:42 +00:00
|
|
|
/**
|
2013-11-04 21:35:55 +00:00
|
|
|
* Initialized the region from the buffer, returning the number
|
|
|
|
* of bytes actually read.
|
2011-03-18 14:44:42 +00:00
|
|
|
*/
|
2013-11-04 21:35:55 +00:00
|
|
|
uint32_t readFromMemory(const void* buffer);
|
2011-03-23 13:51:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a reference to a global empty region. Just a convenience for
|
|
|
|
* callers that need a const empty region.
|
|
|
|
*/
|
|
|
|
static const SkRegion& GetEmptyRegion();
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkDEBUGCODE(void dump() const;)
|
|
|
|
SkDEBUGCODE(void validate() const;)
|
|
|
|
SkDEBUGCODE(static void UnitTest();)
|
|
|
|
|
|
|
|
// expose this to allow for regression test on complex regions
|
|
|
|
SkDEBUGCODE(bool debugSetRuns(const RunType runs[], int count);)
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum {
|
|
|
|
kOpCount = kReplace_Op + 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2012-05-02 18:07:33 +00:00
|
|
|
// T
|
|
|
|
// [B N L R S]
|
|
|
|
// S
|
|
|
|
kRectRegionRuns = 7
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
friend class android::Region; // needed for marshalling efficiently
|
|
|
|
|
|
|
|
struct RunHead;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-05-01 14:43:22 +00:00
|
|
|
// allocate space for count runs
|
2012-05-02 18:07:33 +00:00
|
|
|
void allocateRuns(int count);
|
2012-05-01 14:43:22 +00:00
|
|
|
void allocateRuns(int count, int ySpanCount, int intervalCount);
|
|
|
|
void allocateRuns(const RunHead& src);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
SkIRect fBounds;
|
|
|
|
RunHead* fRunHead;
|
|
|
|
|
2012-05-02 18:07:33 +00:00
|
|
|
void freeRuns();
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-05-02 18:07:33 +00:00
|
|
|
/**
|
|
|
|
* Return the runs from this region, consing up fake runs if the region
|
|
|
|
* is empty or a rect. In those 2 cases, we use tmpStorage to hold the
|
|
|
|
* run data.
|
|
|
|
*/
|
2012-05-01 14:43:22 +00:00
|
|
|
const RunType* getRuns(RunType tmpStorage[], int* intervals) const;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-05-02 18:07:33 +00:00
|
|
|
// This is called with runs[] that do not yet have their interval-count
|
|
|
|
// field set on each scanline. That is computed as part of this call
|
|
|
|
// (inside ComputeRunBounds).
|
|
|
|
bool setRuns(RunType runs[], int count);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
int count_runtype_values(int* itop, int* ibot) const;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static void BuildRectRuns(const SkIRect& bounds,
|
|
|
|
RunType runs[kRectRegionRuns]);
|
2012-05-02 18:07:33 +00:00
|
|
|
|
|
|
|
// If the runs define a simple rect, return true and set bounds to that
|
|
|
|
// rect. If not, return false and ignore bounds.
|
|
|
|
static bool RunsAreARect(const SkRegion::RunType runs[], int count,
|
|
|
|
SkIRect* bounds);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2012-04-30 13:29:02 +00:00
|
|
|
/**
|
|
|
|
* If the last arg is null, just return if the result is non-empty,
|
|
|
|
* else store the result in the last arg.
|
|
|
|
*/
|
|
|
|
static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*);
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
friend struct RunHead;
|
|
|
|
friend class Iterator;
|
|
|
|
friend class Spanerator;
|
|
|
|
friend class SkRgnBuilder;
|
|
|
|
friend class SkFlatRegion;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|