Fix bug: can't convert nullptr -> bool

Change-Id: Ib37c46d00b6a3e768e6d8399f2a6afb332d36bff
Reviewed-on: https://skia-review.googlesource.com/5141
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Hal Canary 2016-11-22 12:23:28 -07:00 committed by Skia Commit-Bot
parent 818d8a99e8
commit 2cb6cb7218
3 changed files with 7 additions and 1 deletions

View File

@ -14,6 +14,9 @@
* Enum describing format of encoded data.
*/
enum class SkEncodedImageFormat {
#ifdef GOOGLE3
kUnknown,
#endif
kBMP,
kGIF,
kICO,

View File

@ -47,6 +47,9 @@ inline bool SkEncodeImage(SkWStream* dst, const SkBitmap& src, SkEncodedImageFor
class SkImageEncoder {
public:
enum Type {
#ifdef GOOGLE3
kUnknown_Type = (uint8_t)SkEncodedImageFormat::kUnknown,
#endif
kBMP_Type = (uint8_t)SkEncodedImageFormat::kBMP,
kGIF_Type = (uint8_t)SkEncodedImageFormat::kGIF,
kICO_Type = (uint8_t)SkEncodedImageFormat::kICO,

View File

@ -11,7 +11,7 @@ bool SkEncodeImage(SkWStream* dst, const SkPixmap& src,
SkEncodedImageFormat format, int quality) {
SkBitmap bm;
if (!bm.installPixels(src)) {
return nullptr;
return false;
}
bm.setImmutable();
std::unique_ptr<SkImageEncoder> enc(SkImageEncoder::Create((SkImageEncoder::Type)format));