Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
| 9 #include "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 } | 80 } |
| 81 | 81 |
| 82 SkScanlineDecoder* start_scanline_decoder(SkData* encoded, const SkImageInfo& in fo, | 82 SkScanlineDecoder* start_scanline_decoder(SkData* encoded, const SkImageInfo& in fo, |
| 83 SkPMColor* colorPtr, int* colorCountPtr) { | 83 SkPMColor* colorPtr, int* colorCountPtr) { |
| 84 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromD ata(encoded)); | 84 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromD ata(encoded)); |
| 85 if (NULL == scanlineDecoder) { | 85 if (NULL == scanlineDecoder) { |
| 86 return NULL; | 86 return NULL; |
| 87 } | 87 } |
| 88 // DM scanline test assume kTopDown scanline ordering. Other orderings are | 88 // DM scanline test assume kTopDown scanline ordering. Other orderings are |
| 89 // tested from within SkScaledCodec. | 89 // tested from within SkScaledCodec. |
| 90 if (SkCodec::kSuccess != scanlineDecoder->start(info, NULL, colorPtr, colorC ountPtr)) { | |
|
scroggo
2015/08/27 16:35:49
Why did this move? Also, it seems like the comment
msarett
2015/09/01 17:50:15
This moved because gifs don't know their SkScanlin
| |
| 91 return NULL; | |
| 92 } | |
| 90 if (SkScanlineDecoder::kTopDown_SkScanlineOrder != scanlineDecoder->getScanl ineOrder()) { | 93 if (SkScanlineDecoder::kTopDown_SkScanlineOrder != scanlineDecoder->getScanl ineOrder()) { |
|
msarett
2015/08/24 23:20:12
In gif we don't know the scanline order until we c
scroggo
2015/08/27 16:35:49
We spoke about this a little in person, but I'll a
msarett
2015/09/01 17:50:15
Just want to clarify that there are two different
msarett
2015/09/01 21:37:52
This issue isn't critical right now. We'll keep t
| |
| 91 return NULL; | 94 return NULL; |
| 92 } | 95 } |
| 93 if (SkCodec::kSuccess != scanlineDecoder->start(info, NULL, colorPtr, colorC ountPtr)) { | |
| 94 return NULL; | |
| 95 } | |
| 96 return scanlineDecoder.detach(); | 96 return scanlineDecoder.detach(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 Error CodecSrc::draw(SkCanvas* canvas) const { | 99 Error CodecSrc::draw(SkCanvas* canvas) const { |
| 100 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 100 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
| 101 if (!encoded) { | 101 if (!encoded) { |
| 102 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); | 102 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
| 103 } | 103 } |
| 104 SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded)); | 104 SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded)); |
| 105 if (NULL == codec.get()) { | 105 if (NULL == codec.get()) { |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1082 skr.visit<void>(i, drawsAsSingletonPictures); | 1082 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1083 } | 1083 } |
| 1084 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1084 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1085 | 1085 |
| 1086 canvas->drawPicture(macroPic); | 1086 canvas->drawPicture(macroPic); |
| 1087 return ""; | 1087 return ""; |
| 1088 }); | 1088 }); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 } // namespace DM | 1091 } // namespace DM |
| OLD | NEW |