diff options
author | reed <reed@google.com> | 2016-07-25 08:29:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-25 08:29:10 -0700 |
commit | c7ec7c9cabf5c8ad08beb617b99831ece25dacdd (patch) | |
tree | 9d0d580fb719668b39c652d5db1f44045b56b0d3 /src/core/SkBitmap.cpp | |
parent | 2adecda92b2f2ac49d78326a3c76442a0f1c4139 (diff) |
remove/deprecate SkBitmap::getTexture, as it now always returns false
oh happy day
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2175873002
Review-Url: https://codereview.chromium.org/2175873002
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r-- | src/core/SkBitmap.cpp | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index fb7f691c93..a803c78227 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -424,10 +424,6 @@ void SkBitmap::notifyPixelsChanged() const { } } -GrTexture* SkBitmap::getTexture() const { - return fPixelRef ? fPixelRef->getTexture() : nullptr; -} - /////////////////////////////////////////////////////////////////////////////// /** We explicitly use the same allocator for our pixels that SkMask does, @@ -740,20 +736,6 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { return false; // r is empty (i.e. no intersection) } - if (fPixelRef->getTexture() != nullptr) { - // Do a deep copy - SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->colorSpace(), &subset); - if (pixelRef != nullptr) { - SkBitmap dst; - dst.setInfo(this->info().makeWH(subset.width(), subset.height())); - dst.setIsVolatile(this->isVolatile()); - dst.setPixelRef(pixelRef)->unref(); - SkDEBUGCODE(dst.validate()); - result->swap(dst); - return true; - } - } - // If the upper left of the rectangle was outside the bounds of this SkBitmap, we should have // exited above. SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width())); @@ -909,46 +891,14 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, Allocator* alloc) return true; } +// TODO: can we merge this with copyTo? bool SkBitmap::deepCopyTo(SkBitmap* dst) const { const SkColorType dstCT = this->colorType(); - SkColorSpace* dstCS = this->colorSpace(); if (!this->canCopyTo(dstCT)) { return false; } - - // If we have a PixelRef, and it supports deep copy, use it. - // Currently supported only by texture-backed bitmaps. - if (fPixelRef) { - SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstCS, nullptr); - if (pixelRef) { - uint32_t rowBytes; - if (this->colorType() == dstCT && this->colorSpace() == dstCS) { - // Since there is no subset to pass to deepCopy, and deepCopy - // succeeded, the new pixel ref must be identical. - SkASSERT(fPixelRef->info() == pixelRef->info()); - pixelRef->cloneGenID(*fPixelRef); - // Use the same rowBytes as the original. - rowBytes = fRowBytes; - } else { - // With the new config, an appropriate fRowBytes will be computed by setInfo. - rowBytes = 0; - } - - const SkImageInfo info = fInfo.makeColorType(dstCT); - if (!dst->setInfo(info, rowBytes)) { - return false; - } - dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref(); - return true; - } - } - - if (this->getTexture()) { - return false; - } else { - return this->copyTo(dst, dstCT, nullptr); - } + return this->copyTo(dst, dstCT, nullptr); } /////////////////////////////////////////////////////////////////////////////// |