Remove SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS (now unused).
authorsenorblanco <senorblanco@chromium.org>
Thu, 21 Jan 2016 14:49:15 +0000 (06:49 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 21 Jan 2016 14:49:15 +0000 (06:49 -0800)
BUG=skia:3194
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1616503002

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

src/core/SkCanvas.cpp
src/core/SkDevice.cpp
src/core/SkImageFilter.cpp
src/core/SkMatrixImageFilter.cpp
src/effects/SkOffsetImageFilter.cpp
src/effects/SkTileImageFilter.cpp
src/gpu/SkGpuDevice.cpp

index e577b21..cd7c6f8 100644 (file)
@@ -1071,25 +1071,11 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag
 
     const SkMatrix& ctm = fMCRec->fMatrix;  // this->getTotalMatrix()
 
-// This is a temporary hack, until individual filters can do their own
-// bloating, when this will be removed.
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    SkRect storage;
-#endif
     if (imageFilter) {
         imageFilter->filterBounds(clipBounds, ctm, &clipBounds);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-        if (bounds && imageFilter->canComputeFastBounds()) {
-            imageFilter->computeFastBounds(*bounds, &storage);
-            bounds = &storage;
-        } else {
-            bounds = nullptr;
-        }
-#else
         if (bounds && !imageFilter->canComputeFastBounds()) {
             bounds = nullptr;
         }
-#endif
     }
     SkIRect ir;
     if (bounds) {
@@ -1433,11 +1419,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
             const SkBitmap& src = srcDev->accessBitmap(false);
             SkMatrix matrix = *iter.fMatrix;
             matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()));
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-            SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height());
-#else
             SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x(), -pos.y());
-#endif
             SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache());
             SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
             if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
index 8ff5827..78aa3ee 100644 (file)
@@ -412,11 +412,7 @@ void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap
         SkIPoint offset = SkIPoint::Make(0, 0);
         SkMatrix matrix = *draw.fMatrix;
         matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-        const SkIRect clipBounds = bitmap.bounds();
-#else
         const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
-#endif
         SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
         SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
         if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
index 489a52b..141d2e0 100644 (file)
@@ -397,12 +397,8 @@ bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src,
     }
     src.getBounds(srcBounds);
     srcBounds->offset(srcOffset);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    return fCropRect.applyTo(*srcBounds, ctx, dstBounds);
-#else
     this->onFilterNodeBounds(*srcBounds, ctx.ctm(), dstBounds, kForward_MapDirection);
     return fCropRect.applyTo(*dstBounds, ctx, dstBounds);
-#endif
 }
 
 bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitmap& src,
@@ -410,13 +406,9 @@ bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitm
     SkIRect srcBounds;
     src.getBounds(&srcBounds);
     srcBounds.offset(*srcOffset);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    if (!fCropRect.applyTo(srcBounds, ctx, bounds)) {
-#else
     SkIRect dstBounds;
     this->onFilterNodeBounds(srcBounds, ctx.ctm(), &dstBounds, kForward_MapDirection);
     if (!fCropRect.applyTo(dstBounds, ctx, bounds)) {
-#endif
         return false;
     }
 
@@ -472,14 +464,10 @@ void SkImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix&,
 
 
 SkImageFilter::Context SkImageFilter::mapContext(const Context& ctx) const {
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    return ctx;
-#else
     SkIRect clipBounds;
     this->onFilterNodeBounds(ctx.clipBounds(), ctx.ctm(), &clipBounds,
                              MapDirection::kReverse_MapDirection);
     return Context(ctx.ctm(), clipBounds, ctx.cache());
-#endif
 }
 
 bool SkImageFilter::asFragmentProcessor(GrFragmentProcessor**, GrTexture*,
index 4138ccf..dd9e79f 100644 (file)
@@ -97,9 +97,6 @@ void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
         getInput(0)->computeFastBounds(src, &bounds);
     }
     fTransform.mapRect(dst, bounds);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    dst->join(bounds);   // Work around for skia:3194
-#endif
 }
 
 void SkMatrixImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
index e39c8d2..70247f2 100644 (file)
@@ -66,13 +66,7 @@ void SkOffsetImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
     } else {
         *dst = src;
     }
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    SkRect copy = *dst;
-#endif
     dst->offset(fOffset.fX, fOffset.fY);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    dst->join(copy);
-#endif
 }
 
 void SkOffsetImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
@@ -85,9 +79,6 @@ void SkOffsetImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix&
 
     *dst = src;
     dst->offset(SkScalarCeilToInt(vec.fX), SkScalarCeilToInt(vec.fY));
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    dst->join(src);
-#endif
 }
 
 SkFlattenable* SkOffsetImageFilter::CreateProc(SkReadBuffer& buffer) {
index 6da572b..55eb8a1 100644 (file)
@@ -113,9 +113,6 @@ void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c
     SkRect rect = kReverse_MapDirection == direction ? fSrcRect : fDstRect;
     ctm.mapRect(&rect);
     rect.roundOut(dst);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    dst->join(src);
-#endif
 }
 
 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
@@ -125,13 +122,7 @@ bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
 }
 
 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-    // This is a workaround for skia:3194.
-    *dst = src;
-    dst->join(fDstRect);
-#else
     *dst = fDstRect;
-#endif
 }
 
 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) {
index 0359b57..4fdd4ae 100644 (file)
@@ -1171,11 +1171,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
         SkIPoint offset = SkIPoint::Make(0, 0);
         SkMatrix matrix(*draw.fMatrix);
         matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-        SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
-#else
         SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-left, -top);
-#endif
         SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
         // This cache is transient, and is freed (along with all its contained
         // textures) when it goes out of scope.
@@ -1339,11 +1335,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
         SkIPoint offset = SkIPoint::Make(0, 0);
         SkMatrix matrix(*draw.fMatrix);
         matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
-        SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height());
-#else
         SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
-#endif
         // This cache is transient, and is freed (along with all its contained
         // textures) when it goes out of scope.
         SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());