Begin removing deprecated (and now, unused) ImageFilter code paths
authorrobertphillips <robertphillips@google.com>
Wed, 20 Apr 2016 18:48:36 +0000 (11:48 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 20 Apr 2016 18:48:36 +0000 (11:48 -0700)
This CL focuses on removing the Proxy objects but takes some other stuff with it.

BUG=skia:4965
TBR=reed@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1896383003

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

24 files changed:
include/core/SkDevice.h
include/core/SkImageFilter.h
src/core/SkCanvas.cpp
src/core/SkDevice.cpp
src/core/SkImageFilter.cpp
src/core/SkSpecialImage.cpp
src/core/SkSpecialImage.h
src/core/SkSpecialSurface.cpp
src/core/SkSpecialSurface.h
src/effects/SkAlphaThresholdFilter.cpp
src/effects/SkBlurImageFilter.cpp
src/effects/SkDisplacementMapEffect.cpp
src/effects/SkImageSource.cpp
src/effects/SkLightingImageFilter.cpp
src/effects/SkMagnifierImageFilter.cpp
src/effects/SkMatrixConvolutionImageFilter.cpp
src/effects/SkMorphologyImageFilter.cpp
src/effects/SkXfermodeImageFilter.cpp
src/gpu/GrLayerHoister.cpp
tests/ImageFilterCacheTest.cpp
tests/ImageFilterTest.cpp
tests/SpecialImageTest.cpp
tests/SpecialSurfaceTest.cpp
tests/TestingSpecialImageAccess.h [deleted file]

index 83a7093607d35a9c213acb06dae14f0cafeba67c..c8a1d5eeb9ace75a67953e86e67d7c7450712184 100644 (file)
@@ -374,7 +374,6 @@ private:
     friend class SkDraw;
     friend class SkDrawIter;
     friend class SkDeviceFilteredPaint;
-    friend class SkImageFilter::DeviceProxy;
     friend class SkNoPixelsBitmapDevice;
     friend class SkSurface_Raster;
 
index a19633b7ab64fdcd9ea8a38d558886bba5f3e75c..8cab6ef3a7a71f7385e17bf12101647726e3c92f 100644 (file)
@@ -111,25 +111,6 @@ public:
         kNever_TileUsage,       //!< the created device will never be drawn tiled
     };
 
-    class Proxy {
-    public:
-        virtual ~Proxy() {}
-
-        virtual SkBaseDevice* createDevice(int width, int height,
-                                           TileUsage usage = kNever_TileUsage) = 0;
-    };
-
-    class DeviceProxy : public Proxy {
-    public:
-        DeviceProxy(SkBaseDevice* device) : fDevice(device) {}
-
-        SkBaseDevice* createDevice(int width, int height,
-                                   TileUsage usage = kNever_TileUsage) override;
-
-    private:
-        SkBaseDevice* fDevice;
-    };
-
     /**
      *  Request a new (result) image to be created from the src image.
      *
@@ -168,8 +149,7 @@ public:
 #if SK_SUPPORT_GPU
     static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context, 
                                             sk_sp<GrFragmentProcessor> fp,
-                                            const SkIRect& bounds,
-                                            SkImageFilter::Proxy* proxy);
+                                            const SkIRect& bounds);
 #endif
 
     /**
@@ -217,9 +197,7 @@ public:
      *  The size of the crop rect should be
      *  used as the size of the destination image. The origin of this rect
      *  should be used to offset access to the input images, and should also
-     *  be added to the "offset" parameter in onFilterImage and
-     *  filterImageGPU(). (The latter ensures that the resulting buffer is
-     *  drawn in the correct location.)
+     *  be added to the "offset" parameter in onFilterImage.
      */
     bool cropRectIsSet() const { return fCropRect.flags() != 0x0; }
 
@@ -257,12 +235,6 @@ public:
     }
 #endif
 
-
-    sk_sp<SkSpecialImage> filterInput(int index,
-                                      SkSpecialImage* src,
-                                      const Context&, 
-                                      SkIPoint* offset) const;
-
     SK_TO_STRING_PUREVIRT()
     SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
 
@@ -320,15 +292,15 @@ protected:
      *  Offset is the amount to translate the resulting image relative to the
      *  src when it is drawn. This is an out-param.
      *
-     *  If the result image cannot be created, this should false, in which
-     *  case both the result and offset parameters will be ignored by the
-     *  caller.
+     *  If the result image cannot be created (either because of error or if, say, the result
+     *  is entirely clipped out), this should return nullptr.
+     *  Callers that affect transparent black should explicitly handle nullptr
+     *  results and press on. In the error case this behavior will produce a better result
+     *  than nothing and is necessary for the clipped out case.
+     *  If the return value is nullptr then offset should be ignored.
      */
-    virtual bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
-                                         SkBitmap* result, SkIPoint* offset) const;
-
     virtual sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* src, const Context&,
