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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 case kDst_sRGB_Mode: | 889 case kDst_sRGB_Mode: |
890 case kDst_HPZR30w_Mode: { | 890 case kDst_HPZR30w_Mode: { |
891 sk_sp<SkColorSpace> srcSpace = sk_ref_sp(codec->getColorSpace()); | 891 sk_sp<SkColorSpace> srcSpace = sk_ref_sp(codec->getColorSpace()); |
892 sk_sp<SkColorSpace> dstSpace = (kDst_sRGB_Mode == fMode) ? | 892 sk_sp<SkColorSpace> dstSpace = (kDst_sRGB_Mode == fMode) ? |
893 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : | 893 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : |
894 SkColorSpace::NewICC(dstData->data(), dstData->size()); | 894 SkColorSpace::NewICC(dstData->data(), dstData->size()); |
895 SkASSERT(dstSpace); | 895 SkASSERT(dstSpace); |
896 | 896 |
897 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(sr
cSpace, dstSpace); | 897 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(sr
cSpace, dstSpace); |
898 if (!xform) { | 898 if (!xform) { |
899 // FIXME (msarett): | 899 return "Unimplemented color conversion."; |
900 // I haven't implemented conversions for all of the images that
I've uploaded for | |
901 // testing. Once we support all of them, this should be a fatal
error. | |
902 return Error::Nonfatal("Unimplemented color conversion."); | |
903 } | 900 } |
904 | 901 |
905 uint32_t* row = (uint32_t*) bitmap.getPixels(); | 902 uint32_t* row = (uint32_t*) bitmap.getPixels(); |
906 for (int y = 0; y < info.height(); y++) { | 903 for (int y = 0; y < info.height(); y++) { |
907 xform->xform_RGB1_8888(row, row, info.width()); | 904 xform->xform_RGB1_8888(row, row, info.width()); |
908 row = SkTAddOffset<uint32_t>(row, bitmap.rowBytes()); | 905 row = SkTAddOffset<uint32_t>(row, bitmap.rowBytes()); |
909 } | 906 } |
910 | 907 |
911 canvas->drawBitmap(bitmap, 0, 0); | 908 canvas->drawBitmap(bitmap, 0, 0); |
912 break; | 909 break; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 skr.visit(i, drawsAsSingletonPictures); | 1543 skr.visit(i, drawsAsSingletonPictures); |
1547 } | 1544 } |
1548 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); | 1545 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); |
1549 | 1546 |
1550 canvas->drawPicture(macroPic); | 1547 canvas->drawPicture(macroPic); |
1551 return check_against_reference(bitmap, src, fSink); | 1548 return check_against_reference(bitmap, src, fSink); |
1552 }); | 1549 }); |
1553 } | 1550 } |
1554 | 1551 |
1555 } // namespace DM | 1552 } // namespace DM |
OLD | NEW |