Remove rect clip type from grclip.
authorbsalomon <bsalomon@google.com>
Fri, 6 Mar 2015 16:21:38 +0000 (08:21 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 6 Mar 2015 16:21:39 +0000 (08:21 -0800)
R=joshualitt@google.com
BUG=skia:
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/989443003

include/gpu/GrClip.h
src/gpu/GrClip.cpp
src/gpu/GrClipMaskManager.cpp

index e8f42a2..f260f05 100644 (file)
@@ -34,9 +34,12 @@ public:
         fClip.fIRect = rect;
     }
 
-    GrClip(const SkRect& rect) : fClipType(kRect_ClipType) {
+    GrClip(const SkRect& rect) : fClipType(kIRect_ClipType) {
         fOrigin.setZero();
-        fClip.fRect = rect;
+        fClip.fIRect.fLeft   = SkScalarRoundToInt(rect.fLeft);
+        fClip.fIRect.fTop    = SkScalarRoundToInt(rect.fTop);
+        fClip.fIRect.fRight  = SkScalarRoundToInt(rect.fRight);
+        fClip.fIRect.fBottom = SkScalarRoundToInt(rect.fBottom);
     }
 
     ~GrClip() { this->reset(); }
@@ -56,10 +59,6 @@ public:
                 fClip.fIRect = other.irect();
                 fOrigin.setZero();
                 break;
-            case kRect_ClipType:
-                fClip.fRect = other.rect();
-                fOrigin.setZero();
-                break;
         }
         return *this;
     }
@@ -86,9 +85,6 @@ public:
             case kIRect_ClipType:
                 return this->irect() == other.irect();
                 break;
-            case kRect_ClipType:
-                return this->rect() == other.rect();
-                break;
         }
     }
 
@@ -122,11 +118,6 @@ public:
         return fClip.fIRect;
     }
 
-    const SkRect& rect() const {
-        SkASSERT(kRect_ClipType == fClipType);
-        return fClip.fRect;
-    }
-
     void reset() {
         if (kClipStack_ClipType == fClipType) {
             fClip.fStack->unref();
@@ -146,15 +137,13 @@ public:
     bool isWideOpen(const SkRect& rect) const {
         return (kWideOpen_ClipType == fClipType) ||
                (kClipStack_ClipType == fClipType && this->clipStack()->isWideOpen()) ||
-               (kIRect_ClipType == fClipType && this->irect().contains(rect)) ||
-               (kRect_ClipType == fClipType && this->rect().contains(rect));
+               (kIRect_ClipType == fClipType && this->irect().contains(rect));
     }
 
     bool isWideOpen(const SkIRect& rect) const {
         return (kWideOpen_ClipType == fClipType) ||
                (kClipStack_ClipType == fClipType && this->clipStack()->isWideOpen()) ||
-               (kIRect_ClipType == fClipType && this->irect().contains(rect)) ||
-               (kRect_ClipType == fClipType && this->rect().contains(rect));
+               (kIRect_ClipType == fClipType && this->irect().contains(rect));
     }
 
     bool isWideOpen() const {
@@ -165,8 +154,7 @@ public:
     bool quickContains(const SkRect& rect) const {
         return (kWideOpen_ClipType == fClipType) ||
                (kClipStack_ClipType == fClipType && this->clipStack()->quickContains(rect)) ||
-               (kIRect_ClipType == fClipType && this->irect().contains(rect)) ||
-               (kRect_ClipType == fClipType && this->rect().contains(rect));
+               (kIRect_ClipType == fClipType && this->irect().contains(rect));
     }
 
     void getConservativeBounds(const GrSurface* surface,
@@ -186,7 +174,6 @@ public:
         kClipStack_ClipType,
         kWideOpen_ClipType,
         kIRect_ClipType,
-        kRect_ClipType,
     };
 
     ClipType clipType() const { return fClipType; }
@@ -194,7 +181,6 @@ public:
 private:
     union Clip {
         const SkClipStack* fStack;
-        SkRect fRect;
         SkIRect fIRect;
     } fClip;
 
index 63d8f51..5c4a27c 100644 (file)
@@ -33,15 +33,6 @@ void GrClip::getConservativeBounds(int width, int height, SkIRect* devResult,
                 *isIntersectionOfRects = true;
             }
         } break;
-        case kRect_ClipType: {
-            devResult->setLTRB(SkScalarCeilToInt(this->rect().fLeft),
-                               SkScalarCeilToInt(this->rect().fTop),
-                               SkScalarCeilToInt(this->rect().fRight),
-                               SkScalarCeilToInt(this->rect().fBottom));
-            if (isIntersectionOfRects) {
-                *isIntersectionOfRects = true;
-            }
-        } break;
         case kClipStack_ClipType: {
             SkRect devBounds;
             this->clipStack()->getConservativeBounds(-this->origin().fX,
index f0eb247..b58c565 100644 (file)
@@ -244,16 +244,6 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
             scissorState->set(clip.irect());
             this->setPipelineBuilderStencil(pipelineBuilder, ars);
             return true;
-        case GrClip::kRect_ClipType: {
-            const SkRect& rect = clip.rect();
-            SkIRect scissor;
-            scissor.fLeft   = SkScalarRoundToInt(rect.fLeft);
-            scissor.fTop    = SkScalarRoundToInt(rect.fTop);
-            scissor.fRight  = SkScalarRoundToInt(rect.fRight);
-            scissor.fBottom = SkScalarRoundToInt(rect.fBottom);
-            scissorState->set(scissor);
-            this->setPipelineBuilderStencil(pipelineBuilder, ars);
-        } return true;
         case GrClip::kClipStack_ClipType: {
             clipSpaceRTIBounds.offset(clip.origin());
             GrReducedClip::ReduceClipStack(*clip.clipStack(),