зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1701758. Avoid identity sRGB transforms. r=aosmond
This avoids the performance cost and ensures the data remains unchanged. Differential Revision: https://phabricator.services.mozilla.com/D110289
This commit is contained in:
Родитель
4f9e9360fc
Коммит
23af50ef79
|
@ -168,6 +168,7 @@ void qcms_profile_release(qcms_profile *profile);
|
|||
bool qcms_profile_is_bogus(qcms_profile *profile);
|
||||
qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile);
|
||||
icColorSpaceSignature qcms_profile_get_color_space(qcms_profile *profile);
|
||||
bool qcms_profile_is_sRGB(qcms_profile *profile);
|
||||
|
||||
void qcms_profile_precache_output_transform(qcms_profile *profile);
|
||||
|
||||
|
|
|
@ -89,6 +89,10 @@ pub extern "C" fn qcms_profile_get_rendering_intent(profile: &Profile) -> Intent
|
|||
pub extern "C" fn qcms_profile_get_color_space(profile: &Profile) -> icColorSpaceSignature {
|
||||
profile.color_space
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn qcms_profile_is_sRGB(profile: &Profile) -> bool {
|
||||
profile.is_sRGB()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn qcms_profile_release(profile: *mut Profile) {
|
||||
|
|
|
@ -62,6 +62,7 @@ pub struct Profile {
|
|||
pub(crate) output_table_r: Option<Arc<PrecacheOuput>>,
|
||||
pub(crate) output_table_g: Option<Arc<PrecacheOuput>>,
|
||||
pub(crate) output_table_b: Option<Arc<PrecacheOuput>>,
|
||||
is_srgb: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -1009,7 +1010,14 @@ impl Profile {
|
|||
let D65 = qcms_white_point_sRGB();
|
||||
let table = build_sRGB_gamma_table(1024);
|
||||
|
||||
Profile::new_rgb_with_table(D65, Rec709Primaries, &table).unwrap()
|
||||
let mut srgb = Profile::new_rgb_with_table(D65, Rec709Primaries, &table).unwrap();
|
||||
srgb.is_srgb = Some(true);
|
||||
srgb
|
||||
}
|
||||
|
||||
/// Returns true if this profile is sRGB
|
||||
pub fn is_sRGB(&self) -> bool {
|
||||
matches!(self.is_srgb, Some(true))
|
||||
}
|
||||
|
||||
/// Create a new profile with D50 adopted white and identity transform functions
|
||||
|
|
|
@ -113,6 +113,10 @@ qcms_transform* Decoder::GetCMSsRGBTransform(SurfaceFormat aFormat) const {
|
|||
// color management entirely.
|
||||
return nullptr;
|
||||
}
|
||||
if (qcms_profile_is_sRGB(gfxPlatform::GetCMSOutputProfile())) {
|
||||
// Device space is sRGB so we can skip color management as well.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (aFormat) {
|
||||
case SurfaceFormat::B8G8R8A8:
|
||||
|
|
Загрузка…
Ссылка в новой задаче