summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-05-28 21:09:43 +0000
committerscuri <scuri>2010-05-28 21:09:43 +0000
commit3e4bae27558fd3bcec4bc54928b0a5d3145cd7c3 (patch)
treeef74219dd4e6b4e1e41036bdf495c1992de22fc8
parent82d2c9cac84e284e9e232b8f46db5e66e38a0d09 (diff)
*** empty log message ***
-rw-r--r--src/win32/cdwin.c5
-rw-r--r--test/simple/simple.c42
2 files changed, 37 insertions, 10 deletions
diff --git a/src/win32/cdwin.c b/src/win32/cdwin.c
index 65c183a..37c4c0d 100644
--- a/src/win32/cdwin.c
+++ b/src/win32/cdwin.c
@@ -854,6 +854,7 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n)
switch(ctxcanvas->canvas->path[p])
{
case CD_PATH_NEW:
+ EndPath(ctxcanvas->hDC);
BeginPath(ctxcanvas->hDC);
break;
case CD_PATH_MOVETO:
@@ -899,20 +900,24 @@ static void cdpoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n)
case CD_PATH_FILL:
sUpdateFill(ctxcanvas, 1);
SetPolyFillMode(ctxcanvas->hDC, ctxcanvas->canvas->fill_mode==CD_EVENODD?ALTERNATE:WINDING);
+ EndPath(ctxcanvas->hDC);
FillPath(ctxcanvas->hDC);
break;
case CD_PATH_STROKE:
sUpdateFill(ctxcanvas, 0);
+ EndPath(ctxcanvas->hDC);
StrokePath(ctxcanvas->hDC);
break;
case CD_PATH_FILLSTROKE:
sUpdateFill(ctxcanvas, 1);
sUpdateFill(ctxcanvas, 0);
SetPolyFillMode(ctxcanvas->hDC, ctxcanvas->canvas->fill_mode==CD_EVENODD?ALTERNATE:WINDING);
+ EndPath(ctxcanvas->hDC);
StrokeAndFillPath(ctxcanvas->hDC);
break;
case CD_PATH_CLIP:
SetPolyFillMode(ctxcanvas->hDC, ctxcanvas->canvas->fill_mode==CD_EVENODD?ALTERNATE:WINDING);
+ EndPath(ctxcanvas->hDC);
SelectClipPath(ctxcanvas->hDC, RGN_AND);
break;
}
diff --git a/test/simple/simple.c b/test/simple/simple.c
index 3207352..eb7acab 100644
--- a/test/simple/simple.c
+++ b/test/simple/simple.c
@@ -509,6 +509,7 @@ void SimpleDraw(void)
int SimpleDrawAll(void)
{
int w, h;
+ cdCanvas* canvas = cdActiveCanvas();
cdGetCanvasSize(&w, &h, 0, 0);
simple_draw = DRAW_ALL;
@@ -609,11 +610,11 @@ int SimpleDrawAll(void)
if (use_transform)
{
- cdCanvasTransform(cdActiveCanvas(), NULL);
- cdCanvasTransformTranslate(cdActiveCanvas(), w/2, h/2);
- cdCanvasTransformRotate(cdActiveCanvas(), 30);
- cdCanvasTransformScale(cdActiveCanvas(), 0.5, 0.5);
- cdCanvasTransformTranslate(cdActiveCanvas(), -w/2, -h/2);
+ cdCanvasTransform(canvas, NULL);
+ cdCanvasTransformTranslate(canvas, w/2, h/2);
+ cdCanvasTransformRotate(canvas, 30);
+ cdCanvasTransformScale(canvas, 0.5, 0.5);
+ cdCanvasTransformTranslate(canvas, -w/2, -h/2);
}
// cdSetfAttribute("ROTATE", "15 %d %d", w/2, h/2);
@@ -699,6 +700,27 @@ int SimpleDrawAll(void)
cdEnd();
}
+ cdForeground(CD_GREEN);
+ cdBegin(CD_PATH);
+ cdCanvasPathSet(canvas, CD_PATH_MOVETO);
+ cdVertex(w/2 + 200, h/2);
+ cdCanvasPathSet(canvas, CD_PATH_LINETO);
+ cdVertex(w/2 + 250, h/2 + 50);
+ cdCanvasPathSet(canvas, CD_PATH_CURVETO);
+ cdVertex(w/2+150+150, h/2+200-50);
+ cdVertex(w/2+150+180, h/2+250-50);
+ cdVertex(w/2+150+180, h/2+200-50);
+ cdCanvasPathSet(canvas, CD_PATH_CURVETO);
+ cdVertex(w/2+150+180, h/2+150-50);
+ cdVertex(w/2+150+150, h/2+100-50);
+ cdVertex(w/2+150+300, h/2+100-50);
+ cdCanvasPathSet(canvas, CD_PATH_CLOSE);
+// cdCanvasPathSet(canvas, CD_PATH_STROKE);
+ cdCanvasPathSet(canvas, CD_PATH_FILL);
+// cdCanvasPathSet(canvas, CD_PATH_FILLSTROKE);
+ cdEnd();
+
+
cdPixel(10, h/2+0, CD_RED);
cdPixel(11, h/2+1, CD_GREEN);
cdPixel(12, h/2+2, CD_BLUE);
@@ -835,7 +857,7 @@ int SimpleDrawAll(void)
cdSetAttribute("ROTATE", NULL);
if (use_transform)
- cdCanvasTransform(cdActiveCanvas(), NULL);
+ cdCanvasTransform(canvas, NULL);
cdClip(CD_CLIPOFF);
cdFlush();
@@ -1101,8 +1123,8 @@ int SimpleDrawTextFonts(void)
return 0;
}
-//void SimpleDrawTest(void)
-void SimpleDrawMainTest(void)
+void SimpleDrawTest(void)
+//void SimpleDrawMainTest(void)
{
long pattern[16]; /* 4x4 pattern */
int w, h;
@@ -1326,8 +1348,8 @@ void SimpleDrawVectorFont(void)
cdFlush();
}
-void SimpleDrawTest(void)
-//void SimpleDrawPoly(void)
+//void SimpleDrawTest(void)
+void SimpleDrawPoly(void)
{
int w, h;
cdGetCanvasSize(&w, &h, 0, 0);