-                                                SkIPoint* offset) const;
+                                                SkIPoint* offset) const = 0;
 
     /**
      * This function recurses into its inputs with the given rect (first
@@ -359,12 +331,13 @@ protected:
     virtual SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) const;
 
     // Helper function which invokes filter processing on the input at the
-    // specified "index". If the input is null, it leaves "result" and
-    // "offset" untouched, and returns true. If the input is non-null, it
-    // calls filterImage() on that input, and returns true on success.
-    // i.e., return !getInput(index) || getInput(index)->filterImage(...);
-    bool filterInputDeprecated(int index, Proxy*, const SkBitmap& src, const Context&,
-                               SkBitmap* result, SkIPoint* offset) const;
+    // specified "index". If the input is null, it returns "src" and leaves
+    // "offset" untouched. If the input is non-null, it
+    // calls filterImage() on that input, and returns the result.
+    sk_sp<SkSpecialImage> filterInput(int index,
+                                      SkSpecialImage* src,
+                                      const Context&, 
+                                      SkIPoint* offset) const;
 
     /**
      *  Return true (and return a ref'd colorfilter) if this node in the DAG is just a
@@ -409,8 +382,6 @@ private:
     static void PurgeCache();
 
     void init(sk_sp<SkImageFilter>* inputs, int inputCount, const CropRect* cropRect);
-    bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
-                               SkBitmap* result, SkIPoint* offset) const;
 
     bool usesSrcInput() const { return fUsesSrcInput; }
     virtual bool affectsTransparentBlack() const { return false; }
index b07b4316b91dfdbef1a291a38b12b22f511a69f3..3732a35b54169acaee5433e7a6cd9f6df1017047 100644 (file)
@@ -1408,7 +1408,6 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
         SkImageFilter* filter = paint->getImageFilter();
         SkIPoint pos = { x - iter.getX(), y - iter.getY() };
         if (filter) {
-            SkImageFilter::DeviceProxy proxy(dstDev);
             SkIPoint offset = SkIPoint::Make(0, 0);
             const SkBitmap& srcBM = srcDev->accessBitmap(false);
             SkMatrix matrix = *iter.fMatrix;
@@ -1417,7 +1416,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
             SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache());
             SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
 
-            sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, srcBM,
+            sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(srcBM,
                                                                          &dstDev->surfaceProps()));
             if (!srcImg) {
                 continue; // something disastrous happened
index d4bbc27ed6ac047b0faed3ed14d471d2b3d45cf9..24118f4662a7ef2a0ae061147cd6bff31416849a 100644 (file)
@@ -409,7 +409,6 @@ void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitm
     SkImageFilter* filter = paint.getImageFilter();
     SkASSERT(filter);
 
-    SkImageFilter::DeviceProxy proxy(this);
     SkIPoint offset = SkIPoint::Make(0, 0);
     SkMatrix matrix = *draw.fMatrix;
     matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
@@ -417,8 +416,7 @@ void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitm
     SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
     SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
 
-    sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bitmap,
-                                                                 &this->surfaceProps()));
+    sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this->surfaceProps()));
     if (!srcImg) {
         return; // something disastrous happened
     }
index b71b79a57b6be28ffc813f083929835ad365b021..18fafd9cffd32e78fb478f50e2701ecf795066f7 100644 (file)
@@ -229,7 +229,7 @@ sk_sp<SkSpecialImage> SkImageFilter::filterImage(SkSpecialImage* src, const Cont
         // Keep the result on the GPU - this is still required for some
         // image filters that don't support GPU in all cases
         GrContext* context = src->getContext();
-        result = result->makeTextureImage(src->internal_getProxy(), context);
+        result = result->makeTextureImage(context);
     }
 #endif
 
@@ -242,54 +242,6 @@ sk_sp<SkSpecialImage> SkImageFilter::filterImage(SkSpecialImage* src, const Cont
     return result;
 }
 
-bool SkImageFilter::filterImageDeprecated(Proxy* proxy, const SkBitmap& src,
-                                          const Context& context,
-                                          SkBitmap* result, SkIPoint* offset) const {
-    SkASSERT(result);
-    SkASSERT(offset);
-    uint32_t srcGenID = fUsesSrcInput ? src.getGenerationID() : 0;
-    Cache::Key key(fUniqueID, context.ctm(), context.clipBounds(),
-                   srcGenID, SkIRect::MakeWH(0, 0));
-    if (context.cache()) {
-        if (context.cache()->get(key, result, offset)) {
-            return true;
-        }
-    }
-    if (this->onFilterImageDeprecated(proxy, src, context, result, offset)) {
-        if (context.cache()) {
-            context.cache()->set(key, *result, *offset);
-            SkAutoMutexAcquire mutex(fMutex);
-            fCacheKeys.push_back(key);
-        }
-        return true;
-    }
-    return false;
-}
-
-bool SkImageFilter::filterInputDeprecated(int index, Proxy* proxy, const SkBitmap& src,
-                                          const Context& ctx,
-                                          SkBitmap* result, SkIPoint* offset) const {
-    SkImageFilter* input = this->getInput(index);
-    if (!input) {
-        return true;
-    }
-
-    // SRGBTODO: Don't handle sRGB here, in anticipation of this code path being deleted.
-    sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src, nullptr));
-    if (!specialSrc) {
-        return false;
-    }
-
-    sk_sp<SkSpecialImage> tmp(input->onFilterImage(specialSrc.get(),
-                                                   this->mapContext(ctx),
-                                                   offset));
-    if (!tmp) {
-        return false;
-    }
-
-    return tmp->internal_getBM(result);
-}
-
 SkIRect SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm,
                                  MapDirection direction) const {
     if (kReverse_MapDirection == direction) {
@@ -333,38 +285,10 @@ bool SkImageFilter::canComputeFastBounds() const {
     return true;
 }
 
-bool SkImageFilter::onFilterImageDeprecated(Proxy*, const SkBitmap&, const Context&,
-                                            SkBitmap*, SkIPoint*) const {
-    // Only classes that now use the new SkSpecialImage-based path will not have
-    // onFilterImageDeprecated methods. For those classes we should never be
-    // calling this method.
-    SkASSERT(0);
-    return false;
-}
-
-// SkImageFilter-derived classes that do not yet have their own onFilterImage
-// implementation convert back to calling the deprecated filterImage method
-sk_sp<SkSpecialImage> SkImageFilter::onFilterImage(SkSpecialImage* src, const Context& ctx,
-                                                   SkIPoint* offset) const {
-    SkBitmap srcBM, resultBM;
-
-    if (!src->internal_getBM(&srcBM)) {
-        return nullptr;
-    }
-
-    // This is the only valid call to the old filterImage path
-    if (!this->filterImageDeprecated(src->internal_getProxy(), srcBM, ctx, &resultBM, offset)) {
-        return nullptr;
-    }
-
-    return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM, &src->props());
-}
-
 #if SK_SUPPORT_GPU
 sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
                                                 sk_sp<GrFragmentProcessor> fp,
-                                                const SkIRect& bounds,
-                                                SkImageFilter::Proxy* proxy) {
+                                                const SkIRect& bounds) {
     GrPaint paint;
     paint.addColorFragmentProcessor(fp.get());
     paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
@@ -390,8 +314,7 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
     GrClip clip(dstRect);
     drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
 
-    return SkSpecialImage::MakeFromGpu(proxy,
-                                       SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                        kNeedNewImageUniqueID_SpecialImage,
                                        dst.get());
 
@@ -680,20 +603,3 @@ void SkImageFilter::PurgeCache() {
     Cache::Get()->purge();
 }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-SkBaseDevice* SkImageFilter::DeviceProxy::createDevice(int w, int h, TileUsage usage) {
-    SkBaseDevice::CreateInfo cinfo(SkImageInfo::MakeN32Premul(w, h),
-                                   kPossible_TileUsage == usage ? SkBaseDevice::kPossible_TileUsage
-                                                                : SkBaseDevice::kNever_TileUsage,
-                                   kUnknown_SkPixelGeometry,
-                                   false,   /* preserveLCDText */
-                                   true /*forImageFilter*/);
-    SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, nullptr);
-    if (nullptr == dev) {
-        const SkSurfaceProps surfaceProps(fDevice->fSurfaceProps.flags(),
-                                          kUnknown_SkPixelGeometry);
-        dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
-    }
-    return dev;
-}
index f7bbf9ecaa58a732d9547e77f4407672f69320df..bbc7635b66bbd96156270ee8a5c1ad4dcbfa4fa4 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 class SkSpecialImage_Base : public SkSpecialImage {
 public:
-    SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID,
-                        const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, uniqueID, props) {
+    SkSpecialImage_Base(const SkIRect& subset, uint32_t uniqueID, const SkSurfaceProps* props)
+        : INHERITED(subset, uniqueID, props) {
     }
-    virtual ~SkSpecialImage_Base() { }
+    ~SkSpecialImage_Base() override { }
 
     virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0;
 
@@ -55,18 +54,15 @@ static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) {
     return static_cast<const SkSpecialImage_Base*>(image);
 }
 
-SkSpecialImage::SkSpecialImage(SkImageFilter::Proxy* proxy,
-                               const SkIRect& subset,
+SkSpecialImage::SkSpecialImage(const SkIRect& subset,
                                uint32_t uniqueID,
                                const SkSurfaceProps* props)
     : fProps(SkSurfacePropsCopyOrDefault(props))
     , fSubset(subset)
-    , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() : uniqueID)
-    , fProxy(proxy) {
+    , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() : uniqueID) {
 }
 
-sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* proxy,
-                                                       GrContext* context) {
+sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) {
 #if SK_SUPPORT_GPU
     if (!context) {
         return nullptr;
@@ -81,7 +77,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro
     }
 
     if (bmp.empty()) {
-        return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp, &this->props());
+        return SkSpecialImage::MakeFromRaster(SkIRect::MakeEmpty(), bmp, &this->props());
     }
 
     SkAutoTUnref<GrTexture> resultTex(
@@ -92,8 +88,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro
 
     SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
 
-    return SkSpecialImage::MakeFromGpu(proxy,
-                                       SkIRect::MakeWH(resultTex->width(), resultTex->height()),
+    return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(resultTex->width(), resultTex->height()),
                                        this->uniqueID(),
                                        resultTex, &this->props(), at);
 #else
@@ -154,19 +149,17 @@ sk_sp<SkImage> SkSpecialImage::makeTightSubset(const SkIRect& subset) const {
 #include "SkGrPixelRef.h"
 #endif
 
-sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy,
-                                                      const SkBitmap& src,
+sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(const SkBitmap& src,
                                                       const SkSurfaceProps* props) {
     // Need to test offset case! (see skbug.com/4967)
     if (src.getTexture()) {
-        return SkSpecialImage::MakeFromGpu(proxy,
-                                           src.bounds(),
+        return SkSpecialImage::MakeFromGpu(src.bounds(),
                                            src.getGenerationID(),
                                            src.getTexture(),
                                            props);
     }
 
-    return SkSpecialImage::MakeFromRaster(proxy, src.bounds(), src, props);
+    return SkSpecialImage::MakeFromRaster(src.bounds(), src, props);
 }
 
 bool SkSpecialImage::internal_getBM(SkBitmap* result) {
@@ -176,10 +169,6 @@ bool SkSpecialImage::internal_getBM(SkBitmap* result) {
     return ib->getBitmapDeprecated(result);
 }
 
-SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const {
-    return fProxy;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 #include "SkImage.h"
 #if SK_SUPPORT_GPU
@@ -189,11 +178,10 @@ SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const {
 
 class SkSpecialImage_Image : public SkSpecialImage_Base {
 public:
-    SkSpecialImage_Image(SkImageFilter::Proxy* proxy,
-                         const SkIRect& subset,
+    SkSpecialImage_Image(const SkIRect& subset,
                          sk_sp<SkImage> image,
                          const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, image->uniqueID(), props)
+        : INHERITED(subset, image->uniqueID(), props)
         , fImage(image) {
     }
 
@@ -262,10 +250,10 @@ public:
             GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getContext()->caps());
             desc.fFlags = kRenderTarget_GrSurfaceFlag;
 
-            return SkSpecialSurface::MakeRenderTarget(this->proxy(), texture->getContext(), desc);
+            return SkSpecialSurface::MakeRenderTarget(texture->getContext(), desc);
         }
 #endif
-        return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr);
+        return SkSpecialSurface::MakeRaster(info, nullptr);
     }
 
     sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
@@ -274,8 +262,7 @@ public:
             return nullptr;
         }
 
-        return SkSpecialImage::MakeFromImage(this->internal_getProxy(),
-                                             SkIRect::MakeWH(subset.width(), subset.height()),
+        return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(subset.width(), subset.height()),
                                              subsetImg,
                                              &this->props());
     }
@@ -314,13 +301,12 @@ static bool rect_fits(const SkIRect& rect, int width, int height) {
 }
 #endif
 
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(SkImageFilter::Proxy* proxy,
-                                                    const SkIRect& subset,
+sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(const SkIRect& subset,
                                                     sk_sp<SkImage> image,
                                                     const SkSurfaceProps* props) {
     SkASSERT(rect_fits(subset, image->width(), image->height()));
 
-    return sk_make_sp<SkSpecialImage_Image>(proxy, subset, image, props);
+    return sk_make_sp<SkSpecialImage_Image>(subset, image, props);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -330,9 +316,8 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(SkImageFilter::Proxy* proxy,
 
 class SkSpecialImage_Raster : public SkSpecialImage_Base {
 public:
-    SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, const SkBitmap& bm,
-                          const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, bm.getGenerationID(), props)
+    SkSpecialImage_Raster(const SkIRect& subset, const SkBitmap& bm, const SkSurfaceProps* props)
+        : INHERITED(subset, bm.getGenerationID(), props)
         , fBitmap(bm) {
         if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) {
             // we only preemptively lock if there is no chance of triggering something expensive
@@ -341,13 +326,12 @@ public:
         }
     }
 
-    SkSpecialImage_Raster(SkImageFilter::Proxy* proxy,
-                          const SkIRect& subset,
+    SkSpecialImage_Raster(const SkIRect& subset,
                           const SkPixmap& pixmap,
                           RasterReleaseProc releaseProc,
                           ReleaseContext context,
                           const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, kNeedNewImageUniqueID_SpecialImage, props) {
+        : INHERITED(subset, kNeedNewImageUniqueID_SpecialImage, props) {
         fBitmap.installPixels(pixmap.info(), pixmap.writable_addr(),
                               pixmap.rowBytes(), pixmap.ctable(),
                               releaseProc, context);
@@ -388,7 +372,7 @@ public:
     }
 
     sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const override {
-        return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr);
+        return SkSpecialSurface::MakeRaster(info, nullptr);
     }
 
     sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
@@ -398,8 +382,7 @@ public:
             return nullptr;
         }
 
-        return SkSpecialImage::MakeFromRaster(this->internal_getProxy(),
-                                              SkIRect::MakeWH(subset.width(), subset.height()),
+        return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(subset.width(), subset.height()),
                                               subsetBM,
                                               &this->props());
     }
@@ -424,18 +407,16 @@ private:
     typedef SkSpecialImage_Base INHERITED;
 };
 
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(SkImageFilter::Proxy* proxy,
-                                                     const SkIRect& subset,
+sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(const SkIRect& subset,
                                                      const SkBitmap& bm,
                                                      const SkSurfaceProps* props) {
     SkASSERT(nullptr == bm.getTexture());
     SkASSERT(rect_fits(subset, bm.width(), bm.height()));
 
-    return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, bm, props);
+    return sk_make_sp<SkSpecialImage_Raster>(subset, bm, props);
 }
 
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(SkImageFilter::Proxy* proxy,
-                                                     const SkIRect& subset,
+sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(const SkIRect& subset,
                                                      const SkPixmap& src,
                                                      RasterReleaseProc releaseProc,
                                                      ReleaseContext context,
@@ -444,7 +425,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(SkImageFilter::Proxy* proxy
         return nullptr;
     }
 
-    return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, src, releaseProc, context, props);
+    return sk_make_sp<SkSpecialImage_Raster>(subset, src, releaseProc, context, props);
 }
 
 
@@ -455,10 +436,10 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(SkImageFilter::Proxy* proxy
 
 class SkSpecialImage_Gpu : public SkSpecialImage_Base {
 public:
-    SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset,
+    SkSpecialImage_Gpu(const SkIRect& subset,
                        uint32_t uniqueID, GrTexture* tex, SkAlphaType at,
                        const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, uniqueID, props)
+        : INHERITED(subset, uniqueID, props)
         , fTexture(SkRef(tex))
         , fAlphaType(at)
         , fAddedRasterVersionToCache(false) {
@@ -543,12 +524,11 @@ public:
         GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContext()->caps());
         desc.fFlags = kRenderTarget_GrSurfaceFlag;
 
-        return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getContext(), desc);
+        return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(), desc);
     }
 
     sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
-        return SkSpecialImage::MakeFromGpu(this->internal_getProxy(),
-                                           subset,
+        return SkSpecialImage::MakeFromGpu(subset,
                                            this->uniqueID(),
                                            fTexture,
                                            &this->props(),
@@ -592,20 +572,18 @@ private:
     typedef SkSpecialImage_Base INHERITED;
 };
 
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
-                                                  const SkIRect& subset,
+sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset,
                                                   uint32_t uniqueID,
                                                   GrTexture* tex,
                                                   const SkSurfaceProps* props,
                                                   SkAlphaType at) {
     SkASSERT(rect_fits(subset, tex->width(), tex->height()));
-    return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at, props);
+    return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, tex, at, props);
 }
 
 #else
 
-sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
-                                                  const SkIRect& subset,
+sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset,
                                                   uint32_t uniqueID,
                                                   GrTexture* tex,
                                                   const SkSurfaceProps* props,
index 2aa5bc6854d57824ffabd12008d7ed5840ae1060..aec344348c75b1bf0edc2d6f0ec144b2788c8004 100644 (file)
@@ -63,29 +63,25 @@ public:
      *  transformation is required, the returned image may be the same as this special image.
      *  If this special image is from a different GrContext, this will fail.
      */
-    sk_sp<SkSpecialImage> makeTextureImage(SkImageFilter::Proxy*, GrContext*);
+    sk_sp<SkSpecialImage> makeTextureImage(GrContext*);
 
     /**
      *  Draw this SpecialImage into the canvas.
      */
     void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const;
 
-    static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*,
-                                               const SkIRect& subset,
+    static sk_sp<SkSpecialImage> MakeFromImage(const SkIRect& subset,
                                                sk_sp<SkImage>,
                                                const SkSurfaceProps* = nullptr);
-    static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*,
-                                                const SkIRect& subset,
+    static sk_sp<SkSpecialImage> MakeFromRaster(const SkIRect& subset,
                                                 const SkBitmap&,
                                                 const SkSurfaceProps* = nullptr);
-    static sk_sp<SkSpecialImage> MakeFromGpu(SkImageFilter::Proxy*,
-                                             const SkIRect& subset,
+    static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset,
                                              uint32_t uniqueID,
                                              GrTexture*,
                                              const SkSurfaceProps* = nullptr,
                                              SkAlphaType at = kPremul_SkAlphaType);
