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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 canvas->drawBitmap(bitmap, 0, 0); | 345 canvas->drawBitmap(bitmap, 0, 0); |
346 break; | 346 break; |
347 } | 347 } |
348 case kScanline_Mode: { | 348 case kScanline_Mode: { |
349 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( | 349 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder( |
350 start_scanline_decoder(encoded.get(), decodeInfo, colorPtr,
colorCountPtr)); | 350 start_scanline_decoder(encoded.get(), decodeInfo, colorPtr,
colorCountPtr)); |
351 if (nullptr == scanlineDecoder) { | 351 if (nullptr == scanlineDecoder) { |
352 return Error::Nonfatal("Could not start scanline decoder"); | 352 return Error::Nonfatal("Could not start scanline decoder"); |
353 } | 353 } |
354 | 354 |
355 const SkCodec::Result result = scanlineDecoder->getScanlines( | 355 SkCodec::Result result = SkCodec::kUnimplemented; |
356 bitmap.getAddr(0, 0), decodeInfo.height(), bitmap.rowBytes()
); | 356 switch (scanlineDecoder->getScanlineOrder()) { |
| 357 case SkScanlineDecoder::kTopDown_SkScanlineOrder: |
| 358 case SkScanlineDecoder::kBottomUp_SkScanlineOrder: |
| 359 case SkScanlineDecoder::kNone_SkScanlineOrder: |
| 360 result = scanlineDecoder->getScanlines(bitmap.getAddr(0, 0), |
| 361 decodeInfo.height(), bitmap.rowBytes()); |
| 362 break; |
| 363 case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: { |
| 364 for (int y = 0; y < decodeInfo.height(); y++) { |
| 365 int dstY = scanlineDecoder->getY(); |
| 366 void* dstPtr = bitmap.getAddr(0, dstY); |
| 367 result = scanlineDecoder->getScanlines(dstPtr, 1, bitmap
.rowBytes()); |
| 368 if (SkCodec::kSuccess != result && SkCodec::kIncompleteI
nput != result) { |
| 369 return SkStringPrintf("%s failed with error message
%d", |
| 370 fPath.c_str(), (int) result); |
| 371 } |
| 372 } |
| 373 break; |
| 374 } |
| 375 } |
| 376 |
357 switch (result) { | 377 switch (result) { |
358 case SkCodec::kSuccess: | 378 case SkCodec::kSuccess: |
359 case SkCodec::kIncompleteInput: | 379 case SkCodec::kIncompleteInput: |
360 break; | 380 break; |
361 default: | 381 default: |
362 return SkStringPrintf("%s failed with error message %d", | 382 return SkStringPrintf("%s failed with error message %d", |
363 fPath.c_str(), (int) result); | 383 fPath.c_str(), (int) result); |
364 } | 384 } |
365 canvas->drawBitmap(bitmap, 0, 0); | 385 canvas->drawBitmap(bitmap, 0, 0); |
366 break; | 386 break; |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 skr.visit<void>(i, drawsAsSingletonPictures); | 1262 skr.visit<void>(i, drawsAsSingletonPictures); |
1243 } | 1263 } |
1244 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1264 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1245 | 1265 |
1246 canvas->drawPicture(macroPic); | 1266 canvas->drawPicture(macroPic); |
1247 return ""; | 1267 return ""; |
1248 }); | 1268 }); |
1249 } | 1269 } |
1250 | 1270 |
1251 } // namespace DM | 1271 } // namespace DM |
OLD | NEW |