diff options
author | 2014-05-19 17:29:16 +0000 | |
---|---|---|
committer | 2014-05-19 17:29:16 +0000 | |
commit | a369e36e9d00dc83798703814cebd0b04e9525a4 (patch) | |
tree | 430c450ebc8674a357b88106785a44b5eb0d9171 /src/core/SkBitmap.cpp | |
parent | 71e55762e686c8000367ea56a47c61e0c1e05402 (diff) |
Revert "Revert of eliminate config param -- it was always self's config (https://codereview.chromium.org/246513002/)"
TBR=bsalomon@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/290883005
git-svn-id: http://skia.googlecode.com/svn/trunk@14785 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r-- | src/core/SkBitmap.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 84f363e564..2d3391f11f 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -885,7 +885,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { if (fPixelRef->getTexture() != NULL) { // Do a deep copy - SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); + SkPixelRef* pixelRef = fPixelRef->deepCopy(&subset); if (pixelRef != NULL) { SkBitmap dst; dst.setConfig(this->config(), subset.width(), subset.height(), 0, @@ -1085,8 +1085,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, } bool SkBitmap::deepCopyTo(SkBitmap* dst) const { - const SkBitmap::Config dstConfig = this->config(); - const SkColorType dstCT = SkBitmapConfigToColorType(dstConfig); + const SkColorType dstCT = this->colorType(); if (!this->canCopyTo(dstCT)) { return false; @@ -1095,24 +1094,15 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const { // 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(dstConfig); + SkPixelRef* pixelRef = fPixelRef->deepCopy(); if (pixelRef) { - uint32_t rowBytes; - if (this->colorType() == dstCT) { - // 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 setConfig. - rowBytes = 0; - } + // 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); SkImageInfo info = fInfo; - info.fColorType = dstCT; - if (!dst->setConfig(info, rowBytes)) { + if (!dst->setConfig(info, fRowBytes)) { return false; } dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref(); |