| Index: core/src/fxge/win32/agg_clip_liang_barsky.h
|
| diff --git a/core/src/fxge/agg/agg23/agg_clip_liang_barsky.h b/core/src/fxge/win32/agg_clip_liang_barsky.h
|
| similarity index 61%
|
| rename from core/src/fxge/agg/agg23/agg_clip_liang_barsky.h
|
| rename to core/src/fxge/win32/agg_clip_liang_barsky.h
|
| index cfc4c91f607c2619d1e76d9178c6973fa29625b5..ff52cc48aa8863d2ae82be15be138fc02b259117 100644
|
| --- a/core/src/fxge/agg/agg23/agg_clip_liang_barsky.h
|
| +++ b/core/src/fxge/win32/agg_clip_liang_barsky.h
|
| @@ -1,4 +1,3 @@
|
| -
|
| //----------------------------------------------------------------------------
|
| // Anti-Grain Geometry - Version 2.3
|
| // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
| @@ -19,48 +18,38 @@
|
| //----------------------------------------------------------------------------
|
| #ifndef AGG_CLIP_LIANG_BARSKY_INCLUDED
|
| #define AGG_CLIP_LIANG_BARSKY_INCLUDED
|
| -#include "agg_basics.h"
|
| -namespace agg
|
| -{
|
| -template<class T>
|
| -inline unsigned clipping_flags(T x, T y, const rect_base<T>& clip_box)
|
| -{
|
| - return (x > clip_box.x2) |
|
| - ((y > clip_box.y2) << 1) |
|
| - ((x < clip_box.x1) << 2) |
|
| - ((y < clip_box.y1) << 3);
|
| -}
|
| -template<class T>
|
| -inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
| - const rect_base<T>& clip_box,
|
| - T* x, T* y)
|
| +#include "../../../include/fxcrt/fx_coordinates.h"
|
| +
|
| +inline unsigned clip_liang_barsky(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2,
|
| + const CFX_FloatRect& clip_box,
|
| + FX_FLOAT* x, FX_FLOAT* y)
|
| {
|
| const FX_FLOAT nearzero = 1e-30f;
|
| FX_FLOAT deltax = (FX_FLOAT)(x2 - x1);
|
| FX_FLOAT deltay = (FX_FLOAT)(y2 - y1);
|
| unsigned np = 0;
|
| if(deltax == 0) {
|
| - deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
|
| + deltax = (x1 > clip_box.left) ? -nearzero : nearzero;
|
| }
|
| FX_FLOAT xin, xout;
|
| if(deltax > 0) {
|
| - xin = (FX_FLOAT)clip_box.x1;
|
| - xout = (FX_FLOAT)clip_box.x2;
|
| + xin = (FX_FLOAT)clip_box.left;
|
| + xout = (FX_FLOAT)clip_box.right;
|
| } else {
|
| - xin = (FX_FLOAT)clip_box.x2;
|
| - xout = (FX_FLOAT)clip_box.x1;
|
| + xin = (FX_FLOAT)clip_box.right;
|
| + xout = (FX_FLOAT)clip_box.left;
|
| }
|
| FX_FLOAT tinx = FXSYS_Div(xin - x1, deltax);
|
| if(deltay == 0) {
|
| - deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
|
| + deltay = (y1 > clip_box.top) ? -nearzero : nearzero;
|
| }
|
| FX_FLOAT yin, yout;
|
| if(deltay > 0) {
|
| - yin = (FX_FLOAT)clip_box.y1;
|
| - yout = (FX_FLOAT)clip_box.y2;
|
| + yin = (FX_FLOAT)clip_box.top;
|
| + yout = (FX_FLOAT)clip_box.bottom;
|
| } else {
|
| - yin = (FX_FLOAT)clip_box.y2;
|
| - yout = (FX_FLOAT)clip_box.y1;
|
| + yin = (FX_FLOAT)clip_box.bottom;
|
| + yout = (FX_FLOAT)clip_box.top;
|
| }
|
| FX_FLOAT tiny = FXSYS_Div(yin - y1, deltay);
|
| FX_FLOAT tin1, tin2;
|
| @@ -73,8 +62,8 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
| }
|
| if(tin1 <= 1.0f) {
|
| if(0 < tin1) {
|
| - *x++ = (T)xin;
|
| - *y++ = (T)yin;
|
| + *x++ = xin;
|
| + *y++ = yin;
|
| ++np;
|
| }
|
| if(tin2 <= 1.0f) {
|
| @@ -85,21 +74,21 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
| if(tin2 <= tout1) {
|
| if(tin2 > 0) {
|
| if(tinx > tiny) {
|
| - *x++ = (T)xin;
|
| - *y++ = (T)(y1 + FXSYS_Mul(deltay, tinx));
|
| + *x++ = xin;
|
| + *y++ = (y1 + FXSYS_Mul(deltay, tinx));
|
| } else {
|
| - *x++ = (T)(x1 + FXSYS_Mul(deltax, tiny));
|
| - *y++ = (T)yin;
|
| + *x++ = (x1 + FXSYS_Mul(deltax, tiny));
|
| + *y++ = yin;
|
| }
|
| ++np;
|
| }
|
| if(tout1 < 1.0f) {
|
| if(toutx < touty) {
|
| - *x++ = (T)xout;
|
| - *y++ = (T)(y1 + FXSYS_Mul(deltay, toutx));
|
| + *x++ = xout;
|
| + *y++ = (y1 + FXSYS_Mul(deltay, toutx));
|
| } else {
|
| - *x++ = (T)(x1 + FXSYS_Mul(deltax, touty));
|
| - *y++ = (T)yout;
|
| + *x++ = (x1 + FXSYS_Mul(deltax, touty));
|
| + *y++ = yout;
|
| }
|
| } else {
|
| *x++ = x2;
|
| @@ -108,11 +97,11 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
| ++np;
|
| } else {
|
| if(tinx > tiny) {
|
| - *x++ = (T)xin;
|
| - *y++ = (T)yout;
|
| + *x++ = xin;
|
| + *y++ = yout;
|
| } else {
|
| - *x++ = (T)xout;
|
| - *y++ = (T)yin;
|
| + *x++ = xout;
|
| + *y++ = yin;
|
| }
|
| ++np;
|
| }
|
| @@ -121,5 +110,5 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
|
| }
|
| return np;
|
| }
|
| -}
|
| +
|
| #endif
|
|
|