diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-15 14:53:49 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-15 14:53:49 +0000 |
commit | f98118e65cbcee064bb8034f94a4faf4ea8d5536 (patch) | |
tree | da4621217675d392cfe42da7ab632624a4f3aca0 /src | |
parent | 347fd4e9fde6843128c841a3f0ba2482154781a5 (diff) |
Provide a function to print the name of a Format.
Also use SkToU32 instead of a flat cast.
R=djsollen@google.com
Review URL: https://codereview.chromium.org/14565005
git-svn-id: http://skia.googlecode.com/svn/trunk@9139 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/images/SkImageDecoder.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp index 9ffae5f0e7..bcea23bd59 100644 --- a/src/images/SkImageDecoder.cpp +++ b/src/images/SkImageDecoder.cpp @@ -54,7 +54,11 @@ SkImageDecoder::Format SkImageDecoder::getFormat() const { } const char* SkImageDecoder::getFormatName() const { - switch (this->getFormat()) { + return GetFormatName(this->getFormat()); +} + +const char* SkImageDecoder::GetFormatName(Format format) { + switch (format) { case kUnknown_Format: return "Unknown Format"; case kBMP_Format: @@ -319,7 +323,7 @@ bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size, return true; } - if (target->fRowBytes != (uint32_t) bm.rowBytes()) { + if (target->fRowBytes != SkToU32(bm.rowBytes())) { if (target->fRowBytes < SkImageMinRowBytes(*info)) { SkASSERT(!"Desired row bytes is too small"); return false; |