fix smooth scaler to not round down incorrectly.
authorCarsten Haitzler <raster@rasterman.com>
Wed, 1 Dec 2010 09:46:26 +0000 (09:46 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 1 Dec 2010 09:46:26 +0000 (09:46 +0000)
SVN revision: 55114

legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c
legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx_downy.c
legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downy.c

index f413b227ab75a9f58c5f66d3593973a060bef2d8..466135fd5aa034e8bc6bc85466b73dd0e68167d2 100644 (file)
                            g += ((gg - g) * yap) >> 8;
                            b += ((bb - b) * yap) >> 8;
                         }
-                      *pbuf++ = ARGB_JOIN(a >> 4, r >> 4, g >> 4, b >> 4);
+                       *pbuf++ = ARGB_JOIN(((a + (1 << 3)) >> 4),
+                                           ((r + (1 << 3)) >> 4),
+                                           ((g + (1 << 3)) >> 4),
+                                           ((b + (1 << 3)) >> 4));
                       xp++;  xapp++;
                    }
 
                                 g += ((gg - g) * yap) >> 8;
                                 b += ((bb - b) * yap) >> 8;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 4, g >> 4, b >> 4);
+                            *pbuf++ = ARGB_JOIN(0xff,
+                                                ((r + (1 << 3)) >> 4),
+                                                ((g + (1 << 3)) >> 4),
+                                                ((b + (1 << 3)) >> 4));
                            xp++;  xapp++;
                         }
                    }
                                 g += ((gg - g) * yap) >> 8;
                                 b += ((bb - b) * yap) >> 8;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 4, g >> 4, b >> 4);
+                            *pbuf++ = ARGB_JOIN(0xff,
+                                                ((r + (1 << 3)) >> 4),
+                                                ((g + (1 << 3)) >> 4),
+                                                ((b + (1 << 3)) >> 4));
                            xp++;  xapp++;
                         }
 
index f83018714741e1eeb5e56bfd28d3c300d54e16f0..bfe47d71d20c082d0ac5e5e7cecfc0fea11739ce 100644 (file)
                            g += (gx * j) >> 14;
                            b += (bx * j) >> 14;
                         }
-                      *pbuf++ = ARGB_JOIN(a >> 5, r >> 5, g >> 5, b >> 5);
+                      *pbuf++ = ARGB_JOIN(((a + (1 << 4)) >> 5), 
+                                           ((r + (1 << 4)) >> 5), 
+                                           ((g + (1 << 4)) >> 5), 
+                                           ((b + (1 << 4)) >> 5));
                       xp++;  xapp++;
                    }
                  
                                 g += (gx * j) >> 14;
                                 b += (bx * j) >> 14;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 5, g >> 5, b >> 5);
+                            *pbuf++ = ARGB_JOIN(0xff, 
+                                                ((r + (1 << 4)) >> 5), 
+                                                ((g + (1 << 4)) >> 5), 
+                                                ((b + (1 << 4)) >> 5));
                            xp++;  xapp++;
                         }
                    }
                                 g += (gx * j) >> 14;
                                 b += (bx * j) >> 14;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 5, g >> 5, b >> 5);
+                            *pbuf++ = ARGB_JOIN(0xff, 
+                                                ((r + (1 << 4)) >> 5), 
+                                                ((g + (1 << 4)) >> 5), 
+                                                ((b + (1 << 4)) >> 5));
                            xp++;  xapp++;
                         }
                       
index 89cc883f2f227b09f71db0e31e0d39f092f23cb9..a6cf34cb84ea9f37156823524a3841e296d64519 100644 (file)
                            g += ((gg - g) * xap) >> 8;
                            b += ((bb - b) * xap) >> 8;
                         }
-                      *pbuf++ = ARGB_JOIN(a >> 4, r >> 4, g >> 4, b >> 4);
+                       *pbuf++ = ARGB_JOIN(((a + (1 << 3)) >> 4),
+                                           ((r + (1 << 3)) >> 4),
+                                           ((g + (1 << 3)) >> 4),
+                                           ((b + (1 << 3)) >> 4));
                       xp++;  xapp++;
                    }
 
                                 g += ((gg - g) * xap) >> 8;
                                 b += ((bb - b) * xap) >> 8;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 4, g >> 4, b >> 4);
+                            *pbuf++ = ARGB_JOIN(0xff,
+                                                ((r + (1 << 3)) >> 4),
+                                                ((g + (1 << 3)) >> 4),
+                                                ((b + (1 << 3)) >> 4));
                            xp++;  xapp++;
                         }
                    }
                                 g += ((gg - g) * xap) >> 8;
                                 b += ((bb - b) * xap) >> 8;
                              }
-                           *pbuf++ = ARGB_JOIN(0xff, r >> 4, g >> 4, b >> 4);
+                            *pbuf++ = ARGB_JOIN(0xff,
+                                                ((r + (1 << 3)) >> 4),
+                                                ((g + (1 << 3)) >> 4),
+                                                ((b + (1 << 3)) >> 4));
                            xp++;  xapp++;
                         }