remove dead methods now that we use specials exclusively for imagefilters
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2164763003
Review-Url: https://codereview.chromium.org/2164763003
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 76d4644..f06abde 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -348,12 +348,6 @@
return NULL;
}
- /**
- * Calls through to drawSprite, processing the imagefilter.
- */
- virtual void drawSpriteWithFilter(const SkDraw&, const SkBitmap&,
- int x, int y, const SkPaint&);
-
// A helper function used by derived classes to log the scale factor of a bitmap or image draw.
static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality);
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 433bd66..36afe42 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -364,6 +364,7 @@
void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
int x, int y, const SkPaint& paint) {
+ SkASSERT(!paint.getImageFilter());
draw.drawSprite(static_cast<SkBitmapDevice*>(device)->fBitmap, x, y, paint);
}
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index f54fba2..5a613ff 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -447,36 +447,6 @@
//////////////////////////////////////////////////////////////////////////////////////////
-void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitmap,
- int x, int y,
- const SkPaint& paint) {
- SkImageFilter* filter = paint.getImageFilter();
- SkASSERT(filter);
-
- SkIPoint offset = SkIPoint::Make(0, 0);
- SkMatrix matrix = *draw.fMatrix;
- matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
- const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y);
- SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache());
- SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
-
- sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this->surfaceProps()));
- if (!srcImg) {
- return; // something disastrous happened
- }
-
- sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
- if (resultImg) {
- SkPaint tmpUnfiltered(paint);
- tmpUnfiltered.setImageFilter(nullptr);
- SkBitmap resultBM;
- if (resultImg->internal_getBM(&resultBM)) {
- // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug.com/5073)
- this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(), tmpUnfiltered);
- }
- }
-}
-
uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
uint32_t flags = paint.getFlags();
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index e3a14e5..a4ffa19 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -81,7 +81,11 @@
}
SkBitmap bmp;
- if (!this->internal_getBM(&bmp)) {
+ // At this point, we are definitely not texture-backed, so we must be raster or generator
+ // backed. If we remove the special-wrapping-an-image subclass, we may be able to assert that
+ // we are strictly raster-backed (i.e. generator images become raster when they are specialized)
+ // in which case getROPixels could turn into peekPixels...
+ if (!this->getROPixels(&bmp)) {
return nullptr;
}
@@ -161,28 +165,6 @@
#include "SkGrPixelRef.h"
#endif
-sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(const SkBitmap& src,
- const SkSurfaceProps* props) {
-#if SK_SUPPORT_GPU
- // Need to test offset case! (see skbug.com/4967)
- if (src.getTexture()) {
- return SkSpecialImage::MakeFromGpu(src.bounds(),
- src.getGenerationID(),
- sk_ref_sp(src.getTexture()),
- props);
- }
-#endif
-
- return SkSpecialImage::MakeFromRaster(src.bounds(), src, props);
-}
-
-bool SkSpecialImage::internal_getBM(SkBitmap* result) {
- const SkSpecialImage_Base* ib = as_SIB(this);
-
- // TODO: need to test offset case! (see skbug.com/4967)
- return ib->getBitmapDeprecated(result);
-}
-
///////////////////////////////////////////////////////////////////////////////
#include "SkImage.h"
#if SK_SUPPORT_GPU
diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h
index 5dae05e..9afd64f 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -105,10 +105,6 @@
*/
sk_sp<SkImage> makeTightSubset(const SkIRect& subset) const;
- // These three internal methods will go away (see skbug.com/4965)
- bool internal_getBM(SkBitmap* result);
- static sk_sp<SkSpecialImage> internal_fromBM(const SkBitmap&, const SkSurfaceProps*);
-
// TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
/**
* If the SpecialImage is backed by a gpu texture, return true.
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9357568..b91a84a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -250,17 +250,6 @@
return filter->filterImage(srcImg, ctx, offset);
}
-
-void SkGpuDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitmap,
- int left, int top, const SkPaint& paint) {
- ASSERT_SINGLE_OWNER
- CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSpriteWithFilter", fContext);
-
- SkASSERT(paint.getImageFilter());
- this->drawSprite(draw, bitmap, left, top, paint);
-}
-
///////////////////////////////////////////////////////////////////////////////
bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
@@ -1468,6 +1457,8 @@
void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
int left, int top, const SkPaint& paint) {
+ SkASSERT(!paint.getImageFilter());
+
ASSERT_SINGLE_OWNER
// clear of the source device must occur before CHECK_SHOULD_DRAW
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDevice", fContext);
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index b72e917..0b1e6a3 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -269,9 +269,6 @@
int sampleCount,
const SkSurfaceProps*);
- void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y,
- const SkPaint&) override;
-
friend class GrAtlasTextContext;
friend class SkSurface_Gpu; // for access to surfaceProps
typedef SkBaseDevice INHERITED;
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 8501a03..bcbff32 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1345,17 +1345,15 @@
void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device,
int x, int y, const SkPaint& paint) {
+ SkASSERT(!paint.getImageFilter());
+
// Check if the source device is really a bitmapdevice (because that's what we returned
// from createDevice (likely due to an imagefilter)
SkPixmap pmap;
if (device->peekPixels(&pmap)) {
SkBitmap bitmap;
bitmap.installPixels(pmap);
- if (paint.getImageFilter()) {
- this->drawSpriteWithFilter(d, bitmap, x, y, paint);
- } else {
- this->drawSprite(d, bitmap, x, y, paint);
- }
+ this->drawSprite(d, bitmap, x, y, paint);
return;
}