-    static sk_sp<SkSpecialImage> MakeFromPixmap(SkImageFilter::Proxy*,
-                                                const SkIRect& subset,
+    static sk_sp<SkSpecialImage> MakeFromPixmap(const SkIRect& subset,
                                                 const SkPixmap&,
                                                 RasterReleaseProc,
                                                 ReleaseContext,
@@ -117,9 +113,7 @@ public:
 
     // These three internal methods will go away (see skbug.com/4965)
     bool internal_getBM(SkBitmap* result);
-    static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&,
-                                                 const SkSurfaceProps*);
-    SkImageFilter::Proxy* internal_getProxy() const;
+    static sk_sp<SkSpecialImage> internal_fromBM(const SkBitmap&, const SkSurfaceProps*);
 
     // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
     /**
@@ -148,24 +142,13 @@ public:
     bool getROPixels(SkBitmap*) const;
 
 protected:
-    SkSpecialImage(SkImageFilter::Proxy*, const SkIRect& subset, uint32_t uniqueID,
-                   const SkSurfaceProps*);
-
-    // The following 2 are for testing and shouldn't be used.
-    friend class TestingSpecialImageAccess;
-    friend class TestingSpecialSurfaceAccess;
-
-    // TODO: remove this ASAP (see skbug.com/4965)
-    SkImageFilter::Proxy* proxy() const { return fProxy; }
+    SkSpecialImage(const SkIRect& subset, uint32_t uniqueID, const SkSurfaceProps*);
 
 private:
     const SkSurfaceProps fProps;
     const SkIRect        fSubset;
     const uint32_t       fUniqueID;
 
-    // TODO: remove this ASAP (see skbug.com/4965)
-    SkImageFilter::Proxy* fProxy;
-
     typedef SkRefCnt INHERITED;
 };
 
index eecdaecd612b2c81be413d745f646f053f3b21c8..2e2d8cc54a64ea87cb348e2411673eb3688bd91c 100644 (file)
@@ -13,9 +13,8 @@
  ///////////////////////////////////////////////////////////////////////////////
 class SkSpecialSurface_Base : public SkSpecialSurface {
 public:
-    SkSpecialSurface_Base(SkImageFilter::Proxy* proxy,
-                          const SkIRect& subset, const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, props)
+    SkSpecialSurface_Base(const SkIRect& subset, const SkSurfaceProps* props)
+        : INHERITED(subset, props)
         , fCanvas(nullptr) {
     }
 
@@ -41,12 +40,10 @@ static SkSpecialSurface_Base* as_SB(SkSpecialSurface* surface) {
     return static_cast<SkSpecialSurface_Base*>(surface);
 }
 
-SkSpecialSurface::SkSpecialSurface(SkImageFilter::Proxy* proxy,
-                                   const SkIRect& subset,
+SkSpecialSurface::SkSpecialSurface(const SkIRect& subset,
                                    const SkSurfaceProps* props)
     : fProps(SkSurfacePropsCopyOrDefault(props).flags(), kUnknown_SkPixelGeometry)
-    , fSubset(subset)
-    , fProxy(proxy) {
+    , fSubset(subset) {
     SkASSERT(fSubset.width() > 0);
     SkASSERT(fSubset.height() > 0);
 }
@@ -66,11 +63,10 @@ sk_sp<SkSpecialImage> SkSpecialSurface::makeImageSnapshot() {
 
 class SkSpecialSurface_Raster : public SkSpecialSurface_Base {
 public:
-    SkSpecialSurface_Raster(SkImageFilter::Proxy* proxy,
-                            SkPixelRef* pr,
+    SkSpecialSurface_Raster(SkPixelRef* pr,
                             const SkIRect& subset,
                             const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, props) {
+        : INHERITED(subset, props) {
         const SkImageInfo& info = pr->info();
 
         fBitmap.setInfo(info, info.minRowBytes());
@@ -83,8 +79,7 @@ public:
     ~SkSpecialSurface_Raster() override { }
 
     sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
-        return SkSpecialImage::MakeFromRaster(this->proxy(), this->subset(), fBitmap,
-                                              &this->props());
+        return SkSpecialImage::MakeFromRaster(this->subset(), fBitmap, &this->props());
     }
 
 private:
@@ -93,14 +88,12 @@ private:
     typedef SkSpecialSurface_Base INHERITED;
 };
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromBitmap(SkImageFilter::Proxy* proxy,
-                                                         const SkIRect& subset, SkBitmap& bm,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromBitmap(const SkIRect& subset, SkBitmap& bm,
                                                          const SkSurfaceProps* props) {
-    return sk_make_sp<SkSpecialSurface_Raster>(proxy, bm.pixelRef(), subset, props);
+    return sk_make_sp<SkSpecialSurface_Raster>(bm.pixelRef(), subset, props);
 }
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(SkImageFilter::Proxy* proxy,
-                                                     const SkImageInfo& info,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(const SkImageInfo& info,
                                                      const SkSurfaceProps* props) {
     SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, 0, nullptr));
     if (nullptr == pr.get()) {
@@ -109,7 +102,7 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(SkImageFilter::Proxy* proxy
 
     const SkIRect subset = SkIRect::MakeWH(pr->info().width(), pr->info().height());
 
-    return sk_make_sp<SkSpecialSurface_Raster>(proxy, pr, subset, props);
+    return sk_make_sp<SkSpecialSurface_Raster>(pr, subset, props);
 }
 
 #if SK_SUPPORT_GPU
@@ -119,11 +112,10 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(SkImageFilter::Proxy* proxy
 
 class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
 public:
-    SkSpecialSurface_Gpu(SkImageFilter::Proxy* proxy,
-                         GrTexture* texture,
+    SkSpecialSurface_Gpu(GrTexture* texture,
                          const SkIRect& subset,
                          const SkSurfaceProps* props)
-        : INHERITED(proxy, subset, props)
+        : INHERITED(subset, props)
         , fTexture(SkRef(texture)) {
 
         SkASSERT(fTexture->asRenderTarget());
@@ -141,7 +133,7 @@ public:
     ~SkSpecialSurface_Gpu() override { }
 
     sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
-        return SkSpecialImage::MakeFromGpu(this->proxy(), this->subset(),
+        return SkSpecialImage::MakeFromGpu(this->subset(),
                                            kNeedNewImageUniqueID_SpecialImage, fTexture,
                                            &this->props());
     }
@@ -152,19 +144,17 @@ private:
     typedef SkSpecialSurface_Base INHERITED;
 };
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(SkImageFilter::Proxy* proxy,
-                                                          const SkIRect& subset,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(const SkIRect& subset,
                                                           GrTexture* texture,
                                                           const SkSurfaceProps* props) {
     if (!texture->asRenderTarget()) {
         return nullptr;
     }
 
-    return sk_make_sp<SkSpecialSurface_Gpu>(proxy, texture, subset, props);
+    return sk_make_sp<SkSpecialSurface_Gpu>(texture, subset, props);
 }
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy* proxy,
-                                                           GrContext* context,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
                                                            const GrSurfaceDesc& desc,
                                                            const SkSurfaceProps* props) {
     if (!context || !SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
@@ -178,20 +168,18 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy*
 
     const SkIRect subset = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
 
-    return sk_make_sp<SkSpecialSurface_Gpu>(proxy, temp, subset, props);
+    return sk_make_sp<SkSpecialSurface_Gpu>(temp, subset, props);
 }
 
 #else
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(SkImageFilter::Proxy* proxy,
-                                                          const SkIRect& subset,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(const SkIRect& subset,
                                                           GrTexture*,
                                                           const SkSurfaceProps*) {
     return nullptr;
 }
 
-sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy* proxy,
-                                                           GrContext* context,
+sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
                                                            const GrSurfaceDesc& desc,
                                                            const SkSurfaceProps* props) {
     return nullptr;
index d24ee745692d7059a61d0148f4140da231529bb3..6ed8a77da56ca079934058b0065e56a1e958360f 100644 (file)
@@ -53,23 +53,20 @@ public:
     /**
      *  Use an existing (renderTarget-capable) GrTexture as the backing store.
      */
-    static sk_sp<SkSpecialSurface> MakeFromTexture(SkImageFilter::Proxy* proxy,
-                                                   const SkIRect& subset, GrTexture*,
+    static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, GrTexture*,
                                                    const SkSurfaceProps* = nullptr);
 
     /**
      *  Allocate a new GPU-backed SkSpecialSurface. If the requested surface cannot
      *  be created, nullptr will be returned.
      */
-    static sk_sp<SkSpecialSurface> MakeRenderTarget(SkImageFilter::Proxy* proxy,
-                                                    GrContext*, const GrSurfaceDesc&,
+    static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, const GrSurfaceDesc&,
                                                     const SkSurfaceProps* = nullptr);
 
     /**
      * Use and existing SkBitmap as the backing store.
      */
-    static sk_sp<SkSpecialSurface> MakeFromBitmap(SkImageFilter::Proxy* proxy,
-                                                  const SkIRect& subset, SkBitmap& bm,
+    static sk_sp<SkSpecialSurface> MakeFromBitmap(const SkIRect& subset, SkBitmap& bm,
                                                   const SkSurfaceProps* = nullptr);
 
     /**
@@ -79,27 +76,20 @@ public:
      *  If the requested surface cannot be created, or the request is not a
      *  supported configuration, nullptr will be returned.
      */
-    static sk_sp<SkSpecialSurface> MakeRaster(SkImageFilter::Proxy* proxy,
-                                              const SkImageInfo&,
+    static sk_sp<SkSpecialSurface> MakeRaster(const SkImageInfo&,
                                               const SkSurfaceProps* = nullptr);
 
 protected:
-    SkSpecialSurface(SkImageFilter::Proxy*, const SkIRect& subset, const SkSurfaceProps*);
+    SkSpecialSurface(const SkIRect& subset, const SkSurfaceProps*);
 
     // For testing only
     friend class TestingSpecialSurfaceAccess;
     const SkIRect& subset() const { return fSubset; }
 
-    // TODO: remove this ASAP (see skbug.com/4965)
-    SkImageFilter::Proxy* proxy() const { return fProxy; }
-
 private:
     const SkSurfaceProps fProps;
     const SkIRect        fSubset;
 
-    // TODO: remove this ASAP (see skbug.com/4965)
-    SkImageFilter::Proxy* fProxy;
-
     typedef SkRefCnt INHERITED;
 };
 
index 0d16ec685ed4f1ee57c994e0e976e5674c3794fb..bf2a3fda1c1998d6256925d8637a8c9f253e20a7 100644 (file)
@@ -187,7 +187,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
             return nullptr;
         }
 
-        return DrawWithFP(context, std::move(fp), bounds, source->internal_getProxy());
+        return DrawWithFP(context, std::move(fp), bounds);
     }
 #endif
 
