aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-07-20 12:28:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-20 12:28:40 -0700
commitcf5c846b4176da82bccb5d5b45788bf0d45a8dd8 (patch)
treea3f11711fc3f647d804dd6f064cda58f1818f07a /src
parente499adf328bd7fc15a755325749f54c2b7e71f54 (diff)
remove dead methods now that we use specials exclusively for imagefilters
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapDevice.cpp1
-rw-r--r--src/core/SkDevice.cpp30
-rw-r--r--src/core/SkSpecialImage.cpp28
-rw-r--r--src/core/SkSpecialImage.h4
-rw-r--r--src/gpu/SkGpuDevice.cpp13
-rw-r--r--src/gpu/SkGpuDevice.h3
-rw-r--r--src/pdf/SkPDFDevice.cpp8
7 files changed, 11 insertions, 76 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 433bd66c62..36afe42f3a 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -364,6 +364,7 @@ void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode
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 f54fba2ba7..5a613fff2e 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -447,36 +447,6 @@ void SkBaseDevice::drawTextRSXform(const SkDraw& draw, const void* text, size_t
//////////////////////////////////////////////////////////////////////////////////////////
-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 e3a14e57ab..a4ffa198d5 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -81,7 +81,11 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) {
}
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 @@ sk_sp<SkImage> SkSpecialImage::makeTightSubset(const SkIRect& subset) const {
#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 5dae05e245..9afd64fa45 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -105,10 +105,6 @@ public:
*/
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 9357568117..b91a84a33a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -250,17 +250,6 @@ sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw,
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 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
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 b72e917a37..0b1e6a3cd9 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -269,9 +269,6 @@ private:
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 8501a03d98..bcbff3285c 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1345,17 +1345,15 @@ void SkPDFDevice::drawVertices(const SkDraw& d, SkCanvas::VertexMode,
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;
}