• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/third_party/agg23/agg_rasterizer_scanline_aa.cpp b/third_party/agg23/agg_rasterizer_scanline_aa.cpp
2index c90bdafdd..1fe9a0c32 100644
3--- a/third_party/agg23/agg_rasterizer_scanline_aa.cpp
4+++ b/third_party/agg23/agg_rasterizer_scanline_aa.cpp
5@@ -495,4 +495,11 @@ void outline_aa::sort_cells()
6     }
7     m_sorted = true;
8 }
9+// static
10+int rasterizer_scanline_aa::calculate_area(int cover, int shift)
11+{
12+    unsigned int result = cover;
13+    result <<= shift;
14+    return result;
15+}
16 }
17diff --git a/third_party/agg23/agg_rasterizer_scanline_aa.h b/third_party/agg23/agg_rasterizer_scanline_aa.h
18index c747ee379..281933710 100644
19--- a/third_party/agg23/agg_rasterizer_scanline_aa.h
20+++ b/third_party/agg23/agg_rasterizer_scanline_aa.h
21@@ -338,7 +338,6 @@ public:
22                 const cell_aa* cur_cell = *cells;
23                 int x    = cur_cell->x;
24                 int area = cur_cell->area;
25-                unsigned alpha;
26                 cover += cur_cell->cover;
27                 while(--num_cells) {
28                     cur_cell = *++cells;
29@@ -349,14 +348,14 @@ public:
30                     cover += cur_cell->cover;
31                 }
32                 if(area) {
33-                    alpha = calculate_alpha((cover << (poly_base_shift + 1)) - area, no_smooth);
34+                    unsigned alpha = calculate_alpha(calculate_area(cover, poly_base_shift + 1) - area, no_smooth);
35                     if(alpha) {
36                         sl.add_cell(x, alpha);
37                     }
38                     x++;
39                 }
40                 if(num_cells && cur_cell->x > x) {
41-                    alpha = calculate_alpha(cover << (poly_base_shift + 1), no_smooth);
42+                    unsigned alpha = calculate_alpha(calculate_area(cover, poly_base_shift + 1), no_smooth);
43                     if(alpha) {
44                         sl.add_span(x, cur_cell->x - x, alpha);
45                     }
46@@ -459,6 +458,8 @@ private:
47         m_prev_y = y;
48     }
49 private:
50+    static int calculate_area(int cover, int shift);
51+
52     outline_aa     m_outline;
53     filling_rule_e m_filling_rule;
54     int            m_clipped_start_x;
55