@@ -262,8 +262,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
 
     offset->fX = bounds.left();
     offset->fY = bounds.top();
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst);
 }
 
index 3ed88f153482094199b19ac5bf492f8f678a5054..d233c04ea7c3e1e67f8871090a1b5ed8f3aa63b5 100644 (file)
@@ -133,8 +133,7 @@ sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
             return nullptr;
         }
 
-        return SkSpecialImage::MakeFromGpu(source->internal_getProxy(),
-                                           SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
+        return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
                                            kNeedNewImageUniqueID_SpecialImage,
                                            tex, &source->props());
     }
@@ -225,8 +224,7 @@ sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
         SkOpts::box_blur_xy(t,  h,  dstBoundsT,   d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
     }
 
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(dstBounds.width(),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(dstBounds.width(),
                                                           dstBounds.height()),
                                           dst, &source->props());
 }
index b715f6a4f3b5635d65cf0fa4c07eba7962584b72..c52b9587462e9b5ac304d9ad2887961f7b35cc42 100644 (file)
@@ -355,8 +355,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
 
         offset->fX = bounds.left();
         offset->fY = bounds.top();
-        return SkSpecialImage::MakeFromGpu(source->internal_getProxy(),
-                                           SkIRect::MakeWH(bounds.width(), bounds.height()),
+        return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                            kNeedNewImageUniqueID_SpecialImage,
                                            dst);
     }
@@ -393,8 +392,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
 
     offset->fX = bounds.left();
     offset->fY = bounds.top();
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst);
 }
 
index e00bced4c4912b642ae70305d69b9d936503e20c..f3fc05491e1706d01f2ca6a9e11e9caf349620aa 100644 (file)
@@ -86,8 +86,7 @@ sk_sp<SkSpecialImage> SkImageSource::onFilterImage(SkSpecialImage* source, const
     if (fSrcRect == bounds && dstRect == bounds) {
         // No regions cropped out or resized; return entire image.
         offset->fX = offset->fY = 0;
-        return SkSpecialImage::MakeFromImage(source->internal_getProxy(),
-                                             SkIRect::MakeWH(fImage->width(), fImage->height()),
+        return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(fImage->width(), fImage->height()),
                                              fImage,
                                              &source->props());
     }
index b37fc28b2a6961554e7054a385ee002901c5ac33..7f0e3eab4b8584d10eccb25e640ed80efb8e98ae 100644 (file)
@@ -460,8 +460,7 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
     this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
                    kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
 
-    return SkSpecialImage::MakeFromGpu(source->internal_getProxy(),
-                                       SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
+    return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
                                        kNeedNewImageUniqueID_SpecialImage,
                                        dst.get());
 }
@@ -1326,8 +1325,7 @@ sk_sp<SkSpecialImage> SkDiffuseLightingImageFilter::onFilterImage(SkSpecialImage
             break;
     }
 
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst);
 }
 
@@ -1493,9 +1491,7 @@ sk_sp<SkSpecialImage> SkSpecularLightingImageFilter::onFilterImage(SkSpecialImag
             break;
     }
 
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
-                                          dst);
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()), dst);
 }
 
 #ifndef SK_IGNORE_TO_STRING
index 9ab18a7582ccf975d60458b2f0e04e3fde444e6b..517e31d2505470c42a1d3b5970c5d1226281b606 100644 (file)
@@ -337,7 +337,7 @@ sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(SkSpecialImage* sour
             return nullptr;
         }
 
-        return DrawWithFP(context, std::move(fp), bounds, source->internal_getProxy());
+        return DrawWithFP(context, std::move(fp), bounds);
     }
 #endif
 
@@ -408,8 +408,7 @@ sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(SkSpecialImage* sour
 
     offset->fX = bounds.left();
     offset->fY = bounds.top();
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst);
 }
 
index 51e3b6faa72f6af926c98d3d181a97a60263c58e..f5d9a3f7d220e2fd01b6a964334be0799c4b7720 100644 (file)
@@ -329,7 +329,7 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma
             return nullptr;
         }
 
-        return DrawWithFP(context, std::move(fp), bounds, source->internal_getProxy());
+        return DrawWithFP(context, std::move(fp), bounds);
     }
 #endif
 
@@ -381,8 +381,7 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma
     this->filterInteriorPixels(inputBM, &dst, interior, bounds);
     this->filterBorderPixels(inputBM, &dst, right, bounds);
     this->filterBorderPixels(inputBM, &dst, bottom, bounds);
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst);
 }
 
index 1f22a6e19453480bb70417e464fd19c216d13308..d5a048c6ce554d6f75939421c9d48b52a2b2c23d 100644 (file)
@@ -533,8 +533,7 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
         srcTexture.reset(scratch);
     }
 
-    return SkSpecialImage::MakeFromGpu(input->internal_getProxy(),
-                                       SkIRect::MakeWH(rect.width(), rect.height()),
+    return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
                                        kNeedNewImageUniqueID_SpecialImage,
                                        srcTexture, &input->props());
 }
@@ -644,7 +643,6 @@ sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou
     offset->fX = bounds.left();
     offset->fY = bounds.top();
 
