merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0539-canvas-colorspace-fix.diff
blob4bfe309c168e97af315214b601f29836605dc45e
1 diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
2 index 3b3571a..15245f4 100644
3 --- canvas/source/cairo/cairo_canvashelper.cxx
4 +++ canvas/source/cairo/cairo_canvashelper.cxx
5 @@ -1640,12 +1640,12 @@ namespace cairocanvas
6 rendering::RGBColor* pOut( aRes.getArray() );
7 for( sal_Size i=0; i<nLen; i+=4 )
9 - const sal_Int8 nAlpha(pIn[3]);
10 - if( nAlpha )
11 + const double fAlpha((sal_uInt8)pIn[3]);
12 + if( fAlpha )
13 *pOut++ = rendering::RGBColor(
14 - vcl::unotools::toDoubleColor(pIn[2]/nAlpha),
15 - vcl::unotools::toDoubleColor(pIn[1]/nAlpha),
16 - vcl::unotools::toDoubleColor(pIn[0]/nAlpha));
17 + pIn[2]/fAlpha,
18 + pIn[1]/fAlpha,
19 + pIn[0]/fAlpha);
20 else
21 *pOut++ = rendering::RGBColor(0,0,0);
22 pIn += 4;
23 @@ -1665,13 +1665,13 @@ namespace cairocanvas
24 rendering::ARGBColor* pOut( aRes.getArray() );
25 for( sal_Size i=0; i<nLen; i+=4 )
27 - const sal_Int8 nAlpha(pIn[3]);
28 - if( nAlpha )
29 + const double fAlpha((sal_uInt8)pIn[3]);
30 + if( fAlpha )
31 *pOut++ = rendering::ARGBColor(
32 - vcl::unotools::toDoubleColor(nAlpha),
33 - vcl::unotools::toDoubleColor(pIn[2]/nAlpha),
34 - vcl::unotools::toDoubleColor(pIn[1]/nAlpha),
35 - vcl::unotools::toDoubleColor(pIn[0]/nAlpha));
36 + fAlpha/255.0,
37 + pIn[2]/fAlpha,
38 + pIn[1]/fAlpha,
39 + pIn[0]/fAlpha);
40 else
41 *pOut++ = rendering::ARGBColor(0,0,0,0);
42 pIn += 4;