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

Unified Diff: src/ports/SkImageDecoder_CG.cpp

Issue 647023006: Qualify the return value of SkImageDecoder::decode (Closed) Base URL: https://skia.googlesource.com/skia.git/+/master
Patch Set: fix a sample Created 6 years, 2 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 | « src/images/SkScaledBitmapSampler.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageDecoder_CG.cpp
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 3e3075cc1330feb4e2723290c7edef675b38174e..0358aec18c8c19b6c458c5e322f0a1cce5b0a851 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -48,7 +48,7 @@ static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) {
class SkImageDecoder_CG : public SkImageDecoder {
protected:
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
+ virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
static void argb_4444_force_opaque(void* row, int count) {
@@ -103,17 +103,17 @@ static void force_opaque(SkBitmap* bm) {
#define BITMAP_INFO (kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast)
-bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
+SkImageDecoder::Result SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
CGImageSourceRef imageSrc = SkStreamToCGImageSource(stream);
if (NULL == imageSrc) {
- return false;
+ return kFailure;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL);
if (NULL == image) {
- return false;
+ return kFailure;
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
@@ -122,17 +122,17 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
bm->setInfo(SkImageInfo::MakeN32Premul(width, height));
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
- return true;
+ return kSuccess;
}
if (!this->allocPixelRef(bm, NULL)) {
- return false;
+ return kFailure;
}
SkAutoLockPixels alp(*bm);
if (!SkCopyPixelsFromCGImage(bm->info(), bm->rowBytes(), bm->getPixels(), image)) {
- return false;
+ return kFailure;
}
CGImageAlphaInfo info = CGImageGetAlphaInfo(image);
@@ -162,7 +162,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
}
bm->setAlphaType(kUnpremul_SkAlphaType);
}
- return true;
+ return kSuccess;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/images/SkScaledBitmapSampler.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698