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

Unified Diff: src/core/SkBitmap.cpp

Issue 246513002: eliminate config param -- it was always self's config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 months 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/gpu/SkGrPixelRef.h ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 72395172dace5fdffc5b31ee71f41787de7915ca..2a8c8e45e2d47508a058d0d5256d8d6d206b01ce 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -946,7 +946,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,
@@ -1145,8 +1145,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;
@@ -1155,24 +1154,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();
« no previous file with comments | « include/gpu/SkGrPixelRef.h ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698