xref: /aosp_15_r20/external/pdfium/third_party/agg23/0009-infinite-loop.patch (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Workerdiff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h
2*3ac0a46fSAndroid Build Coastguard Workerindex 8515d2b16..70d1f2cf9 100644
3*3ac0a46fSAndroid Build Coastguard Worker--- a/third_party/agg23/agg_math_stroke.h
4*3ac0a46fSAndroid Build Coastguard Worker+++ b/third_party/agg23/agg_math_stroke.h
5*3ac0a46fSAndroid Build Coastguard Worker@@ -173,6 +173,9 @@ void stroke_calc_cap(VertexConsumer& out_vertices,
6*3ac0a46fSAndroid Build Coastguard Worker       float a1 = atan2(dy1, -dx1);
7*3ac0a46fSAndroid Build Coastguard Worker       float a2 = a1 + FXSYS_PI;
8*3ac0a46fSAndroid Build Coastguard Worker       float da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
9*3ac0a46fSAndroid Build Coastguard Worker+      if (da < stroke_theta) {
10*3ac0a46fSAndroid Build Coastguard Worker+        da = stroke_theta;
11*3ac0a46fSAndroid Build Coastguard Worker+      }
12*3ac0a46fSAndroid Build Coastguard Worker       out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1));
13*3ac0a46fSAndroid Build Coastguard Worker       a1 += da;
14*3ac0a46fSAndroid Build Coastguard Worker       a2 -= da / 4;
15*3ac0a46fSAndroid Build Coastguard Worker@@ -180,8 +183,8 @@ void stroke_calc_cap(VertexConsumer& out_vertices,
16*3ac0a46fSAndroid Build Coastguard Worker         out_vertices.add(
17*3ac0a46fSAndroid Build Coastguard Worker             coord_type(v0.x + (width * cos(a1)), v0.y + (width * sin(a1))));
18*3ac0a46fSAndroid Build Coastguard Worker         a1 += da;
19*3ac0a46fSAndroid Build Coastguard Worker-        }
20*3ac0a46fSAndroid Build Coastguard Worker-        out_vertices.add(coord_type(v0.x + dx1, v0.y - dy1));
21*3ac0a46fSAndroid Build Coastguard Worker+      }
22*3ac0a46fSAndroid Build Coastguard Worker+      out_vertices.add(coord_type(v0.x + dx1, v0.y - dy1));
23*3ac0a46fSAndroid Build Coastguard Worker     }
24*3ac0a46fSAndroid Build Coastguard Worker }
25*3ac0a46fSAndroid Build Coastguard Worker template<class VertexConsumer>
26