]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix PlanarToDirect() optimization.
authorToni Wilen <twilen@winuae.net>
Mon, 30 May 2016 13:29:32 +0000 (16:29 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 30 May 2016 13:29:32 +0000 (16:29 +0300)
od-win32/picasso96_win.cpp

index b782fdd2eaf08206f6dd627d2f71af981e253744..05efb24831a3004433c0fce0b4a479e7d4eae76a 100644 (file)
@@ -3823,23 +3823,24 @@ static void PlanarToDirect (TrapContext *ctx, struct RenderInfo *ri, struct BitM
                        // most operations use only low palette values
                        // do not fetch and convert whole palette unless needed
                        if (v > maxc) {
-                               if (v < 4)
-                                       v = 4;
-                               else if (v < 8)
-                                       v = 8;
-                               else if (v < 16)
-                                       v = 16;
-                               else if (v < 32)
-                                       v = 32;
-                               else if (v < 64)
-                                       v = 64;
+                               int vc = v;
+                               if (vc < 3)
+                                       vc = 3;
+                               else if (vc < 7)
+                                       vc = 7;
+                               else if (vc < 15)
+                                       vc = 15;
+                               else if (vc < 31)
+                                       vc = 32;
+                               else if (vc < 63)
+                                       vc = 63;
                                else
-                                       v = 256;
-                               trap_get_longs(ctx, &cim[maxc + 1], acim + 4 + (maxc + 1) * 4, v - maxc);
-                               for (int i = maxc + 1; i <= v; i++) {
+                                       vc = 255;
+                               trap_get_longs(ctx, &cim[maxc + 1], acim + 4 + (maxc + 1) * 4, vc - maxc);
+                               for (int i = maxc + 1; i <= vc; i++) {
                                        endianswap(&cim[i], bpp);
                                }
-                               maxc = v;
+                               maxc = vc;
                        }