diff options
author | msarett <msarett@google.com> | 2016-03-17 07:19:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-17 07:19:41 -0700 |
commit | d427266a58af7e6ea6c12c9cd56ade3e179a0c04 (patch) | |
tree | 2590454b3535c8179a1ec9b300cfcbba565e0a0c /gm/filterindiabox.cpp | |
parent | 667433ff5bc65680af31ca718d4cc29cce7b7040 (diff) |
Remove uses of SkImageDecoder from gms
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1791583002
Review URL: https://codereview.chromium.org/1791583002
Diffstat (limited to 'gm/filterindiabox.cpp')
-rw-r--r-- | gm/filterindiabox.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp index c5d7166423..569a694968 100644 --- a/gm/filterindiabox.cpp +++ b/gm/filterindiabox.cpp @@ -11,7 +11,6 @@ #include "SkBitmapProcState.h" #include "SkBitmapScaler.h" #include "SkGradientShader.h" -#include "SkImageDecoder.h" #include "SkImageEncoder.h" #include "SkStream.h" #include "SkTypeface.h" @@ -99,21 +98,11 @@ protected: } void makeBitmap() { - SkImageDecoder* codec = nullptr; - SkString resourcePath = GetResourcePath(fFilename.c_str()); - SkFILEStream stream(resourcePath.c_str()); - if (stream.isValid()) { - codec = SkImageDecoder::Factory(&stream); - } - if (codec) { - stream.rewind(); - codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode); - delete codec; - } else { - fBM.allocN32Pixels(1, 1); - *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad - } - fSize = fBM.height(); + if (!GetResourceAsBitmap(fFilename.c_str(), &fBM)) { + fBM.allocN32Pixels(1, 1); + fBM.eraseARGB(255, 255, 0 , 0); // red == bad + } + fSize = fBM.height(); } private: typedef skiagm::GM INHERITED; |