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

Unified Diff: src/core/SkBitmap.cpp

Issue 305483005: remove SkBitmap::asImageInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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/core/SkBitmap.h ('k') | src/core/SkBitmapDevice.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 cc3c165a3a484fe61fb270d84ead6e019a19840b..a89ca35f0d3f070b07f8dd195a6efb2804861e11 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -310,24 +310,23 @@ static bool config_to_colorType(SkBitmap::Config config, SkColorType* ctOut) {
SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, int dx, int dy) {
#ifdef SK_DEBUG
if (pr) {
- SkImageInfo info;
- if (this->asImageInfo(&info)) {
+ if (kUnknown_SkColorType != fInfo.colorType()) {
const SkImageInfo& prInfo = pr->info();
- SkASSERT(info.fWidth <= prInfo.fWidth);
- SkASSERT(info.fHeight <= prInfo.fHeight);
- SkASSERT(info.fColorType == prInfo.fColorType);
+ SkASSERT(fInfo.fWidth <= prInfo.fWidth);
+ SkASSERT(fInfo.fHeight <= prInfo.fHeight);
+ SkASSERT(fInfo.fColorType == prInfo.fColorType);
switch (prInfo.fAlphaType) {
case kIgnore_SkAlphaType:
SkASSERT(fInfo.fAlphaType == kIgnore_SkAlphaType);
break;
case kOpaque_SkAlphaType:
case kPremul_SkAlphaType:
- SkASSERT(info.fAlphaType == kOpaque_SkAlphaType ||
- info.fAlphaType == kPremul_SkAlphaType);
+ SkASSERT(fInfo.fAlphaType == kOpaque_SkAlphaType ||
+ fInfo.fAlphaType == kPremul_SkAlphaType);
break;
case kUnpremul_SkAlphaType:
- SkASSERT(info.fAlphaType == kOpaque_SkAlphaType ||
- info.fAlphaType == kUnpremul_SkAlphaType);
+ SkASSERT(fInfo.fAlphaType == kOpaque_SkAlphaType ||
+ fInfo.fAlphaType == kUnpremul_SkAlphaType);
break;
}
}
@@ -386,13 +385,12 @@ void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
return;
}
- SkImageInfo info;
- if (!this->asImageInfo(&info)) {
+ if (kUnknown_SkColorType == fInfo.colorType()) {
this->setPixelRef(NULL);
return;
}
- SkPixelRef* pr = SkMallocPixelRef::NewDirect(info, p, fRowBytes, ctable);
+ SkPixelRef* pr = SkMallocPixelRef::NewDirect(fInfo, p, fRowBytes, ctable);
if (NULL == pr) {
this->setPixelRef(NULL);
return;
@@ -526,14 +524,13 @@ GrTexture* SkBitmap::getTexture() const {
*/
bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst,
SkColorTable* ctable) {
- SkImageInfo info;
- if (!dst->asImageInfo(&info)) {
+ const SkImageInfo info = dst->info();
+ if (kUnknown_SkColorType == info.colorType()) {
// SkDebugf("unsupported config for info %d\n", dst->config());
return false;
}
- SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, dst->rowBytes(),
- ctable);
+ SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, dst->rowBytes(), ctable);
if (NULL == pr) {
return false;
}
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698