/** Return true if the rectangle's width or height are <= 0
*/
bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
+ bool hasValidCoordinates() const;
SkScalar width() const { return fRight - fLeft; }
SkScalar height() const { return fBottom - fTop; }
SkScalar centerX() const { return SkScalarHalf(fLeft + fRight); }
antialiasing (worst case)
*/
bool SkCanvas::quickReject(const SkRect& rect, EdgeType et) const {
+
+ if (!rect.hasValidCoordinates())
+ return true;
+
if (fMCRec->fRegion->isEmpty()) {
return true;
}
*/
#include "SkRect.h"
+#include <limits>
void SkIRect::join(int32_t left, int32_t top, int32_t right, int32_t bottom)
{
/////////////////////////////////////////////////////////////////////////////
+template <typename NumType> static inline bool isValidRange(const NumType& x)
+{
+ static const NumType max = std::numeric_limits<NumType>::max();
+ return x >= -max && x <= max;
+}
+
+
+bool SkRect::hasValidCoordinates() const
+{
+ return isValidRange<SkScalar>(fLeft) && isValidRange<SkScalar>(fRight) &&
+ isValidRange<SkScalar>(fTop) && isValidRange<SkScalar>(fBottom);
+}
+
void SkRect::sort()
{
if (fLeft > fRight)