[haiku-commits] haiku: hrev46815 - src/servers/app

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 4 Feb 2014 00:12:59 +0100 (CET)

hrev46815 adds 1 changeset to branch 'master'
old head: 77214b5abc6721fed46b997425b716b05169eb10
new head: 27a5783afcd3fa968fc46bed5bcd119102191f23
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=27a5783+%5E77214b5

----------------------------------------------------------------------------

27a5783: agg_clipped_alpha_mask.h: Partially revert previous commit.
  
  There wasn't an out-of-bounds access, I read the code wrongly. Keep the code
  in sync with the AGG version. What happens is that for x < 0 and xmax < 0,
  the code will memset the x < 0 region twice, unless I am still irritated...

                                      [ Stephan Aßmus <superstippi@xxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46815
Commit:      27a5783afcd3fa968fc46bed5bcd119102191f23
URL:         http://cgit.haiku-os.org/haiku/commit/?id=27a5783
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Mon Feb  3 23:05:54 2014 UTC

----------------------------------------------------------------------------

1 file changed, 11 insertions(+), 11 deletions(-)
src/servers/app/agg_clipped_alpha_mask.h | 22 +++++++++++-----------

----------------------------------------------------------------------------

diff --git a/src/servers/app/agg_clipped_alpha_mask.h 
b/src/servers/app/agg_clipped_alpha_mask.h
index 73816ad..59c7774 100644
--- a/src/servers/app/agg_clipped_alpha_mask.h
+++ b/src/servers/app/agg_clipped_alpha_mask.h
@@ -72,27 +72,27 @@ namespace agg
                                        x = 0;
                                }
 
-                               int rest = 0;
                                if(x + count > xmax)
                                {
-                                       rest = x + count - xmax - 1;
+                                       int rest = x + count - xmax - 1;
                                        count -= rest;
+                                       if(count <= 0) 
+                                       {
+                                               memset(dst, m_outside, num_pix 
* sizeof(cover_type));
+                                               return;
+                                       }
+                                       memset(covers + count, m_outside, rest 
* sizeof(cover_type));
                                }
-
+       
                                const int8u* mask = m_rbuf->row_ptr(y) + x * 
Step + Offset;
-                               while(count != 0)
+                               do
                                {
                                        *covers = (cover_type)((cover_full + 
(*covers) * (*mask))
-                                                       >> cover_shift);
+                                               >> cover_shift);
                                        ++covers;
                                        mask += Step;
-                                       --count;
-                               }
-
-                               if(rest > 0) 
-                               {
-                                       memset(covers, m_outside, rest * 
sizeof(cover_type));
                                }
+                               while(--count);
                        }
 
                private:


Other related posts:

  • » [haiku-commits] haiku: hrev46815 - src/servers/app - superstippi