| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/color_space.h" | 5 #include "ui/gfx/color_space.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 to_XYZD50->set3x3RowMajorf(custom_primary_matrix_); | 526 to_XYZD50->set3x3RowMajorf(custom_primary_matrix_); |
| 527 return; | 527 return; |
| 528 | 528 |
| 529 case ColorSpace::PrimaryID::INVALID: | 529 case ColorSpace::PrimaryID::INVALID: |
| 530 case ColorSpace::PrimaryID::ICC_BASED: | 530 case ColorSpace::PrimaryID::ICC_BASED: |
| 531 to_XYZD50->setIdentity(); | 531 to_XYZD50->setIdentity(); |
| 532 return; | 532 return; |
| 533 | 533 |
| 534 case ColorSpace::PrimaryID::BT709: | 534 case ColorSpace::PrimaryID::BT709: |
| 535 // BT709 is our default case. Put it after the switch just | 535 // BT709 is our default case. Put it after the switch just |
| 536 // in case we somehow get an id which is not listed in the switch. | 536 // in case we somhow get an id which is not listed in the switch. |
| 537 // (We don't want to use "default", because we want the compiler | 537 // (We don't want to use "default", because we want the compiler |
| 538 // to tell us if we forgot some enum values.) | 538 // to tell us if we forgot some enum values.) |
| 539 primaries.fRX = 0.640f; | 539 primaries.fRX = 0.640f; |
| 540 primaries.fRY = 0.330f; | 540 primaries.fRY = 0.330f; |
| 541 primaries.fGX = 0.300f; | 541 primaries.fGX = 0.300f; |
| 542 primaries.fGY = 0.600f; | 542 primaries.fGY = 0.600f; |
| 543 primaries.fBX = 0.150f; | 543 primaries.fBX = 0.150f; |
| 544 primaries.fBY = 0.060f; | 544 primaries.fBY = 0.060f; |
| 545 primaries.fWX = 0.3127f; | 545 primaries.fWX = 0.3127f; |
| 546 primaries.fWY = 0.3290f; | 546 primaries.fWY = 0.3290f; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 573 primaries.fRX = 0.630f; | 573 primaries.fRX = 0.630f; |
| 574 primaries.fRY = 0.340f; | 574 primaries.fRY = 0.340f; |
| 575 primaries.fGX = 0.310f; | 575 primaries.fGX = 0.310f; |
| 576 primaries.fGY = 0.595f; | 576 primaries.fGY = 0.595f; |
| 577 primaries.fBX = 0.155f; | 577 primaries.fBX = 0.155f; |
| 578 primaries.fBY = 0.070f; | 578 primaries.fBY = 0.070f; |
| 579 primaries.fWX = 0.3127f; | 579 primaries.fWX = 0.3127f; |
| 580 primaries.fWY = 0.3290f; | 580 primaries.fWY = 0.3290f; |
| 581 break; | 581 break; |
| 582 | 582 |
| 583 case ColorSpace::PrimaryID::APPLE_GENERIC_RGB: |
| 584 primaries.fRX = 0.63002f; |
| 585 primaries.fRY = 0.34000f; |
| 586 primaries.fGX = 0.29505f; |
| 587 primaries.fGY = 0.60498f; |
| 588 primaries.fBX = 0.15501f; |
| 589 primaries.fBY = 0.07701f; |
| 590 primaries.fWX = 0.3127f; |
| 591 primaries.fWY = 0.3290f; |
| 592 break; |
| 593 |
| 583 case ColorSpace::PrimaryID::FILM: | 594 case ColorSpace::PrimaryID::FILM: |
| 584 primaries.fRX = 0.681f; | 595 primaries.fRX = 0.681f; |
| 585 primaries.fRY = 0.319f; | 596 primaries.fRY = 0.319f; |
| 586 primaries.fGX = 0.243f; | 597 primaries.fGX = 0.243f; |
| 587 primaries.fGY = 0.692f; | 598 primaries.fGY = 0.692f; |
| 588 primaries.fBX = 0.145f; | 599 primaries.fBX = 0.145f; |
| 589 primaries.fBY = 0.049f; | 600 primaries.fBY = 0.049f; |
| 590 primaries.fWX = 0.310f; | 601 primaries.fWX = 0.310f; |
| 591 primaries.fWY = 0.136f; | 602 primaries.fWY = 0.136f; |
| 592 break; | 603 break; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 fn->fB = custom_transfer_params_[1]; | 687 fn->fB = custom_transfer_params_[1]; |
| 677 fn->fC = custom_transfer_params_[2]; | 688 fn->fC = custom_transfer_params_[2]; |
| 678 fn->fD = custom_transfer_params_[3]; | 689 fn->fD = custom_transfer_params_[3]; |
| 679 fn->fE = custom_transfer_params_[4]; | 690 fn->fE = custom_transfer_params_[4]; |
| 680 fn->fF = custom_transfer_params_[5]; | 691 fn->fF = custom_transfer_params_[5]; |
| 681 fn->fG = custom_transfer_params_[6]; | 692 fn->fG = custom_transfer_params_[6]; |
| 682 return true; | 693 return true; |
| 683 case ColorSpace::TransferID::LINEAR: | 694 case ColorSpace::TransferID::LINEAR: |
| 684 case ColorSpace::TransferID::LINEAR_HDR: | 695 case ColorSpace::TransferID::LINEAR_HDR: |
| 685 return true; | 696 return true; |
| 697 case ColorSpace::TransferID::GAMMA18: |
| 698 fn->fG = 1.801f; |
| 699 return true; |
| 686 case ColorSpace::TransferID::GAMMA22: | 700 case ColorSpace::TransferID::GAMMA22: |
| 687 fn->fG = 2.2f; | 701 fn->fG = 2.2f; |
| 688 return true; | 702 return true; |
| 689 case ColorSpace::TransferID::GAMMA24: | 703 case ColorSpace::TransferID::GAMMA24: |
| 690 fn->fG = 2.4f; | 704 fn->fG = 2.4f; |
| 691 return true; | 705 return true; |
| 692 case ColorSpace::TransferID::GAMMA28: | 706 case ColorSpace::TransferID::GAMMA28: |
| 693 fn->fG = 2.8f; | 707 fn->fG = 2.8f; |
| 694 return true; | 708 return true; |
| 695 case ColorSpace::TransferID::BT709: | 709 case ColorSpace::TransferID::BT709: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 matrix->postTranslate(-16.0f/219.0f, -15.5f/224.0f, -15.5f/224.0f); | 883 matrix->postTranslate(-16.0f/219.0f, -15.5f/224.0f, -15.5f/224.0f); |
| 870 break; | 884 break; |
| 871 } | 885 } |
| 872 } | 886 } |
| 873 | 887 |
| 874 std::ostream& operator<<(std::ostream& out, const ColorSpace& color_space) { | 888 std::ostream& operator<<(std::ostream& out, const ColorSpace& color_space) { |
| 875 return out << color_space.ToString(); | 889 return out << color_space.ToString(); |
| 876 } | 890 } |
| 877 | 891 |
| 878 } // namespace gfx | 892 } // namespace gfx |
| OLD | NEW |