OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkColorSpace.h" | 8 #include "SkColorSpace.h" |
9 #include "SkColorSpace_Base.h" | 9 #include "SkColorSpace_Base.h" |
10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 bool load_matrix(SkMatrix44* toXYZ, const uint8_t* src, size_t len) { | 616 bool load_matrix(SkMatrix44* toXYZ, const uint8_t* src, size_t len) { |
617 if (len < 48) { | 617 if (len < 48) { |
618 SkColorSpacePrintf("Matrix tag is too small (%d bytes).", len); | 618 SkColorSpacePrintf("Matrix tag is too small (%d bytes).", len); |
619 return false; | 619 return false; |
620 } | 620 } |
621 | 621 |
622 float array[16]; | 622 float array[16]; |
623 array[ 0] = SkFixedToFloat(read_big_endian_int(src)); | 623 array[ 0] = SkFixedToFloat(read_big_endian_int(src)); |
624 array[ 1] = SkFixedToFloat(read_big_endian_int(src + 4)); | 624 array[ 1] = SkFixedToFloat(read_big_endian_int(src + 4)); |
625 array[ 2] = SkFixedToFloat(read_big_endian_int(src + 8)); | 625 array[ 2] = SkFixedToFloat(read_big_endian_int(src + 8)); |
626 array[ 3] = 0; | 626 array[ 3] = SkFixedToFloat(read_big_endian_int(src + 36)); // translate R |
627 array[ 4] = SkFixedToFloat(read_big_endian_int(src + 12)); | 627 array[ 4] = SkFixedToFloat(read_big_endian_int(src + 12)); |
628 array[ 5] = SkFixedToFloat(read_big_endian_int(src + 16)); | 628 array[ 5] = SkFixedToFloat(read_big_endian_int(src + 16)); |
629 array[ 6] = SkFixedToFloat(read_big_endian_int(src + 20)); | 629 array[ 6] = SkFixedToFloat(read_big_endian_int(src + 20)); |
630 array[ 7] = 0; | 630 array[ 7] = SkFixedToFloat(read_big_endian_int(src + 40)); // translate G |
631 array[ 8] = SkFixedToFloat(read_big_endian_int(src + 24)); | 631 array[ 8] = SkFixedToFloat(read_big_endian_int(src + 24)); |
632 array[ 9] = SkFixedToFloat(read_big_endian_int(src + 28)); | 632 array[ 9] = SkFixedToFloat(read_big_endian_int(src + 28)); |
633 array[10] = SkFixedToFloat(read_big_endian_int(src + 32)); | 633 array[10] = SkFixedToFloat(read_big_endian_int(src + 32)); |
634 array[11] = 0; | 634 array[11] = SkFixedToFloat(read_big_endian_int(src + 44)); // translate B |
635 array[12] = SkFixedToFloat(read_big_endian_int(src + 36)); // translate R | 635 array[12] = 0.0f; |
636 array[13] = SkFixedToFloat(read_big_endian_int(src + 40)); // translate G | 636 array[13] = 0.0f; |
637 array[14] = SkFixedToFloat(read_big_endian_int(src + 44)); | 637 array[14] = 0.0f; |
638 array[15] = 1; | 638 array[15] = 1.0f; |
639 toXYZ->setColMajorf(array); | 639 toXYZ->setColMajorf(array); |
640 return true; | 640 return true; |
641 } | 641 } |
642 | 642 |
643 bool load_a2b0(SkColorLookUpTable* colorLUT, SkGammaCurve* gammas, SkMatrix44* t
oXYZ, | 643 bool load_a2b0(SkColorLookUpTable* colorLUT, SkGammaCurve* gammas, SkMatrix44* t
oXYZ, |
644 const uint8_t* src, size_t len) { | 644 const uint8_t* src, size_t len) { |
645 if (len < 32) { | 645 if (len < 32) { |
646 SkColorSpacePrintf("A to B tag is too small (%d bytes).", len); | 646 SkColorSpacePrintf("A to B tag is too small (%d bytes).", len); |
647 return false; | 647 return false; |
648 } | 648 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 } | 829 } |
830 } | 830 } |
831 | 831 |
832 } | 832 } |
833 default: | 833 default: |
834 break; | 834 break; |
835 } | 835 } |
836 | 836 |
837 return_null("ICC profile contains unsupported colorspace"); | 837 return_null("ICC profile contains unsupported colorspace"); |
838 } | 838 } |
OLD | NEW |