OLD | NEW |
1 #include "DMSrcSink.h" | 1 #include "DMSrcSink.h" |
2 #include "SamplePipeControllers.h" | 2 #include "SamplePipeControllers.h" |
3 #include "SkCommonFlags.h" | 3 #include "SkCommonFlags.h" |
4 #include "SkCodec.h" | 4 #include "SkCodec.h" |
5 #include "SkDocument.h" | 5 #include "SkDocument.h" |
6 #include "SkMultiPictureDraw.h" | 6 #include "SkMultiPictureDraw.h" |
7 #include "SkNullCanvas.h" | 7 #include "SkNullCanvas.h" |
8 #include "SkOSFile.h" | 8 #include "SkOSFile.h" |
9 #include "SkPictureRecorder.h" | 9 #include "SkPictureRecorder.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 Error ImageSrc::draw(SkCanvas* canvas) const { | 42 Error ImageSrc::draw(SkCanvas* canvas) const { |
43 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 43 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
44 if (!encoded) { | 44 if (!encoded) { |
45 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); | 45 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
46 } | 46 } |
47 const SkColorType dstColorType = canvas->imageInfo().colorType(); | 47 const SkColorType dstColorType = canvas->imageInfo().colorType(); |
48 if (fDivisor == 0) { | 48 if (fDivisor == 0) { |
49 // Just for debugging. | 49 // Just for debugging. |
50 SkString name = SkOSPath::Basename(fPath.c_str()); | 50 SkString name = SkOSPath::Basename(fPath.c_str()); |
51 SkDebugf("Attempting to decode %s\n", name.c_str()); | 51 SkDebugf("\nAttempting to decode %s\n", name.c_str()); |
52 // Decode the full image. | 52 // Decode the full image. |
53 SkBitmap bitmap; | 53 SkBitmap bitmap; |
54 if (FLAGS_codec) { | 54 if (FLAGS_codec) { |
55 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 55 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
56 if (!codec) { | 56 if (!codec) { |
57 return SkStringPrintf("Couldn't decode %s.", fPath.c_str()); | 57 return SkStringPrintf("Couldn't decode %s.", fPath.c_str()); |
58 } | 58 } |
59 SkImageInfo info; | 59 SkImageInfo info; |
60 if (!codec->getInfo(&info)) { | 60 if (!codec->getInfo(&info)) { |
61 return SkStringPrintf("Couldn't getInfo %s.", fPath.c_str()); | 61 return SkStringPrintf("Couldn't getInfo %s.", fPath.c_str()); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 surfaces.unrefAll(); | 482 surfaces.unrefAll(); |
483 return ""; | 483 return ""; |
484 } | 484 } |
485 SkISize size() const SK_OVERRIDE { return fSize; } | 485 SkISize size() const SK_OVERRIDE { return fSize; } |
486 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 486 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
487 } proxy(fW, fH, pic, src.size()); | 487 } proxy(fW, fH, pic, src.size()); |
488 return fSink->draw(proxy, bitmap, stream, log); | 488 return fSink->draw(proxy, bitmap, stream, log); |
489 } | 489 } |
490 | 490 |
491 } // namespace DM | 491 } // namespace DM |
OLD | NEW |