Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 2316123002: Switch Canvas2DLayerBridge to new SkColorSpace gamma APIs (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 766 }
767 767
768 static gfx::ColorSpace SkColorSpaceToColorSpace(const SkColorSpace* skColorSpace ) 768 static gfx::ColorSpace SkColorSpaceToColorSpace(const SkColorSpace* skColorSpace )
769 { 769 {
770 // TODO(crbug.com/634102): Eliminate this clumsy conversion by unifying 770 // TODO(crbug.com/634102): Eliminate this clumsy conversion by unifying
771 // SkColorSpace and gfx::ColorSpace. 771 // SkColorSpace and gfx::ColorSpace.
772 if (!skColorSpace) 772 if (!skColorSpace)
773 return gfx::ColorSpace(); 773 return gfx::ColorSpace();
774 774
775 gfx::ColorSpace::TransferID transferID = gfx::ColorSpace::TransferID::UNSPEC IFIED; 775 gfx::ColorSpace::TransferID transferID = gfx::ColorSpace::TransferID::UNSPEC IFIED;
776 switch (skColorSpace->gammaNamed()) { 776 if (skColorSpace->gammaCloseToSRGB()) {
777 case SkColorSpace::kSRGB_GammaNamed:
778 transferID = gfx::ColorSpace::TransferID::IEC61966_2_1; 777 transferID = gfx::ColorSpace::TransferID::IEC61966_2_1;
779 break; 778 } else if (skColorSpace->gammaIsLinear()) {
780 case SkColorSpace::kLinear_GammaNamed:
781 transferID = gfx::ColorSpace::TransferID::LINEAR; 779 transferID = gfx::ColorSpace::TransferID::LINEAR;
782 break; 780 } else {
783 default:
784 // TODO(crbug.com/634102): Not all curve type are supported 781 // TODO(crbug.com/634102): Not all curve type are supported
785 DCHECK(false); 782 DCHECK(false);
786 } 783 }
787 784
788 // TODO(crbug.com/634102): No primary conversions are performed. 785 // TODO(crbug.com/634102): No primary conversions are performed.
789 // Rec-709 is assumed. 786 // Rec-709 is assumed.
790 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT709, transferID, gfx::C olorSpace::MatrixID::RGB, gfx::ColorSpace::RangeID::FULL); 787 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT709, transferID, gfx::C olorSpace::MatrixID::RGB, gfx::ColorSpace::RangeID::FULL);
791 } 788 }
792 789
793 bool Canvas2DLayerBridge::PrepareTextureMailbox( 790 bool Canvas2DLayerBridge::PrepareTextureMailbox(
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 Canvas2DLayerBridge::MailboxInfo::MailboxInfo() = default; 1013 Canvas2DLayerBridge::MailboxInfo::MailboxInfo() = default;
1017 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) = defaul t; 1014 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) = defaul t;
1018 1015
1019 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 1016 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
1020 { 1017 {
1021 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 1018 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
1022 hibernationHistogram.count(event); 1019 hibernationHistogram.count(event);
1023 } 1020 }
1024 1021
1025 } // namespace blink 1022 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698