-    return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
-                                          SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                           dst, &source->props());
 }
index af58a644eeeb5e57efbe80111569418d6ffeae07..25a750eefbd625477f95dc97de8270104ae6027f 100644 (file)
@@ -257,8 +257,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour
     matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
     drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds));
 
-    return SkSpecialImage::MakeFromGpu(source->internal_getProxy(),
-                                       SkIRect::MakeWH(bounds.width(), bounds.height()),
+    return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
                                        kNeedNewImageUniqueID_SpecialImage,
                                        dst.get());
 }
index 9a2be0be6044034af55b8e2b3bc8c68e1715144e..38aff8c2f37c3276ef936f7dc291ef5eb5586369 100644 (file)
@@ -300,11 +300,9 @@ void GrLayerHoister::FilterLayer(GrContext* context,
     SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefaultCacheSize));
     SkImageFilter::Context filterContext(totMat, clipBounds, cache);
 
-    SkImageFilter::DeviceProxy proxy(device);
-
     // TODO: should the layer hoister store stand alone layers as SkSpecialImages internally?
     const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->texture()->height());
-    sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(&proxy, subset,
+    sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset,
                                                           kNeedNewImageUniqueID_SpecialImage,
                                                           layer->texture(),
                                                           &device->surfaceProps()));
index 688069ea45908a8fb6958515ff0936aa51bb25ea..40c805a14ec9c140e38d42bca088c49a981d545d 100644 (file)
@@ -138,11 +138,11 @@ DEF_TEST(ImageFilterCache_RasterBacked, reporter) {
 
     const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
 
-    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromRaster(nullptr, full, srcBM));
+    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromRaster(full, srcBM));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
-    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromRaster(nullptr, subset, srcBM));
+    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromRaster(subset, srcBM));
 
     test_find_existing(reporter, fullImg, subsetImg);
     test_dont_find_if_diff_key(reporter, fullImg, subsetImg);
@@ -155,11 +155,11 @@ DEF_TEST(ImageFilterCache_RasterBacked, reporter) {
 static void test_image_backed(skiatest::Reporter* reporter, const sk_sp<SkImage>& srcImage) {
     const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
 
-    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromImage(nullptr, full, srcImage));
+    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromImage(full, srcImage));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
-    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromImage(nullptr, subset, srcImage));
+    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromImage(subset, srcImage));
 
     test_find_existing(reporter, fullImg, subsetImg);
     test_dont_find_if_diff_key(reporter, fullImg, subsetImg);
@@ -220,13 +220,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
 
     const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
 
-    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(nullptr, full,
+    sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full,
                                                               kNeedNewImageUniqueID_SpecialImage,
                                                               srcTexture));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
-    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(nullptr, subset,
+    sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset,
                                                                 kNeedNewImageUniqueID_SpecialImage,
                                                                 srcTexture));
 
index e22d636d6791f05c86dfdc6abdb733898d042735..4db9196db9bb220f2d0fb5c7e41b965b7d401876 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "SkBitmap.h"
-#include "SkBitmapDevice.h"
 #include "SkBlurImageFilter.h"
 #include "SkCanvas.h"
 #include "SkColorFilterImageFilter.h"
 #include "SkTileImageFilter.h"
 #include "SkXfermodeImageFilter.h"
 #include "Test.h"
-#include "TestingSpecialImageAccess.h"
 
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
-#include "SkGpuDevice.h"
 #endif
 
 static const int kBitmapSize = 4;
@@ -370,27 +367,23 @@ static sk_sp<SkImageFilter> make_blue(sk_sp<SkImageFilter> input,
     return SkColorFilterImageFilter::Make(std::move(filter), std::move(input), cropRect);
 }
 
-static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
-                                                            SkImageFilter::Proxy* proxy,
-                                                            int widthHeight) {
+static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
     if (context) {
         GrSurfaceDesc desc;
         desc.fConfig = kSkia8888_GrPixelConfig;
         desc.fFlags  = kRenderTarget_GrSurfaceFlag;
         desc.fWidth  = widthHeight;
         desc.fHeight = widthHeight;
-        return SkSpecialSurface::MakeRenderTarget(proxy, context, desc);
+        return SkSpecialSurface::MakeRenderTarget(context, desc);
     } else {
         const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
                                                       kOpaque_SkAlphaType);
-        return SkSpecialSurface::MakeRaster(proxy, info);
+        return SkSpecialSurface::MakeRaster(info);
     }
 }
 
-static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context,
-                                                        SkImageFilter::Proxy* proxy,
-                                                        int widthHeight) {
-    sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, proxy, widthHeight));
+static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int widthHeight) {
+    sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, widthHeight));
 
     SkASSERT(surf);
 
@@ -521,13 +514,12 @@ DEF_TEST(ImageFilter, reporter) {
     }
 }
 
-static void test_crop_rects(SkImageFilter::Proxy* proxy,
-                            skiatest::Reporter* reporter,
+static void test_crop_rects(skiatest::Reporter* reporter,
                             GrContext* context) {
     // Check that all filters offset to their absolute crop rect,
     // unaffected by the input crop rect.
     // Tests pass by not asserting.
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
     SkASSERT(srcImg);
 
     SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80));
@@ -546,8 +538,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy,
     }
 }
 
-static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy,
-                                     skiatest::Reporter* reporter,
+static void test_negative_blur_sigma(skiatest::Reporter* reporter,
                                      GrContext* context) {
     // Check that SkBlurImageFilter will accept a negative sigma, either in
     // the given arguments or after CTM application.
@@ -558,8 +549,7 @@ static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy,
     sk_sp<SkImageFilter> negativeFilter(SkBlurImageFilter::Make(-five, five, nullptr));
 
     SkBitmap gradient = make_gradient_circle(width, height);
-    sk_sp<SkSpecialImage> imgSrc(SkSpecialImage::MakeFromRaster(proxy,
-                                                                SkIRect::MakeWH(width, height),
+    sk_sp<SkSpecialImage> imgSrc(SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(width, height),
                                                                 gradient));
 
     SkIPoint offset;
@@ -623,62 +613,23 @@ static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy,
     }
 }
 
-typedef void (*PFTest)(SkImageFilter::Proxy* proxy,
-                       skiatest::Reporter* reporter,
-                       GrContext* context);
-
-static void run_raster_test(skiatest::Reporter* reporter,
-                            int widthHeight,
-                            PFTest test) {
-    const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
-
-    const SkImageInfo info = SkImageInfo::MakeN32Premul(widthHeight, widthHeight);
-
-    sk_sp<SkBaseDevice> device(SkBitmapDevice::Create(info, props));
-    SkImageFilter::DeviceProxy proxy(device.get());
-
-    (*test)(&proxy, reporter, nullptr);
-}
-
-#if SK_SUPPORT_GPU
-static void run_gpu_test(skiatest::Reporter* reporter,
-                         GrContext* context,
-                         int widthHeight,
-                         PFTest test) {
-    const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
-
-    sk_sp<SkGpuDevice> device(SkGpuDevice::Create(context,
-                                                  SkBudgeted::kNo,
-                                                  SkImageInfo::MakeN32Premul(widthHeight,
-                                                                             widthHeight),
-                                                  0,
-                                                  &props,
-                                                  SkGpuDevice::kUninit_InitContents));
-    SkImageFilter::DeviceProxy proxy(device.get());
-
-    (*test)(&proxy, reporter, context);
-}
-#endif
-
 DEF_TEST(ImageFilterNegativeBlurSigma, reporter) {
-    run_raster_test(reporter, 100, test_negative_blur_sigma);
+    test_negative_blur_sigma(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_negative_blur_sigma);
+    test_negative_blur_sigma(reporter, ctxInfo.fGrContext);
 }
 #endif
 
-static void test_zero_blur_sigma(SkImageFilter::Proxy* proxy,
-                                 skiatest::Reporter* reporter,
-                                 GrContext* context) {
+static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* context) {
     // Check that SkBlurImageFilter with a zero sigma and a non-zero srcOffset works correctly.
     SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(5, 0, 5, 10)));
     sk_sp<SkImageFilter> input(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect));
     sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(0, 0, std::move(input), &cropRect));
 
