diff options
Diffstat (limited to 'src/gdiplus')
-rw-r--r-- | src/gdiplus/cdwclpp.cpp | 6 | ||||
-rw-r--r-- | src/gdiplus/cdwdbufp.cpp | 3 | ||||
-rw-r--r-- | src/gdiplus/cdwemfp.cpp | 3 | ||||
-rw-r--r-- | src/gdiplus/cdwimgp.cpp | 3 | ||||
-rw-r--r-- | src/gdiplus/cdwinp.cpp | 66 | ||||
-rw-r--r-- | src/gdiplus/cdwnativep.cpp | 3 | ||||
-rw-r--r-- | src/gdiplus/cdwprnp.cpp | 1 |
7 files changed, 68 insertions, 17 deletions
diff --git a/src/gdiplus/cdwclpp.cpp b/src/gdiplus/cdwclpp.cpp index 719713f..0e3c5ea 100644 --- a/src/gdiplus/cdwclpp.cpp +++ b/src/gdiplus/cdwclpp.cpp @@ -187,10 +187,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdClipboardContext = { - CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_FLUSH | CD_CAP_YAXIS | - CD_CAP_PLAY | - CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | - CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_FLUSH | CD_CAP_YAXIS | CD_CAP_PLAY | + CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV ), 1, cdcreatecanvas, cdinittable, diff --git a/src/gdiplus/cdwdbufp.cpp b/src/gdiplus/cdwdbufp.cpp index 87957fb..68bc7b8 100644 --- a/src/gdiplus/cdwdbufp.cpp +++ b/src/gdiplus/cdwdbufp.cpp @@ -147,8 +147,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdDBufferContext = { - CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES), + CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS ), 1, cdcreatecanvas, cdinittable, diff --git a/src/gdiplus/cdwemfp.cpp b/src/gdiplus/cdwemfp.cpp index 38b4200..23ae02d 100644 --- a/src/gdiplus/cdwemfp.cpp +++ b/src/gdiplus/cdwemfp.cpp @@ -58,7 +58,7 @@ static void cdcreatecanvas(cdCanvas* canvas, void* data) Rect frameRect(0, 0, (int)(100 * w / canvas->xres), (int)(100 * h / canvas->yres)); metafile = new Metafile(cdwpString2Unicode(filename, strlen(filename)), - ScreenDC, frameRect, MetafileFrameUnitGdi, EmfTypeEmfPlusDual, NULL); + ScreenDC, frameRect, MetafileFrameUnitGdi, EmfTypeEmfPlusDual, NULL); ReleaseDC(NULL, ScreenDC); } @@ -86,7 +86,6 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdEMFContext = { CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_FLUSH | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV), 1, cdcreatecanvas, diff --git a/src/gdiplus/cdwimgp.cpp b/src/gdiplus/cdwimgp.cpp index 697ff40..5dd8b96 100644 --- a/src/gdiplus/cdwimgp.cpp +++ b/src/gdiplus/cdwimgp.cpp @@ -48,8 +48,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdImageContext = { - CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ), 1, cdcreatecanvas, cdinittable, diff --git a/src/gdiplus/cdwinp.cpp b/src/gdiplus/cdwinp.cpp index a8d3f9c..5fbe2db 100644 --- a/src/gdiplus/cdwinp.cpp +++ b/src/gdiplus/cdwinp.cpp @@ -807,7 +807,7 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n) { case CD_PATH: { - int p, i, current_x = 0, current_y = 0; + int p, i, current_x = 0, current_y = 0, current_set = 0; GraphicsPath* graphics_path; PointF lastPoint; @@ -822,18 +822,22 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n) case CD_PATH_NEW: graphics_path->Reset(); graphics_path->SetFillMode(ctxcanvas->canvas->fill_mode==CD_EVENODD?FillModeAlternate:FillModeWinding); + current_set = 0; break; case CD_PATH_MOVETO: if (i+1 > n) break; current_x = poly[i].x; current_y = poly[i].y; + current_set = 1; i++; break; case CD_PATH_LINETO: if (i+1 > n) break; - graphics_path->AddLine(current_x, current_y, poly[i].x, poly[i].y); + if (current_set) + graphics_path->AddLine(current_x, current_y, poly[i].x, poly[i].y); current_x = poly[i].x; current_y = poly[i].y; + current_set = 1; i++; break; case CD_PATH_ARC: @@ -850,6 +854,24 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n) a1 = poly[i+2].x/1000.0, a2 = poly[i+2].y/1000.0; + if (current_set) + { + int StartX, StartY; + + if (ctxcanvas->canvas->invert_yaxis) + { + StartX = xc + cdRound(w * cos(CD_DEG2RAD * a1) / 2.0); + StartY = yc - cdRound(h * sin(CD_DEG2RAD * a1) / 2.0); + } + else + { + StartX = xc + cdRound(w * cos(CD_DEG2RAD * a2) / 2.0); + StartY = yc + cdRound(h * sin(CD_DEG2RAD * a2) / 2.0); + } + + graphics_path->AddLine(current_x, current_y, StartX, StartY); + } + Rect rect(xc - w/2, yc - h/2, w, h); if (a1 == 0 && a2 == 360) graphics_path->AddEllipse(rect); @@ -862,16 +884,23 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n) graphics_path->GetLastPoint(&lastPoint); current_x = (int)lastPoint.X; current_y = (int)lastPoint.Y; + current_set = 1; i += 3; } break; case CD_PATH_CURVETO: if (i+3 > n) break; + if (!current_set) + { + current_x = poly[i].x; + current_y = poly[i].y; + } graphics_path->AddBezier(current_x, current_y, poly[i].x, poly[i].y, poly[i+1].x, poly[i+1].y, poly[i+2].x, poly[i+2].y); graphics_path->GetLastPoint(&lastPoint); current_x = (int)lastPoint.X; current_y = (int)lastPoint.Y; + current_set = 1; i += 3; break; case CD_PATH_CLOSE: @@ -1011,7 +1040,7 @@ static void cdfpoly(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* poly, int n) { case CD_PATH: { - int p, i; + int p, i, current_set = 0; double current_x = 0, current_y = 0; GraphicsPath* graphics_path; PointF lastPoint; @@ -1027,18 +1056,22 @@ static void cdfpoly(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* poly, int n) case CD_PATH_NEW: graphics_path->Reset(); graphics_path->SetFillMode(ctxcanvas->canvas->fill_mode==CD_EVENODD?FillModeAlternate:FillModeWinding); + current_set = 0; break; case CD_PATH_MOVETO: if (i+1 > n) break; current_x = poly[i].x; current_y = poly[i].y; + current_set = 1; i++; break; case CD_PATH_LINETO: if (i+1 > n) break; - graphics_path->AddLine((REAL)current_x, (REAL)current_y, (REAL)poly[i].x, (REAL)poly[i].y); + if (current_set) + graphics_path->AddLine((REAL)current_x, (REAL)current_y, (REAL)poly[i].x, (REAL)poly[i].y); current_x = poly[i].x; current_y = poly[i].y; + current_set = 1; i++; break; case CD_PATH_ARC: @@ -1055,6 +1088,24 @@ static void cdfpoly(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* poly, int n) a1 = poly[i+2].x, a2 = poly[i+2].y; + if (current_set) + { + double StartX, StartY; + + if (ctxcanvas->canvas->invert_yaxis) + { + StartX = xc + w * cos(CD_DEG2RAD * a1) / 2.0; + StartY = yc - h * sin(CD_DEG2RAD * a1) / 2.0; + } + else + { + StartX = xc + w * cos(CD_DEG2RAD * a2) / 2.0; + StartY = yc + h * sin(CD_DEG2RAD * a2) / 2.0; + } + + graphics_path->AddLine((REAL)current_x, (REAL)current_y, (REAL)StartX, (REAL)StartY); + } + RectF rect((REAL)(xc - w/2.0), (REAL)(yc - h/2.0), (REAL)w, (REAL)h); if (a1 == 0 && a2 == 360) graphics_path->AddEllipse(rect); @@ -1067,16 +1118,23 @@ static void cdfpoly(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* poly, int n) graphics_path->GetLastPoint(&lastPoint); current_x = lastPoint.X; current_y = lastPoint.Y; + current_set = 1; i += 3; } break; case CD_PATH_CURVETO: if (i+3 > n) break; + if (!current_set) + { + current_x = poly[i].x; + current_y = poly[i].y; + } graphics_path->AddBezier((REAL)current_x, (REAL)current_y, (REAL)poly[i].x, (REAL)poly[i].y, (REAL)poly[i+1].x, (REAL)poly[i+1].y, (REAL)poly[i+2].x, (REAL)poly[i+2].y); graphics_path->GetLastPoint(&lastPoint); current_x = lastPoint.X; current_y = lastPoint.Y; + current_set = 1; i += 3; break; case CD_PATH_CLOSE: diff --git a/src/gdiplus/cdwnativep.cpp b/src/gdiplus/cdwnativep.cpp index fffd044..80209af 100644 --- a/src/gdiplus/cdwnativep.cpp +++ b/src/gdiplus/cdwnativep.cpp @@ -121,8 +121,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdNativeContext = { - CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ), 1, cdcreatecanvas, cdinittable, diff --git a/src/gdiplus/cdwprnp.cpp b/src/gdiplus/cdwprnp.cpp index 3d2b9f7..2eed9d9 100644 --- a/src/gdiplus/cdwprnp.cpp +++ b/src/gdiplus/cdwprnp.cpp @@ -140,7 +140,6 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdPrinterContext = { CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV), 1, cdcreatecanvas, |