Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: core/src/fxge/agg/agg23/agg_math.h

Issue 402463002: Replace agg with skia (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix clang compile error Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/agg/agg23/agg_curves.h ('k') | core/src/fxge/agg/agg23/agg_math_stroke.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 //
6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
10 //
11 //----------------------------------------------------------------------------
12 // Contact: mcseem@antigrain.com
13 // mcseemagg@yahoo.com
14 // http://www.antigrain.com
15 //----------------------------------------------------------------------------
16 // Bessel function (besj) was adapted for use in AGG library by Andy Wilk
17 // Contact: castor.vulgaris@gmail.com
18 //----------------------------------------------------------------------------
19 #ifndef AGG_MATH_INCLUDED
20 #define AGG_MATH_INCLUDED
21 #include "agg_basics.h"
22 namespace agg
23 {
24 const FX_FLOAT intersection_epsilon = 1.0e-30f;
25 AGG_INLINE FX_FLOAT calc_point_location(FX_FLOAT x1, FX_FLOAT y1,
26 FX_FLOAT x2, FX_FLOAT y2,
27 FX_FLOAT x, FX_FLOAT y)
28 {
29 return FXSYS_Mul(x - x2, y2 - y1) - FXSYS_Mul(y - y2, x2 - x1);
30 }
31 AGG_INLINE FX_FLOAT calc_distance(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOA T y2)
32 {
33 FX_FLOAT dx = x2 - x1;
34 FX_FLOAT dy = y2 - y1;
35 return FXSYS_sqrt2(dx, dy);
36 }
37 AGG_INLINE FX_FLOAT calc_line_point_distance(FX_FLOAT x1, FX_FLOAT y1,
38 FX_FLOAT x2, FX_FLOAT y2,
39 FX_FLOAT x, FX_FLOAT y)
40 {
41 FX_FLOAT dx = x2 - x1;
42 FX_FLOAT dy = y2 - y1;
43 FX_FLOAT d = FXSYS_sqrt2(dx, dy);
44 if(d < intersection_epsilon) {
45 return calc_distance(x1, y1, x, y);
46 }
47 return FXSYS_MulDiv(x - x2, dy, d) - FXSYS_MulDiv(y - y2, dx, d);
48 }
49 AGG_INLINE bool calc_intersection(FX_FLOAT ax, FX_FLOAT ay, FX_FLOAT bx, FX_FLOA T by,
50 FX_FLOAT cx, FX_FLOAT cy, FX_FLOAT dx, FX_FLOA T dy,
51 FX_FLOAT* x, FX_FLOAT* y)
52 {
53 FX_FLOAT num = FXSYS_Mul(ay - cy, dx - cx) - FXSYS_Mul(ax - cx, dy - cy);
54 FX_FLOAT den = FXSYS_Mul(bx - ax, dy - cy) - FXSYS_Mul(by - ay, dx - cx);
55 if (FXSYS_fabs(den) < intersection_epsilon) {
56 return false;
57 }
58 *x = ax + FXSYS_MulDiv(bx - ax, num, den);
59 *y = ay + FXSYS_MulDiv(by - ay, num, den);
60 return true;
61 }
62 }
63 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/agg/agg23/agg_curves.h ('k') | core/src/fxge/agg/agg23/agg_math_stroke.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698