Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

During the code digging for one of the bugs, I came across GetXPixel()
function in vcl. Which seems to be implemented wrong - not sure why it
is multiplied by 257 - the idea, I believe, is to convert 8bit to 16bit
values for X11, but I may be wrong. I have attached the patch with this
mail for review.

Thank you!
Muthu Subramanian

diff --git a/vcl/unx/generic/app/saldisp.cxx
b/vcl/unx/generic/app/saldisp.cxx
index 9ef3601..a92ed1d 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -3159,9 +3159,9 @@ inline sal_Bool SalColormap::GetXPixel( XColor
&rColor,
                                           int     g,
                                           int     b ) const
 {
-    rColor.red      = r * 257;
-    rColor.green    = g * 257;
-    rColor.blue     = b * 257;
+    rColor.red      = r << 8;
+    rColor.green    = g << 8;
+    rColor.blue     = b << 8;
     return XAllocColor( GetXDisplay(), m_hColormap, &rColor );
 }


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.