diff --git a/uppdev/Glyph/DDA.cpp b/uppdev/Glyph/DDA.cpp index d50762c53..655788b83 100644 --- a/uppdev/Glyph/DDA.cpp +++ b/uppdev/Glyph/DDA.cpp @@ -86,8 +86,7 @@ struct MiniRenderer::Segments : MiniRenderer { Vector< Vector< Segment > > segment; - static void Join(Segment& m, int x, int cx) - { + static void Join(Segment& m, int x, int cx) { DLOG("-- JOIN"); DDUMP(m.x); DDUMP(m.cx); @@ -98,6 +97,13 @@ struct MiniRenderer::Segments : MiniRenderer { DDUMP(m.x); DDUMP(m.cx); } + + void JoinLast() { + if(!IsNull(first) && prev.y == first.y) { + Join(segment[first.y][first.x], segment[prev.y].Top().x, segment[prev.y].Top().cx); + segment[prev.y].Drop(); + } + } virtual void PutHorz(int x, int y, int cx) { DLOG("PutHorz x: " << x << ", y: " << y << ", cx: " << cx); @@ -121,7 +127,6 @@ struct MiniRenderer::Segments : MiniRenderer { } } virtual void PutVert(int x, int y, int cy) { - DDUMP(diry); if(diry > 0) for(int i = 0; i < cy; i++) PutHorz(x, y + i, 1); @@ -135,7 +140,6 @@ struct MiniRenderer::Segments : MiniRenderer { void MiniRenderer::Move(Point p) { - DLOG("*** Move " << p); if(pseg) Close(); else @@ -146,7 +150,6 @@ void MiniRenderer::Move(Point p) void MiniRenderer::Line(Point p) { - DLOG("*** Line " << p); if(!pseg) Move(Point(0, 0)); pseg->Line(p1, p); @@ -160,7 +163,7 @@ void MiniRenderer::Close() Move(Point(0, 0)); if(p1 != p0) Line(p0); - // Todo: JOIN + pseg->JoinLast(); } void MiniRenderer::Render() @@ -175,6 +178,8 @@ void MiniRenderer::Render() while(i < gg.GetCount()) { if(i + 1 < gg.GetCount()) PutHorz(gg[i].x, y, gg[i + 1].x + gg[i + 1].cx - gg[i].x); + else + PutHorz(gg[i].x, y, gg[i].cx); i += 2; } } diff --git a/uppdev/Glyph/glyph.iml b/uppdev/Glyph/glyph.iml index cc98384c1..e91c9e43f 100644 --- a/uppdev/Glyph/glyph.iml +++ b/uppdev/Glyph/glyph.iml @@ -1,4 +1,5 @@ PREMULTIPLIED +IMAGE_ID(cursor1) IMAGE_ID(cursor) IMAGE_ID(circle2) IMAGE_ID(circle3) @@ -6,7 +7,8 @@ IMAGE_ID(circle4) IMAGE_ID(circle5) IMAGE_BEGIN_DATA -IMAGE_DATA(120,156,99,16,96,16,96,96,6,66,116,112,224,192,129,255,24,130,36,0,74,245,147,107,39,186,189,216,196,232,229,150) -IMAGE_DATA(129,212,63,10,70,1,201,128,9,8,145,192,127,20,140,165,148,248,143,69,33,66,156,5,8,177,104,192,166,9,27,70) -IMAGE_DATA(85,207,10,132,88,0,122,30,193,101,0,62,113,172,230,1,0,36,207,60,25,0,0,0,0,0,0,0,0,0,0,0) -IMAGE_END_DATA(96, 5) +IMAGE_DATA(120,156,99,16,96,16,96,96,6,194,225,6,254,255,63,240,127,160,221,48,10,70,193,144,2,184,10,131,3,7,40,203) +IMAGE_DATA(76,148,234,39,215,78,116,123,177,137,209,203,45,3,169,127,20,140,2,146,1,19,16,34,129,255,40,24,75,41,241,31) +IMAGE_DATA(139,66,132,56,11,16,98,209,128,77,19,54,140,170,158,21,8,177,0,244,60,130,203,0,124,226,88,205,3,0,136,89) +IMAGE_DATA(63,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(128, 6) diff --git a/uppdev/Glyph/main.cpp b/uppdev/Glyph/main.cpp index 83b32d1ad..39a93f72c 100644 --- a/uppdev/Glyph/main.cpp +++ b/uppdev/Glyph/main.cpp @@ -135,7 +135,7 @@ struct MyApp : TopWindow { Image MyApp::CursorImage(Point p, dword keyflags) { - return GlyphImg::cursor(); + return GlyphImg::cursor1(); } void MyApp::MouseMove(Point p_, dword keyflags) @@ -231,7 +231,7 @@ void MyApp::Paint(Draw& w) r.draw = &w; r.color = Black(); - +#if 0 DLOG("########## Ellipse"); r.Ellipse(p0, p - p0/*Size(100, 100)*/); r.Render(); @@ -247,16 +247,21 @@ void MyApp::Paint(Draw& w) } r.color = Green(); +#endif r.Move(p0); r.Line(p); r.Line(Point(700, 400)); r.Render(); + + w.DrawRect(p.x, p.y, 1, 1, White()); + w.DrawRect(700, 400, 1, 1, White()); + - w.DrawLine(p0, p, 0, LtGray()); +// w.DrawLine(p0, p, 0, LtGray()); w.DrawRect(p0.x - 1, p0.y - 1, 3, 3, LtGray()); r.color = LtBlue(); - r.Line(p0, p); +// r.Line(p0, p); // DrawLine(w, p0, p);