| 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 "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 // Decode odd stripes | 478 // Decode odd stripes |
| 479 if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, NULL
, colorPtr, | 479 if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, NULL
, colorPtr, |
| 480 colorCountPtr))
{ | 480 colorCountPtr))
{ |
| 481 return "Could not start scanline decoder"; | 481 return "Could not start scanline decoder"; |
| 482 } | 482 } |
| 483 | 483 |
| 484 // This mode was designed to test the new skip scanlines API in libj
peg-turbo. | 484 // This mode was designed to test the new skip scanlines API in libj
peg-turbo. |
| 485 // Jpegs have kTopDown_SkScanlineOrder, and at this time, it is not
interesting | 485 // Jpegs have kTopDown_SkScanlineOrder, and at this time, it is not
interesting |
| 486 // to run this test for image types that do not have this scanline o
rdering. | 486 // to run this test for image types that do not have this scanline o
rdering. |
| 487 if (SkCodec::kTopDown_SkScanlineOrder != codec->getScanlineOrder())
{ | 487 // We only run this on Jpeg, which is always kTopDown. |
| 488 return Error::Nonfatal("kStripe test is only interesting for kTo
pDown codecs."); | 488 SkASSERT(SkCodec::kTopDown_SkScanlineOrder == codec->getScanlineOrde
r()); |
| 489 } | |
| 490 | 489 |
| 491 for (int i = 0; i < numStripes; i += 2) { | 490 for (int i = 0; i < numStripes; i += 2) { |
| 492 // Skip a stripe | 491 // Skip a stripe |
| 493 const int linesToSkip = SkTMin(stripeHeight, height - i * stripe
Height); | 492 const int linesToSkip = SkTMin(stripeHeight, height - i * stripe
Height); |
| 494 codec->skipScanlines(linesToSkip); | 493 codec->skipScanlines(linesToSkip); |
| 495 | 494 |
| 496 // Read a stripe | 495 // Read a stripe |
| 497 const int startY = (i + 1) * stripeHeight; | 496 const int startY = (i + 1) * stripeHeight; |
| 498 const int linesToRead = SkTMin(stripeHeight, height - startY); | 497 const int linesToRead = SkTMin(stripeHeight, height - startY); |
| 499 if (linesToRead > 0) { | 498 if (linesToRead > 0) { |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 skr.visit(i, drawsAsSingletonPictures); | 1562 skr.visit(i, drawsAsSingletonPictures); |
| 1564 } | 1563 } |
| 1565 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); | 1564 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); |
| 1566 | 1565 |
| 1567 canvas->drawPicture(macroPic); | 1566 canvas->drawPicture(macroPic); |
| 1568 return check_against_reference(bitmap, src, fSink); | 1567 return check_against_reference(bitmap, src, fSink); |
| 1569 }); | 1568 }); |
| 1570 } | 1569 } |
| 1571 | 1570 |
| 1572 } // namespace DM | 1571 } // namespace DM |
| OLD | NEW |