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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 canvas->drawBitmap(bitmap, 0, 0); | 188 canvas->drawBitmap(bitmap, 0, 0); |
| 189 break; | 189 break; |
| 190 } | 190 } |
| 191 case kScanline_Mode: { | 191 case kScanline_Mode: { |
| 192 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( | 192 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( |
| 193 start_scanline_decoder(encoded.get(), decodeInfo, colorPtr, colorCountPtr)); | 193 start_scanline_decoder(encoded.get(), decodeInfo, colorPtr, colorCountPtr)); |
| 194 if (nullptr == scanlineDecoder) { | 194 if (nullptr == scanlineDecoder) { |
| 195 return Error::Nonfatal("Could not start scanline decoder"); | 195 return Error::Nonfatal("Could not start scanline decoder"); |
| 196 } | 196 } |
| 197 | 197 |
| 198 const SkCodec::Result result = scanlineDecoder->getScanlines( | 198 SkCodec::Result result; |
| 199 bitmap.getAddr(0, 0), decodeInfo.height(), bitmap.rowBytes() ); | 199 switch (scanlineDecoder->getScanlineOrder()) { |
| 200 case SkScanlineDecoder::kTopDown_SkScanlineOrder: | |
| 201 case SkScanlineDecoder::kBottomUp_SkScanlineOrder: | |
| 202 case SkScanlineDecoder::kNone_SkScanlineOrder: | |
| 203 result = scanlineDecoder->getScanlines(bitmap.getAddr(0, 0), | |
| 204 decodeInfo.height(), bitmap.rowBytes()); | |
| 205 break; | |
| 206 case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: { | |
| 207 for (int y = 0; y < decodeInfo.height(); y++) { | |
| 208 int dstY = scanlineDecoder->getY(); | |
| 209 void* dstPtr = bitmap.getAddr(0, dstY); | |
| 210 result = scanlineDecoder->getScanlines(dstPtr, 1, bitmap .rowBytes()); | |
| 211 if (SkCodec::kSuccess != result && SkCodec::kIncompleteI nput != result) { | |
|
scroggo
2015/09/02 22:45:47
The weird thing about allowing incomplete here is
msarett
2015/09/03 17:13:30
Actually the reason that we allow kIncomplete here
scroggo
2015/09/04 18:42:09
Wait, so you're saying that the scanline decoder w
msarett
2015/09/04 19:52:47
Yes that's what it does.
| |
| 212 return SkStringPrintf("%s failed with error message %d", | |
| 213 fPath.c_str(), (int) result); | |
| 214 } | |
| 215 } | |
| 216 break; | |
| 217 } | |
| 218 } | |
| 219 | |
| 200 switch (result) { | 220 switch (result) { |
| 201 case SkCodec::kSuccess: | 221 case SkCodec::kSuccess: |
| 202 case SkCodec::kIncompleteInput: | 222 case SkCodec::kIncompleteInput: |
| 203 break; | 223 break; |
| 204 default: | 224 default: |
| 205 return SkStringPrintf("%s failed with error message %d", | 225 return SkStringPrintf("%s failed with error message %d", |
| 206 fPath.c_str(), (int) result); | 226 fPath.c_str(), (int) result); |
| 207 } | 227 } |
| 208 canvas->drawBitmap(bitmap, 0, 0); | 228 canvas->drawBitmap(bitmap, 0, 0); |
| 209 break; | 229 break; |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 skr.visit<void>(i, drawsAsSingletonPictures); | 1106 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1087 } | 1107 } |
| 1088 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1108 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1089 | 1109 |
| 1090 canvas->drawPicture(macroPic); | 1110 canvas->drawPicture(macroPic); |
| 1091 return ""; | 1111 return ""; |
| 1092 }); | 1112 }); |
| 1093 } | 1113 } |
| 1094 | 1114 |
| 1095 } // namespace DM | 1115 } // namespace DM |
| OLD | NEW |