Index: gm/image.cpp |
diff --git a/gm/image.cpp b/gm/image.cpp |
index b775af8b892dc1138290bc553e4cf572d293a2a5..1c2b4a7e55fe2175a5390bdf93f6325d0a13bb00 100644 |
--- a/gm/image.cpp |
+++ b/gm/image.cpp |
@@ -16,22 +16,14 @@ |
#include "GrContext.h" |
#endif |
-static SkData* fileToData(const char path[]) { |
- SkFILEStream stream(path); |
- if (!stream.isValid()) { |
- return SkData::NewEmpty(); |
- } |
- size_t size = stream.getLength(); |
- void* mem = sk_malloc_throw(size); |
- stream.read(mem, size); |
- return SkData::NewFromMalloc(mem, size); |
-} |
- |
static void drawJpeg(SkCanvas* canvas, const SkISize& size) { |
// TODO: Make this draw a file that is checked in, so it can |
// be exercised on machines other than mike's. Will require a |
// rebaseline. |
- SkAutoDataUnref data(fileToData("/Users/mike/Downloads/skia.google.jpeg")); |
+ SkAutoDataUnref data(SkData::NewFromFileName("/Users/mike/Downloads/skia.google.jpeg")); |
tfarina
2014/09/19 16:14:49
The code of NewFromFileName (https://skia.googleso
|
+ if (NULL == data.get()) { |
tfarina
2014/09/19 16:14:49
OK
|
+ return; |
+ } |
SkImage* image = SkImage::NewFromGenerator( |
SkDecodingImageGenerator::Create(data, SkDecodingImageGenerator::Options())); |
if (image) { |