summaryrefslogtreecommitdiffstats
path: root/patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch')
-rw-r--r--patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch b/patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch
new file mode 100644
index 000000000..d86a8eb99
--- /dev/null
+++ b/patches/DirectFB-1.3.0/old-patches-for-reference/fast_rgb32_to_rgb16.patch
@@ -0,0 +1,60 @@
+diff -pur DirectFB-1.0.1/src/gfx/generic/generic.c DirectFB-1.0.1-hacked/src/gfx/generic/generic.c
+--- DirectFB-1.0.1/src/gfx/generic/generic.c 2007-08-19 23:52:06.000000000 +0200
++++ DirectFB-1.0.1-hacked/src/gfx/generic/generic.c 2007-11-23 20:42:21.000000000 +0100
+@@ -6455,6 +6458,42 @@ Bop_rgb24_to_Aop_rgb16_LE( GenefxState *
+ S += 3;
+ }
+ }
++
++/*
++ * Fast RGB32 to RGB16 conversion.
++ */
++static void
++Bop_rgb32_to_Aop_rgb16_LE( GenefxState *gfxs )
++{
++ int w = gfxs->length;
++ u32 *S = gfxs->Bop[0];
++ u32 *D = gfxs->Aop[0];
++
++ if ((unsigned long)D & 2) {
++ u16 *d = (u16*)D;
++
++ d[0] = RGB32_TO_RGB16( S[0] );
++
++ w--;
++ S++;
++
++ D = (u32*)(d+1);
++ }
++
++ while (w > 1) {
++ D[0] = RGB32_TO_RGB16( S[0] ) | (RGB32_TO_RGB16( S[1] ) << 16);
++
++ w -= 2;
++ S += 2;
++ D += 1;
++ }
++
++ if (w > 0) {
++ u16 *d = (u16*)D;
++
++ d[0] = RGB32_TO_RGB16( S[0] );
++ }
++}
+ #endif /* #ifndef WORDS_BIGENDIAN */
+
+ bool gAcquire( CardState *state, DFBAccelerationMask accel )
+@@ -6989,6 +7028,13 @@ bool gAcquire( CardState *state, DFBAcce
+ *funcs++ = Bop_rgb24_to_Aop_rgb16_LE;
+ break;
+ }
++ if (state->blittingflags == DSBLIT_NOFX &&
++ (source->format == DSPF_RGB32 || source->format == DSPF_ARGB) &&
++ destination->format == DSPF_RGB16)
++ {
++ *funcs++ = Bop_rgb32_to_Aop_rgb16_LE;
++ break;
++ }
+ #endif
+ /* fallthru */
+ case DFXL_STRETCHBLIT: {