aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
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/core
parente499adf328bd7fc15a755325749f54c2b7e71f54 (diff)
remove dead methods now that we use specials exclusively for imagefilters
Diffstat (limited to 'src/core')
-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
4 files changed, 6 insertions, 57 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.