Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkAtomics.h" | 8 #include "SkAtomics.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 srcRect.set(0, 0, this->width(), this->height()); | 740 srcRect.set(0, 0, this->width(), this->height()); |
| 741 if (!r.intersect(srcRect, subset)) { | 741 if (!r.intersect(srcRect, subset)) { |
| 742 return false; // r is empty (i.e. no intersection) | 742 return false; // r is empty (i.e. no intersection) |
| 743 } | 743 } |
| 744 | 744 |
| 745 if (fPixelRef->getTexture() != nullptr) { | 745 if (fPixelRef->getTexture() != nullptr) { |
| 746 // Do a deep copy | 746 // Do a deep copy |
| 747 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->prof ileType(), &subset); | 747 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->prof ileType(), &subset); |
| 748 if (pixelRef != nullptr) { | 748 if (pixelRef != nullptr) { |
| 749 SkBitmap dst; | 749 SkBitmap dst; |
| 750 dst.setInfo(this->info().makeWH(subset.width(), subset.height())); | 750 dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(), |
|
Brian Osman
2016/04/21 13:33:37
Sorry, I just went back and looked at this change
herb_g
2016/04/21 15:09:54
No This is a regression probably from one of the m
| |
| 751 this->colorType(), this->alphaType(), | |
| 752 this->profileType())); | |
| 751 dst.setIsVolatile(this->isVolatile()); | 753 dst.setIsVolatile(this->isVolatile()); |
| 752 dst.setPixelRef(pixelRef)->unref(); | 754 dst.setPixelRef(pixelRef)->unref(); |
| 753 SkDEBUGCODE(dst.validate()); | 755 SkDEBUGCODE(dst.validate()); |
| 754 result->swap(dst); | 756 result->swap(dst); |
| 755 return true; | 757 return true; |
| 756 } | 758 } |
| 757 } | 759 } |
| 758 | 760 |
| 759 // If the upper left of the rectangle was outside the bounds of this SkBitma p, we should have | 761 // If the upper left of the rectangle was outside the bounds of this SkBitma p, we should have |
| 760 // exited above. | 762 // exited above. |
| 761 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width( ))); | 763 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width( ))); |
| 762 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height( ))); | 764 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height( ))); |
| 763 | 765 |
| 764 SkBitmap dst; | 766 SkBitmap dst; |
| 765 dst.setInfo(this->info().makeWH(r.width(), r.height()), this->rowBytes()); | 767 dst.setInfo(SkImageInfo::Make(r.width(), r.height(), |
| 768 this->colorType(), this->alphaType(), this->pr ofileType()), | |
| 769 this->rowBytes()); | |
| 766 dst.setIsVolatile(this->isVolatile()); | 770 dst.setIsVolatile(this->isVolatile()); |
| 767 | 771 |
| 768 if (fPixelRef) { | 772 if (fPixelRef) { |
| 769 SkIPoint origin = fPixelRefOrigin; | 773 SkIPoint origin = fPixelRefOrigin; |
| 770 origin.fX += r.fLeft; | 774 origin.fX += r.fLeft; |
| 771 origin.fY += r.fTop; | 775 origin.fY += r.fTop; |
| 772 // share the pixelref with a custom offset | 776 // share the pixelref with a custom offset |
| 773 dst.setPixelRef(fPixelRef, origin); | 777 dst.setPixelRef(fPixelRef, origin); |
| 774 } | 778 } |
| 775 SkDEBUGCODE(dst.validate();) | 779 SkDEBUGCODE(dst.validate();) |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1349 /////////////////////////////////////////////////////////////////////////////// | 1353 /////////////////////////////////////////////////////////////////////////////// |
| 1350 | 1354 |
| 1351 #ifdef SK_DEBUG | 1355 #ifdef SK_DEBUG |
| 1352 void SkImageInfo::validate() const { | 1356 void SkImageInfo::validate() const { |
| 1353 SkASSERT(fWidth >= 0); | 1357 SkASSERT(fWidth >= 0); |
| 1354 SkASSERT(fHeight >= 0); | 1358 SkASSERT(fHeight >= 0); |
| 1355 SkASSERT(SkColorTypeIsValid(fColorType)); | 1359 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1356 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1360 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1357 } | 1361 } |
| 1358 #endif | 1362 #endif |
| OLD | NEW |