void-packages/srcpkgs/firefox-esr/patches/fix-image-format-warning.patch
Đoàn Trần Công Danh be5369a0cb srcpkgs/f*: convert patches to -Np1
* fpc is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

39 lines
1.5 KiB
Diff

# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1462463631 14400
# Thu May 05 11:53:51 2016 -0400
# Node ID 8da374804a09977c8f89af5e6e0cb37cb074595d
# Parent 29662e28a9c93ac67ee0b8ddfb65a9f29bbf73f5
handle big-endian formats in Cairo format conversions
--- a/gfx/2d/HelpersCairo.h
+++ b/gfx/2d/HelpersCairo.h
@@ -147,7 +147,14 @@ static inline cairo_format_t GfxFormatToCairoFormat(Su
case SurfaceFormat::R5G6B5_UINT16:
return CAIRO_FORMAT_RGB16_565;
default:
- gfxCriticalError() << "Unknown image format " << (int)format;
+ // _UINT32 formats don't match B8G8R8[AX]8 on big-endian platforms,
+ // and Moz2d uses B8G8R8[AX]8 as if it was _UINT32.
+ // See bug 1269654
+ if (format == SurfaceFormat::B8G8R8X8) {
+ return CAIRO_FORMAT_RGB24;
+ } else if (format != SurfaceFormat::B8G8R8A8) {
+ gfxCriticalError() << "Unknown image format " << (int)format;
+ }
return CAIRO_FORMAT_ARGB32;
}
}
@@ -177,7 +184,11 @@ static inline cairo_content_t GfxFormatToCairoContent(
case SurfaceFormat::A8:
return CAIRO_CONTENT_ALPHA;
default:
- gfxCriticalError() << "Unknown image content format " << (int)format;
+ if (format == SurfaceFormat::B8G8R8X8) {
+ return CAIRO_CONTENT_COLOR;
+ } else if (format != SurfaceFormat::B8G8R8A8) {
+ gfxCriticalError() << "Unknown image content format " << (int)format;
+ }
return CAIRO_CONTENT_COLOR_ALPHA;
}
}