Bug 1594425 - Part 1. Add gfxPlatform QCMS helpers for SurfaceFormat::OS_RGBA. r=tnikkel
☠☠ backed out by 75a3afcd0b4f ☠ ☠
authorAndrew Osmond <aosmond@mozilla.com>
Fri, 08 Nov 2019 14:58:36 +0000
changeset 501348 f1c1e5f12327eee77905e9b6456e667d548b6c0e
parent 501347 5bc477e6c6179d34331241e3f1b9040a69d9656e
child 501349 54a28220958bbe934eafd7063fa1ed1c046ed54d
push id114168
push userdluca@mozilla.com
push dateSun, 10 Nov 2019 03:08:55 +0000
treeherdermozilla-inbound@33f64c1ef3e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1594425
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1594425 - Part 1. Add gfxPlatform QCMS helpers for SurfaceFormat::OS_RGBA. r=tnikkel These helpers will be used by the image decoders in the next part of this series. Differential Revision: https://phabricator.services.mozilla.com/D52007
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2190,16 +2190,40 @@ qcms_transform* gfxPlatform::GetCMSBGRAT
     gCMSBGRATransform =
         qcms_transform_create(inProfile, QCMS_DATA_BGRA_8, outProfile,
                               QCMS_DATA_BGRA_8, QCMS_INTENT_PERCEPTUAL);
   }
 
   return gCMSBGRATransform;
 }
 
+qcms_transform* gfxPlatform::GetCMSOSRGBATransform() {
+  switch (SurfaceFormat::OS_RGBA) {
+    case SurfaceFormat::B8G8R8A8:
+      return GetCMSBGRATransform();
+    case SurfaceFormat::R8G8B8A8:
+      return GetCMSRGBATransform();
+    default:
+      // We do not support color management with big endian.
+      return nullptr;
+  }
+}
+
+qcms_data_type gfxPlatform::GetCMSOSRGBAType() {
+  switch (SurfaceFormat::OS_RGBA) {
+    case SurfaceFormat::B8G8R8A8:
+      return QCMS_DATA_BGRA_8;
+    case SurfaceFormat::R8G8B8A8:
+      return QCMS_DATA_RGBA_8;
+    default:
+      // We do not support color management with big endian.
+      return QCMS_DATA_RGBA_8;
+  }
+}
+
 /* Shuts down various transforms and profiles for CMS. */
 static void ShutdownCMS() {
   if (gCMSRGBTransform) {
     qcms_transform_release(gCMSRGBTransform);
     gCMSRGBTransform = nullptr;
   }
   if (gCMSInverseRGBTransform) {
     qcms_transform_release(gCMSInverseRGBTransform);
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -541,20 +541,30 @@ class gfxPlatform : public mozilla::laye
   static qcms_transform* GetCMSInverseRGBTransform();
 
   /**
    * Return sRGBA -> output device transform.
    */
   static qcms_transform* GetCMSRGBATransform();
 
   /**
-   * Return sRGBA -> output device transform.
+   * Return sBGRA -> output device transform.
    */
   static qcms_transform* GetCMSBGRATransform();
 
+  /**
+   * Return OS RGBA -> output device transform.
+   */
+  static qcms_transform* GetCMSOSRGBATransform();
+
+  /**
+   * Return OS RGBA QCMS type.
+   */
+  static qcms_data_type GetCMSOSRGBAType();
+
   virtual void FontsPrefsChanged(const char* aPref);
 
   int32_t GetBidiNumeralOption();
 
   /**
    * This is a bit ugly, but useful... force all presContexts to reflow,
    * by toggling a preference that they observe. This is used when
    * something about platform settings changes that might have an effect