Add a method to convert SkCodec::Result to a string
Bug: b/63909536 Change-Id: Ic91e3401359f80eadd9d1cd79aa8ef642c60b0fc Reviewed-on: https://skia-review.googlesource.com/94781 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
parent
5fb009df3c
commit
fe3da02e76
@ -107,6 +107,11 @@ public:
|
||||
kUnimplemented,
|
||||
};
|
||||
|
||||
/**
|
||||
* Readable string representing the error code.
|
||||
*/
|
||||
static const char* ResultToString(Result);
|
||||
|
||||
/**
|
||||
* If this stream represents an encoded image that we know how to decode,
|
||||
* return an SkCodec that can decode it. Otherwise return NULL.
|
||||
|
@ -684,3 +684,31 @@ std::vector<SkCodec::FrameInfo> SkCodec::getFrameInfo() {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* SkCodec::ResultToString(Result result) {
|
||||
switch (result) {
|
||||
case kSuccess:
|
||||
return "success";
|
||||
case kIncompleteInput:
|
||||
return "incomplete input";
|
||||
case kErrorInInput:
|
||||
return "error in input";
|
||||
case kInvalidConversion:
|
||||
return "invalid conversion";
|
||||
case kInvalidScale:
|
||||
return "invalid scale";
|
||||
case kInvalidParameters:
|
||||
return "invalid parameters";
|
||||
case kInvalidInput:
|
||||
return "invalid input";
|
||||
case kCouldNotRewind:
|
||||
return "could not rewind";
|
||||
case kInternalError:
|
||||
return "internal error";
|
||||
case kUnimplemented:
|
||||
return "unimplemented";
|
||||
default:
|
||||
SkASSERT(false);
|
||||
return "bogus result value";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user