mirror of https://github.com/fltk/fltk
Fix Fl_Scalable_Graphics_Driver::rect(x,y,w,h) (#1017)
This commit is contained in:
parent
467866b829
commit
3cc12d203f
|
@ -426,6 +426,7 @@ protected:
|
|||
virtual void point_unscaled(float x, float y);
|
||||
void rect(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void rectf(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
virtual void rect_unscaled(int x, int y, int w, int h);
|
||||
virtual void rectf_unscaled(int x, int y, int w, int h);
|
||||
void line(int x, int y, int x1, int y1) FL_OVERRIDE;
|
||||
virtual void line_unscaled(int x, int y, int x1, int y1);
|
||||
|
|
|
@ -751,10 +751,10 @@ Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver(
|
|||
void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h)
|
||||
{
|
||||
if (w > 0 && h > 0) {
|
||||
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);
|
||||
int s = (int)scale()/2;
|
||||
rect_unscaled(this->floor(x) + s, this->floor(y) + s,
|
||||
this->floor(x + w - 1) - this->floor(x),
|
||||
this->floor(y + h - 1) - this->floor(y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,6 +794,7 @@ void Fl_Scalable_Graphics_Driver::xyline(int x, int y, int x1) {
|
|||
} else {
|
||||
y = this->floor(y);
|
||||
if (line_width_ <= s_int) y += int(s/2.f);
|
||||
else y += s_int/2;
|
||||
xyline_unscaled(this->floor(xx), y, this->floor(xx1+1) - 1);
|
||||
}
|
||||
}
|
||||
|
@ -813,6 +814,7 @@ void Fl_Scalable_Graphics_Driver::yxline(int x, int y, int y1) {
|
|||
} else {
|
||||
x = this->floor(x);
|
||||
if (line_width_ <= s_int) x += int(s/2.f);
|
||||
else x += s_int/2;
|
||||
yxline_unscaled(x, this->floor(yy), this->floor(yy1+1) - 1);
|
||||
}
|
||||
}
|
||||
|
@ -1074,6 +1076,8 @@ Fl_Region Fl_Scalable_Graphics_Driver::scale_clip(float f) { return 0; }
|
|||
|
||||
void Fl_Scalable_Graphics_Driver::point_unscaled(float x, float y) {}
|
||||
|
||||
void Fl_Scalable_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {}
|
||||
|
||||
void Fl_Scalable_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {}
|
||||
|
||||
void Fl_Scalable_Graphics_Driver::line_unscaled(int x, int y, int x1, int y1) {}
|
||||
|
|
|
@ -109,6 +109,7 @@ protected:
|
|||
void fixloop() FL_OVERRIDE;
|
||||
void point(int x, int y) FL_OVERRIDE;
|
||||
void focus_rect(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
#if USE_COLORMAP
|
||||
void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE;
|
||||
|
|
|
@ -61,6 +61,14 @@ void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
|
|||
for (yy = h; yy > 0; yy--, i++) if (i & 1) SetPixel(gc_, x, y+yy, c);
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {
|
||||
MoveToEx(fl_gc, x, y, 0L);
|
||||
LineTo(fl_gc, x+w, y);
|
||||
LineTo(fl_gc, x+w, y+h);
|
||||
LineTo(fl_gc, x, y+h);
|
||||
LineTo(fl_gc, x, y);
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {
|
||||
RECT rect;
|
||||
rect.left = x; rect.top = y;
|
||||
|
|
|
@ -141,6 +141,7 @@ protected:
|
|||
void transformed_vertex0(float x, float y) FL_OVERRIDE;
|
||||
void fixloop() FL_OVERRIDE;
|
||||
void focus_rect(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
|
||||
void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE;
|
||||
void line_unscaled(int x, int y, int x1, int y1) FL_OVERRIDE;
|
||||
|
|
|
@ -227,6 +227,10 @@ void Fl_Xlib_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
|
|||
}
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {
|
||||
XDrawRectangle(fl_display, fl_window, gc_, x, y, w, h);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {
|
||||
x += floor(offset_x_);
|
||||
y += floor(offset_y_);
|
||||
|
|
Loading…
Reference in New Issue