From c3573d16f3cfe6ea63229b3edeba197314b5f043 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 18 Mar 2018 20:04:43 +0000 Subject: Android: Implemented font changing ( Fl::set_font(ix, name); ) and other font stuff. Fixed horizontal and vertical line drawing to include last pixel. Added stippling to focus rect. Added point drawing (slooow). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Android/Fl_Android_Graphics_Driver.cxx | 51 ++++++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'src/drivers/Android/Fl_Android_Graphics_Driver.cxx') diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx index fac5220bf..71ffa6224 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx @@ -142,15 +142,24 @@ void Fl_Android_Graphics_Driver::xyline_unscaled(float x, float y, float x1) void Fl_Android_Graphics_Driver::xyline_unclipped(float x, float y, float x1) { uint16_t cc = make565(color()); - float w = x1-x; + float w; + if (x1>x) { + w = x1-x+1; + } else { + w = x-x1+1; + x = x1; + } + int32_t sx = 1; int32_t ss = pStride; uint16_t *bits = pBits; uint32_t xx = (uint32_t)x; uint32_t yy = (uint32_t)y; uint32_t ww = (uint32_t)w; uint16_t *d = bits + yy*ss + xx; + if ((pLineStyle&0xff)==FL_DOT) { ww = ww/2; sx = sx*2; } for (uint32_t ix = ww; ix>0; --ix) { - *d++ = cc; + *d = cc; + d+=sx; } } @@ -158,9 +167,9 @@ void Fl_Android_Graphics_Driver::yxline_unscaled(float x, float y, float y1) { float h; if (y1>y) { - h = y1-y; + h = y1-y+1; } else { - h = y-y1; + h = y-y1+1; y = y1; } for (const auto &it: pClippingRegion.overlapping(Fl_Rect_Region(x, y, 1, h))) { @@ -179,6 +188,7 @@ void Fl_Android_Graphics_Driver::yxline_unclipped(float x, float y, float y1) uint32_t yy = (uint32_t)y; uint32_t hh = (uint32_t)h; uint16_t *d = bits + yy*ss + xx; + if ((pLineStyle&0xff)==FL_DOT) { hh = hh/2; ss = ss*2; } for (uint32_t iy = hh; iy>0; --iy) { *d = cc; d += ss; @@ -186,6 +196,39 @@ void Fl_Android_Graphics_Driver::yxline_unclipped(float x, float y, float y1) } +void Fl_Android_Graphics_Driver::rect_unscaled(float x, float y, float w, float h) +{ + xyline(x, y, x+w-1); + yxline(x, y, y+h-1); + yxline(x+w-1, y, y+h-1); + xyline(x, y+h-1, x+w-1); +} + + +void Fl_Android_Graphics_Driver::line_style_unscaled(int style, float width, char* dashes) +{ + pLineStyle = style; + // TODO: finish this! +} + + +void Fl_Android_Graphics_Driver::point_unscaled(float x, float y) +{ + // drawing a single point is insanely inefficient because we need to walk the + // entire clipping region every time to see if the point needs to be drawn. + for (const auto &it: pClippingRegion.overlapping(Fl_Rect_Region(x, y, 1, 1))) { + Fl_Rect_Region &s = it->clipped_rect(); + uint16_t cc = make565(color()); + int32_t ss = pStride; + uint16_t *bits = pBits; + uint32_t xx = (uint32_t)x; + uint32_t yy = (uint32_t)y; + uint16_t *d = bits + yy*ss + xx; + *d = cc; + } + +} + #if 0 -- cgit v1.2.3