Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: src/images/SkImageDecoder.cpp

Issue 1426943009: Delete dead SkImageDecoder::buildTileIndex and decodeSubset code (Closed) Base URL: https://skia.googlesource.com/skia.git@delete-tools
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder.cpp
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 60cc44c5b4263f15fe58198cba6fc691608a9a19..d2ad553769b3100427b79325b54910d6786b79e3 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -142,76 +142,6 @@ SkImageDecoder::Result SkImageDecoder::decode(SkStream* stream, SkBitmap* bm, Sk
return result;
}
-bool SkImageDecoder::decodeSubset(SkBitmap* bm, const SkIRect& rect, SkColorType pref) {
- // we reset this to false before calling onDecodeSubset
- fShouldCancelDecode = false;
- // assign this, for use by getPrefColorType(), in case fUsePrefTable is false
- fDefaultPref = pref;
-
- return this->onDecodeSubset(bm, rect);
-}
-
-bool SkImageDecoder::buildTileIndex(SkStreamRewindable* stream, int *width, int *height) {
- // we reset this to false before calling onBuildTileIndex
- fShouldCancelDecode = false;
-
- return this->onBuildTileIndex(stream, width, height);
-}
-
-bool SkImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int* /*width*/,
- int* /*height*/) {
- delete stream;
- return false;
-}
-
-
-bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
- int dstX, int dstY, int width, int height,
- int srcX, int srcY) {
- int w = width / sampleSize;
- int h = height / sampleSize;
- if (src->colorType() == kIndex_8_SkColorType) {
- // kIndex8 does not allow drawing via an SkCanvas, as is done below.
- // Instead, use extractSubset. Note that this shares the SkPixelRef and
- // SkColorTable.
- // FIXME: Since src is discarded in practice, this holds on to more
- // pixels than is strictly necessary. Switch to a copy if memory
- // savings are more important than speed here. This also means
- // that the pixels in dst can not be reused (though there is no
- // allocation, which was already done on src).
- int x = (dstX - srcX) / sampleSize;
- int y = (dstY - srcY) / sampleSize;
- SkIRect subset = SkIRect::MakeXYWH(x, y, w, h);
- return src->extractSubset(dst, subset);
- }
- // if the destination has no pixels then we must allocate them.
- if (dst->isNull()) {
- dst->setInfo(src->info().makeWH(w, h));
-
- if (!this->allocPixelRef(dst, nullptr)) {
- SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
- return false;
- }
- }
- // check to see if the destination is large enough to decode the desired
- // region. If this assert fails we will just draw as much of the source
- // into the destination that we can.
- if (dst->width() < w || dst->height() < h) {
- SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitmap.\n"));
- }
-
- // Set the Src_Mode for the paint to prevent transparency issue in the
- // dest in the event that the dest was being re-used.
- SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
-
- SkCanvas canvas(*dst);
- canvas.drawBitmap(*src, SkIntToScalar((srcX - dstX) / sampleSize),
- SkIntToScalar((srcY - dstY) / sampleSize),
- &paint);
- return true;
-}
-
///////////////////////////////////////////////////////////////////////////////
bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pref, Mode mode,
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698