26f3ef
# HG changeset patch
26f3ef
# User M. Sirringhaus <msirringhaus@suse.de>
26f3ef
# Date 1645518286 -3600
26f3ef
#      Tue Feb 22 09:24:46 2022 +0100
26f3ef
# Node ID 81832d035e101471dcf52dd91de287268add7a91
26f3ef
# Parent  66f7ce16eb4965108687280e5443edd610631efb
26f3ef
imported patch svg-rendering.patch
26f3ef
26f3ef
diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp
26f3ef
--- a/image/imgFrame.cpp
26f3ef
+++ b/image/imgFrame.cpp
26f3ef
@@ -372,6 +372,17 @@ nsresult imgFrame::InitWithDrawable(gfxD
26f3ef
     return NS_ERROR_OUT_OF_MEMORY;
26f3ef
   }
26f3ef
 
26f3ef
+#if MOZ_BIG_ENDIAN()
26f3ef
+  if (aBackend == gfx::BackendType::SKIA && canUseDataSurface) {
26f3ef
+      // SKIA is lying about what format it returns on big endian
26f3ef
+      for (int ii=0; ii < mRawSurface->GetSize().Height()*mRawSurface->Stride() / 4; ++ii) {
26f3ef
+        uint32_t *vals = (uint32_t*)(mRawSurface->GetData());
26f3ef
+        uint32_t val = ((vals[ii] << 8) & 0xFF00FF00 ) | ((vals[ii] >> 8) & 0xFF00FF );
26f3ef
+        vals[ii] = (val << 16) | (val >> 16);
26f3ef
+      }
26f3ef
+  }
26f3ef
+#endif
26f3ef
+
26f3ef
   if (!canUseDataSurface) {
26f3ef
     // We used an offscreen surface, which is an "optimized" surface from
26f3ef
     // imgFrame's perspective.