-    sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, proxy, 10));
+    sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, 10));
     surf->getCanvas()->clear(SK_ColorGREEN);
     sk_sp<SkSpecialImage> image(surf->makeImageSnapshot());
 
@@ -707,23 +658,21 @@ static void test_zero_blur_sigma(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterZeroBlurSigma, reporter) {
-    run_raster_test(reporter, 100, test_zero_blur_sigma);
+    test_zero_blur_sigma(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_zero_blur_sigma);
+    test_zero_blur_sigma(reporter, ctxInfo.fGrContext);
 }
 #endif
 
 
 // Tests that, even when an upstream filter has returned null (due to failure or clipping), a
 // downstream filter that affects transparent black still does so even with a nullptr input.
-static void test_fail_affects_transparent_black(SkImageFilter::Proxy* proxy,
-                                                skiatest::Reporter* reporter,
-                                                GrContext* context) {
+static void test_fail_affects_transparent_black(skiatest::Reporter* reporter, GrContext* context) {
     sk_sp<FailImageFilter> failFilter(new FailImageFilter());
-    sk_sp<SkSpecialImage> source(create_empty_special_image(context, proxy, 5));
+    sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5));
     SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nullptr);
     sk_sp<SkColorFilter> green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
     SkASSERT(green->affectsTransparentBlack());
@@ -741,12 +690,12 @@ static void test_fail_affects_transparent_black(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) {
-    run_raster_test(reporter, 100, test_fail_affects_transparent_black);
+    test_fail_affects_transparent_black(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_fail_affects_transparent_black);
+    test_fail_affects_transparent_black(reporter, ctxInfo.fGrContext);
 }
 #endif
 
@@ -935,9 +884,7 @@ DEF_TEST(ImageFilterUnionBounds, reporter) {
     }
 }
 
-static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
-                                               skiatest::Reporter* reporter,
-                                               GrContext* context) {
+static void test_imagefilter_merge_result_size(skiatest::Reporter* reporter, GrContext* context) {
     SkBitmap greenBM;
     greenBM.allocN32Pixels(20, 20);
     greenBM.eraseColor(SK_ColorGREEN);
@@ -945,7 +892,7 @@ static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
     sk_sp<SkImageFilter> source(SkImageSource::Make(std::move(greenImage)));
     sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(source, source));
 
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 1));
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 1));
 
     SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr);
     SkIPoint offset;
@@ -957,12 +904,12 @@ static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterMergeResultSize, reporter) {
-    run_raster_test(reporter, 100, test_imagefilter_merge_result_size);
+    test_imagefilter_merge_result_size(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_imagefilter_merge_result_size);
+    test_imagefilter_merge_result_size(reporter, ctxInfo.fGrContext);
 }
 #endif
 
@@ -1092,9 +1039,7 @@ DEF_TEST(ImageFilterMatrixConvolutionBorder, reporter) {
     canvas.restore();
 }
 
-static void test_big_kernel(SkImageFilter::Proxy* proxy,
-                            skiatest::Reporter* reporter,
-                            GrContext* context) {
+static void test_big_kernel(skiatest::Reporter* reporter, GrContext* context) {
     // Check that a kernel that is too big for the GPU still works
     SkScalar identityKernel[49] = {
         0, 0, 0, 0, 0, 0, 0,
@@ -1114,7 +1059,7 @@ static void test_big_kernel(SkImageFilter::Proxy* proxy,
                                         SkMatrixConvolutionImageFilter::kClamp_TileMode,
                                         true, nullptr));
 
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
     SkASSERT(srcImg);
 
     SkIPoint offset;
@@ -1127,23 +1072,23 @@ static void test_big_kernel(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
-    run_raster_test(reporter, 100, test_big_kernel);
+    test_big_kernel(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
                                       reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_big_kernel);
+    test_big_kernel(reporter, ctxInfo.fGrContext);
 }
 #endif
 
 DEF_TEST(ImageFilterCropRect, reporter) {
-    run_raster_test(reporter, 100, test_crop_rects);
+    test_crop_rects(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_crop_rects);
+    test_crop_rects(reporter, ctxInfo.fGrContext);
 }
 #endif
 
@@ -1232,9 +1177,7 @@ DEF_TEST(ImageFilterCrossProcessPictureImageFilter, reporter) {
         ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN);
 }
 
-static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy,
-                                             skiatest::Reporter* reporter,
-                                             GrContext* context) {
+static void test_clipped_picture_imagefilter(skiatest::Reporter* reporter, GrContext* context) {
     sk_sp<SkPicture> picture;
 
     {
@@ -1249,7 +1192,7 @@ static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy,
         picture = recorder.finishRecordingAsPicture();
     }
 
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 2));
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 2));
 
     sk_sp<SkImageFilter> imageFilter(SkPictureImageFilter::Make(picture));
 
@@ -1261,12 +1204,12 @@ static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
-    run_raster_test(reporter, 2, test_clipped_picture_imagefilter);
+    test_clipped_picture_imagefilter(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 2, test_clipped_picture_imagefilter);
+    test_clipped_picture_imagefilter(reporter, ctxInfo.fGrContext);
 }
 #endif
 
@@ -1500,10 +1443,8 @@ DEF_TEST(XfermodeImageFilterCroppedInput, reporter) {
     test_xfermode_cropped_input(&canvas, reporter);
 }
 
-static void test_composed_imagefilter_offset(SkImageFilter::Proxy* proxy,
-                                             skiatest::Reporter* reporter,
-                                             GrContext* context) {
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+static void test_composed_imagefilter_offset(skiatest::Reporter* reporter, GrContext* context) {
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
 
     SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20));
     sk_sp<SkImageFilter> offsetFilter(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect));
@@ -1520,18 +1461,16 @@ static void test_composed_imagefilter_offset(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ComposedImageFilterOffset, reporter) {
-    run_raster_test(reporter, 100, test_composed_imagefilter_offset);
+    test_composed_imagefilter_offset(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_offset);
+    test_composed_imagefilter_offset(reporter, ctxInfo.fGrContext);
 }
 #endif
 
-static void test_composed_imagefilter_bounds(SkImageFilter::Proxy* proxy,
-                                             skiatest::Reporter* reporter,
-                                             GrContext* context) {
+static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrContext* context) {
     // The bounds passed to the inner filter must be filtered by the outer
     // filter, so that the inner filter produces the pixels that the outer
     // filter requires as input. This matters if the outer filter moves pixels.
@@ -1549,7 +1488,7 @@ static void test_composed_imagefilter_bounds(SkImageFilter::Proxy* proxy,
     sk_sp<SkImageFilter> composedFilter(SkComposeImageFilter::Make(std::move(offsetFilter),
                                                                    std::move(pictureFilter)));
 
-    sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, proxy, 100));
+    sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, 100));
     SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr);
     SkIPoint offset;
     sk_sp<SkSpecialImage> result(composedFilter->filterImage(sourceImage.get(), ctx, &offset));
@@ -1564,19 +1503,17 @@ static void test_composed_imagefilter_bounds(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ComposedImageFilterBounds, reporter) {
-    run_raster_test(reporter, 100, test_composed_imagefilter_bounds);
+    test_composed_imagefilter_bounds(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_bounds);
+    test_composed_imagefilter_bounds(reporter, ctxInfo.fGrContext);
 }
 #endif
 
-static void test_partial_crop_rect(SkImageFilter::Proxy* proxy,
-                                   skiatest::Reporter* reporter,
-                                   GrContext* context) {
-    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* context) {
+    sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
 
     SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
         SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge);
@@ -1594,12 +1531,12 @@ static void test_partial_crop_rect(SkImageFilter::Proxy* proxy,
 }
 
 DEF_TEST(ImageFilterPartialCropRect, reporter) {
-    run_raster_test(reporter, 100, test_partial_crop_rect);
+    test_partial_crop_rect(reporter, nullptr);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) {
-    run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_partial_crop_rect);
+    test_partial_crop_rect(reporter, ctxInfo.fGrContext);
 }
 #endif
 
