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 SkCodec::Result result = SkCodec::kUnimplemented; | 355 const SkCodec::Result result = scanlineDecoder->getScanlines( |
356 switch (scanlineDecoder->getScanlineOrder()) { | 356 bitmap.getAddr(0, 0), decodeInfo.height(), bitmap.rowBytes()
); |
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 | |
377 switch (result) { | 357 switch (result) { |
378 case SkCodec::kSuccess: | 358 case SkCodec::kSuccess: |
379 case SkCodec::kIncompleteInput: | 359 case SkCodec::kIncompleteInput: |
380 break; | 360 break; |
381 default: | 361 default: |
382 return SkStringPrintf("%s failed with error message %d", | 362 return SkStringPrintf("%s failed with error message %d", |
383 fPath.c_str(), (int) result); | 363 fPath.c_str(), (int) result); |
384 } | 364 } |
385 canvas->drawBitmap(bitmap, 0, 0); | 365 canvas->drawBitmap(bitmap, 0, 0); |
386 break; | 366 break; |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 skr.visit<void>(i, drawsAsSingletonPictures); | 1242 skr.visit<void>(i, drawsAsSingletonPictures); |
1263 } | 1243 } |
1264 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1244 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1265 | 1245 |
1266 canvas->drawPicture(macroPic); | 1246 canvas->drawPicture(macroPic); |
1267 return ""; | 1247 return ""; |
1268 }); | 1248 }); |
1269 } | 1249 } |
1270 | 1250 |
1271 } // namespace DM | 1251 } // namespace DM |
OLD | NEW |