summaryrefslogtreecommitdiff
path: root/src/drivers/Android/Fl_Android_Graphics_Driver.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-03-18 20:04:43 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-03-18 20:04:43 +0000
commitc3573d16f3cfe6ea63229b3edeba197314b5f043 (patch)
tree48909154449da3af0ab55ee7c8beac016be2f067 /src/drivers/Android/Fl_Android_Graphics_Driver.cxx
parent6dbe7ca8ed9791deb1b7d77efe153e20212cf3f2 (diff)
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
Diffstat (limited to 'src/drivers/Android/Fl_Android_Graphics_Driver.cxx')
-rw-r--r--src/drivers/Android/Fl_Android_Graphics_Driver.cxx51
1 files changed, 47 insertions, 4 deletions
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