[Libreoffice-commits] online.git: kit/Watermark.hpp

mert (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 22 10:16:14 UTC 2019


 kit/Watermark.hpp |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit ed2c34296baa16e6d84ae01cef750a239e0bed0f
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Mon Nov 18 14:15:11 2019 +0300
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Nov 22 11:15:56 2019 +0100

    Fix watermarks overflow the document area
    
    Change-Id: Ia767d0b4f935bc28e0fb0ed0f8c2ddcfb8093734
    Reviewed-on: https://gerrit.libreoffice.org/83441
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/kit/Watermark.hpp b/kit/Watermark.hpp
index 79fd5fb2c..47aea5878 100644
--- a/kit/Watermark.hpp
+++ b/kit/Watermark.hpp
@@ -69,18 +69,22 @@ private:
         for (int to_y = from_offset_y, from_y = 0; (to_y < to_height) && (from_y < from_height) ; ++to_y, ++from_y)
             for (int to_x = from_offset_x, from_x = 0; (to_x < to_width) && (from_x < from_width); ++to_x, ++from_x)
             {
-                const unsigned char* f = from.data() + 4 * (from_y * from_width + from_x);
-                double src_r = f[0];
-                double src_g = f[1];
-                double src_b = f[2];
-                double src_a = f[3] / 255.0;
-
                 unsigned char* t = to + 4 * (to_y * to_width + to_x);
+
+                if (t[3] != 255.0)
+                    continue;
+
                 double dst_r = t[0];
                 double dst_g = t[1];
                 double dst_b = t[2];
                 double dst_a = t[3] / 255.0;
 
+                const unsigned char* f = from.data() + 4 * (from_y * from_width + from_x);
+                double src_r = f[0];
+                double src_g = f[1];
+                double src_b = f[2];
+                double src_a = f[3] / 255.0;
+
                 double out_a = src_a + dst_a * (1.0 - src_a);
                 unsigned char out_r = src_r + dst_r * (1.0 - src_a);
                 unsigned char out_g = src_g + dst_g * (1.0 - src_a);


More information about the Libreoffice-commits mailing list