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 "Resources.h" | 9 #include "Resources.h" |
10 #include "SkAndroidCodec.h" | 10 #include "SkAndroidCodec.h" |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 } | 907 } |
908 | 908 |
909 SkBitmap bitmap; | 909 SkBitmap bitmap; |
910 if (!bitmap.tryAllocPixels(bitmapInfo)) { | 910 if (!bitmap.tryAllocPixels(bitmapInfo)) { |
911 return SkStringPrintf("Image(%s) is too large (%d x %d)", fPath.c_str(), | 911 return SkStringPrintf("Image(%s) is too large (%d x %d)", fPath.c_str(), |
912 bitmapInfo.width(), bitmapInfo.height()); | 912 bitmapInfo.width(), bitmapInfo.height()); |
913 } | 913 } |
914 | 914 |
915 size_t rowBytes = bitmap.rowBytes(); | 915 size_t rowBytes = bitmap.rowBytes(); |
916 SkCodec::Result r = codec->getPixels(decodeInfo, bitmap.getPixels(), rowByte
s); | 916 SkCodec::Result r = codec->getPixels(decodeInfo, bitmap.getPixels(), rowByte
s); |
917 if (SkCodec::kSuccess != r) { | 917 if (SkCodec::kSuccess != r && SkCodec::kIncompleteInput != r) { |
918 return SkStringPrintf("Couldn't getPixels %s. Error code %d", fPath.c_st
r(), r); | 918 return SkStringPrintf("Couldn't getPixels %s. Error code %d", fPath.c_st
r(), r); |
919 } | 919 } |
920 | 920 |
921 switch (fMode) { | 921 switch (fMode) { |
922 case kBaseline_Mode: | 922 case kBaseline_Mode: |
923 case kDst_sRGB_Mode: | 923 case kDst_sRGB_Mode: |
924 case kDst_HPZR30w_Mode: | 924 case kDst_HPZR30w_Mode: |
925 canvas->drawBitmap(bitmap, 0, 0); | 925 canvas->drawBitmap(bitmap, 0, 0); |
926 break; | 926 break; |
927 #if defined(SK_TEST_QCMS) | 927 #if defined(SK_TEST_QCMS) |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 Error err = src.draw(&rec); | 1635 Error err = src.draw(&rec); |
1636 if (!err.isEmpty()) { | 1636 if (!err.isEmpty()) { |
1637 return err; | 1637 return err; |
1638 } | 1638 } |
1639 dl->draw(canvas); | 1639 dl->draw(canvas); |
1640 return check_against_reference(bitmap, src, fSink); | 1640 return check_against_reference(bitmap, src, fSink); |
1641 }); | 1641 }); |
1642 } | 1642 } |
1643 | 1643 |
1644 } // namespace DM | 1644 } // namespace DM |
OLD | NEW |