@@ -1740,31 +1677,27 @@ DEF_TEST(ImageFilterBlurLargeImage, reporter) {
 #if SK_SUPPORT_GPU
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
-    const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
 
-    sk_sp<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext,
-                                                  SkBudgeted::kNo,
-                                                  SkImageInfo::MakeN32Premul(100, 100),
-                                                  0,
-                                                  &props,
-                                                  SkGpuDevice::kUninit_InitContents));
-    SkCanvas canvas(device.get());
+    sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext,
+                                                      SkBudgeted::kNo,
+                                                      SkImageInfo::MakeN32Premul(100, 100)));
 
-    test_huge_blur(&canvas, reporter);
+
+    SkCanvas* canvas = surf->getCanvas();
+
+    test_huge_blur(canvas, reporter);
 }
 
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) {
-    const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
 
-    sk_sp<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext,
-                                                  SkBudgeted::kNo,
-                                                  SkImageInfo::MakeN32Premul(1, 1),
-                                                  0,
-                                                  &props,
-                                                  SkGpuDevice::kUninit_InitContents));
-    SkCanvas canvas(device.get());
+    sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext,
+                                                      SkBudgeted::kNo,
+                                                      SkImageInfo::MakeN32Premul(1, 1)));
 
-    test_xfermode_cropped_input(&canvas, reporter);
+
+    SkCanvas* canvas = surf->getCanvas();
+
+    test_xfermode_cropped_input(canvas, reporter);
 }
 
 DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
index a8a79668a7da624d94a3f5946d2e88008cd50edb..18d023f9cdc370b5caccd7b980738608435b4f4e 100644 (file)
@@ -14,7 +14,6 @@
 #include "SkSpecialSurface.h"
 #include "SkSurface.h"
 #include "Test.h"
-#include "TestingSpecialImageAccess.h"
 
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
@@ -53,7 +52,7 @@ static SkBitmap create_bm() {
 static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* reporter,
                        GrContext* context, bool peekTextureSucceeds,
                        int offset, int size) {
-    const SkIRect subset = TestingSpecialImageAccess::Subset(img.get());
+    const SkIRect subset = img->subset();
     REPORTER_ASSERT(reporter, offset == subset.left());
     REPORTER_ASSERT(reporter, offset == subset.top());
     REPORTER_ASSERT(reporter, kSmallerSize == subset.width());
@@ -140,14 +139,13 @@ DEF_TEST(SpecialImage_Raster, reporter) {
     SkBitmap bm = create_bm();
 
     sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromRaster(
-                                                            nullptr,
                                                             SkIRect::MakeWH(kFullSize, kFullSize),
                                                             bm));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
     {
-        sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(nullptr, subset, bm));
+        sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(subset, bm));
         test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
     }
 
@@ -163,15 +161,13 @@ DEF_TEST(SpecialImage_Image, reporter) {
     sk_sp<SkImage> fullImage(SkImage::MakeFromBitmap(bm));
 
     sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromImage(
-                                                            nullptr,
                                                             SkIRect::MakeWH(kFullSize, kFullSize),
                                                             fullImage));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
     {
-        sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(nullptr, subset,
-                                                                     fullImage));
+        sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(subset, fullImage));
         test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
     }
 
@@ -193,7 +189,7 @@ DEF_TEST(SpecialImage_Pixmap, reporter) {
     pixmap.erase(SK_ColorRED, subset);
 
     {
-        sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(nullptr, subset, pixmap,
+        sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(subset, pixmap,
                                                                  nullptr, nullptr));
         test_image(img, reporter, nullptr, false, kPad, kFullSize);
     }
@@ -222,20 +218,19 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
     {
         // raster
         sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster(
-                                                                        nullptr,
                                                                         SkIRect::MakeWH(kFullSize,
                                                                                         kFullSize),
                                                                         bm));
 
         {
-            sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(nullptr, context));
+            sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(context));
             test_texture_backed(reporter, rasterImage, fromRaster);
         }
 
         {
             sk_sp<SkSpecialImage> subRasterImage(rasterImage->makeSubset(subset));
 
-            sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(nullptr, context));
+            sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(context));
             test_texture_backed(reporter, subRasterImage, fromSubRaster);
         }
     }
@@ -257,21 +252,20 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
         }
 
         sk_sp<SkSpecialImage> gpuImage(SkSpecialImage::MakeFromGpu(
-                                                                nullptr,
                                                                 SkIRect::MakeWH(kFullSize,
                                                                                 kFullSize),
                                                                 kNeedNewImageUniqueID_SpecialImage,
                                                                 texture));
 
         {
-            sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(nullptr, context));
+            sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
             test_texture_backed(reporter, gpuImage, fromGPU);
         }
 
         {
             sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset));
 
-            sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullptr, context));
+            sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(context));
             test_texture_backed(reporter, subGPUImage, fromSubGPU);
         }
     }
@@ -295,7 +289,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
     }
 
     sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeFromGpu(
-                                                            nullptr,
                                                             SkIRect::MakeWH(kFullSize, kFullSize),
                                                             kNeedNewImageUniqueID_SpecialImage,
                                                             texture));
@@ -304,7 +297,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
 
     {
         sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromGpu(
-                                                               nullptr, subset,
+                                                               subset,
                                                                kNeedNewImageUniqueID_SpecialImage,
                                                                texture));
         test_image(subSImg1, reporter, context, true, kPad, kFullSize);
index db1aaf0038e09785665b07c7397258ef7ba8df9d..7169b5e8e2204149d4c90de0facb49a5ba1b70ca 100644 (file)
@@ -20,10 +20,6 @@ public:
     static const SkIRect& Subset(const SkSpecialSurface* surf) {
         return surf->subset();
     }
-
-    static const SkIRect& Subset(const SkSpecialImage* img) {
-        return img->subset();
-    }
 };
 
 // Both 'kSmallerSize' and 'kFullSize' need to be a non-power-of-2 to exercise
@@ -51,7 +47,7 @@ static void test_surface(const sk_sp<SkSpecialSurface>& surf,
     sk_sp<SkSpecialImage> img(surf->makeImageSnapshot());
     REPORTER_ASSERT(reporter, img);
 
-    const SkIRect imgSubset = TestingSpecialSurfaceAccess::Subset(img.get());
+    const SkIRect imgSubset = img->subset();
     REPORTER_ASSERT(reporter, surfSubset == imgSubset);
 
     // the canvas was invalidated by the newImageSnapshot call
@@ -61,7 +57,7 @@ static void test_surface(const sk_sp<SkSpecialSurface>& surf,
 DEF_TEST(SpecialSurface_Raster, reporter) {
 
     SkImageInfo info = SkImageInfo::MakeN32(kSmallerSize, kSmallerSize, kOpaque_SkAlphaType);
-    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(nullptr, info));
+    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(info));
 
     test_surface(surf, reporter, 0);
 }
@@ -73,7 +69,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) {
 
     const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
-    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(nullptr, subset, bm));
+    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(subset, bm));
 
     test_surface(surf, reporter, kPad);
 
@@ -89,8 +85,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
     desc.fWidth  = kSmallerSize;
     desc.fHeight = kSmallerSize;
 
-    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(nullptr, ctxInfo.fGrContext,
-                                                                    desc));
+    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.fGrContext, desc));
 
     test_surface(surf, reporter, 0);
 }
@@ -108,7 +103,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, ctxInfo) {
 
     const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
-    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(nullptr, subset, temp));
+    sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(subset, temp));
 
     test_surface(surf, reporter, kPad);
 
diff --git a/tests/TestingSpecialImageAccess.h b/tests/TestingSpecialImageAccess.h
deleted file mode 100644 (file)
index 64a6d29..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file
- */
-
-#ifndef TestingSpecialImageAccess_DEFINED
-#define TestingSpecialImageAccess_DEFINED
-
-class TestingSpecialImageAccess {
-public:
-    static const SkIRect& Subset(const SkSpecialImage* img) {
-        return img->subset();
-    }
-};
-
-#endif