diff options
Diffstat (limited to 'src/drivers/GDI')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 23 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.h | 3 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx | 18 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx | 33 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx | 97 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 65 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 92 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx | 18 |
9 files changed, 187 insertions, 164 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index 3bc9fedbe..74cd6a69d 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -27,6 +27,17 @@ const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver"; // FIXME: move to printer graphics driver const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver"; +/* Reference to the current device context + For back-compatibility only. The preferred procedure to get this reference is + Fl_Surface_Device::surface()->driver()->get_gc(). + */ +HDC fl_gc = 0; + +void Fl_Graphics_Driver::global_gc() +{ + fl_gc = (HDC)get_gc(); +} + /* * By linking this module, the following static method will instatiate the * MSWindows GDI Graphics driver as the main display driver. @@ -87,7 +98,7 @@ char Fl_GDI_Graphics_Driver::can_do_alpha_blending() { } HDC fl_makeDC(HBITMAP bitmap) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC((HDC)fl_graphics_driver->get_gc()); SetTextAlign(new_gc, TA_BASELINE|TA_LEFT); SetBkMode(new_gc, TRANSPARENT); #if USE_COLORMAP @@ -98,26 +109,26 @@ HDC fl_makeDC(HBITMAP bitmap) { } void Fl_GDI_Graphics_Driver::copy_offscreen(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC(gc); int save = SaveDC(new_gc); SelectObject(new_gc, bitmap); - BitBlt(fl_gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); + BitBlt(gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); RestoreDC(new_gc, save); DeleteDC(new_gc); } void Fl_GDI_Graphics_Driver::copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC(gc); int save = SaveDC(new_gc); SelectObject(new_gc, bitmap); BOOL alpha_ok = 0; // first try to alpha blend if ( can_do_alpha_blending() ) { - alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc); + alpha_ok = fl_alpha_blend(gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc); } // if that failed (it shouldn't), still copy the bitmap over, but now alpha is 1 if (!alpha_ok) { - BitBlt(fl_gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); + BitBlt(gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); } RestoreDC(new_gc, save); DeleteDC(new_gc); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h index 2dbdbe430..722c7410a 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h @@ -35,6 +35,7 @@ */ class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver { protected: + HDC gc; int numcount; int counts[20]; public: @@ -42,6 +43,8 @@ public: const char *class_name() {return class_id;}; virtual int has_feature(driver_feature mask) { return mask & NATIVE; } char can_do_alpha_blending(); + virtual void set_gc(void *ctxt) {gc = (HDC)ctxt;} + virtual void *get_gc() {return gc;} // --- bitmap stuff Fl_Bitmask create_bitmask(int w, int h, const uchar *array); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx index 976c6f5c3..de8729d74 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx @@ -41,9 +41,9 @@ void Fl_GDI_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) { int xb = x+w/2+int(w*cos(a2/180.0*M_PI)); int yb = y+h/2-int(h*sin(a2/180.0*M_PI)); if (fabs(a1 - a2) < 90) { - if (xa == xb && ya == yb) SetPixel(fl_gc, xa, ya, fl_RGB()); - else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); - } else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); + if (xa == xb && ya == yb) SetPixel(gc, xa, ya, fl_RGB()); + else Arc(gc, x, y, x+w, y+h, xa, ya, xb, yb); + } else Arc(gc, x, y, x+w, y+h, xa, ya, xb, yb); } void Fl_GDI_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) { @@ -53,14 +53,14 @@ void Fl_GDI_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) { int ya = y+h/2-int(h*sin(a1/180.0*M_PI)); int xb = x+w/2+int(w*cos(a2/180.0*M_PI)); int yb = y+h/2-int(h*sin(a2/180.0*M_PI)); - SelectObject(fl_gc, fl_brush()); + SelectObject(gc, fl_brush()); if (fabs(a1 - a2) < 90) { if (xa == xb && ya == yb) { - MoveToEx(fl_gc, x+w/2, y+h/2, 0L); - LineTo(fl_gc, xa, ya); - SetPixel(fl_gc, xa, ya, fl_RGB()); - } else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); - } else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); + MoveToEx(gc, x+w/2, y+h/2, 0L); + LineTo(gc, xa, ya); + SetPixel(gc, xa, ya, fl_RGB()); + } else Pie(gc, x, y, x+w, y+h, xa, ya, xb, yb); + } else Pie(gc, x, y, x+w, y+h, xa, ya, xb, yb); } #endif // FL_CFG_GFX_GDI_ARCI_CXX diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx index ab7bf9332..8216d14ca 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx @@ -53,11 +53,11 @@ void fl_cleanup_pens(void) { void fl_save_pen(void) { if(!tmppen) tmppen = CreatePen(PS_SOLID, 1, 0); - savepen = (HPEN)SelectObject(fl_gc, tmppen); + savepen = (HPEN)SelectObject((HDC)fl_graphics_driver->get_gc(), tmppen); } void fl_restore_pen(void) { - if (savepen) SelectObject(fl_gc, savepen); + if (savepen) SelectObject((HDC)fl_graphics_driver->get_gc(), savepen); DeleteObject(tmppen); tmppen = 0; savepen = 0; @@ -65,9 +65,10 @@ void fl_restore_pen(void) { static void clear_xmap(Fl_XMap& xmap) { if (xmap.pen) { + HDC gc = (HDC)fl_graphics_driver->get_gc(); HGDIOBJ tmppen = GetStockObject(BLACK_PEN); - HGDIOBJ oldpen = SelectObject(fl_gc, tmppen); // Push out the current pen of the gc - if(oldpen != xmap.pen) SelectObject(fl_gc, oldpen); // Put it back if it is not the one we are about to delete + HGDIOBJ oldpen = SelectObject(gc, tmppen); // Push out the current pen of the gc + if(oldpen != xmap.pen) SelectObject(gc, oldpen); // Put it back if it is not the one we are about to delete DeleteObject((HGDIOBJ)(xmap.pen)); xmap.pen = 0; xmap.brush = -1; @@ -77,8 +78,9 @@ static void clear_xmap(Fl_XMap& xmap) { static void set_xmap(Fl_XMap& xmap, COLORREF c) { xmap.rgb = c; if (xmap.pen) { - HGDIOBJ oldpen = SelectObject(fl_gc,GetStockObject(BLACK_PEN)); // replace current pen with safe one - if (oldpen != xmap.pen)SelectObject(fl_gc,oldpen); // if old one not xmap.pen, need to put it back + HDC gc = (HDC)fl_graphics_driver->get_gc(); + HGDIOBJ oldpen = SelectObject(gc,GetStockObject(BLACK_PEN)); // replace current pen with safe one + if (oldpen != xmap.pen)SelectObject(gc,oldpen); // if old one not xmap.pen, need to put it back DeleteObject(xmap.pen); // delete pen } xmap.pen = CreatePen(PS_SOLID, 1, xmap.rgb); // get a pen into xmap.pen @@ -105,7 +107,7 @@ void Fl_GDI_Graphics_Driver::color(Fl_Color i) { #endif } fl_current_xmap = ⟼ - SelectObject(fl_gc, (HGDIOBJ)(xmap.pen)); + SelectObject(gc, (HGDIOBJ)(xmap.pen)); } } @@ -118,7 +120,7 @@ void Fl_GDI_Graphics_Driver::color(uchar r, uchar g, uchar b) { set_xmap(xmap, c); } fl_current_xmap = ⟼ - SelectObject(fl_gc, (HGDIOBJ)(xmap.pen)); + SelectObject(gc, (HGDIOBJ)(xmap.pen)); } HBRUSH fl_brush() { @@ -127,6 +129,7 @@ HBRUSH fl_brush() { HBRUSH fl_brush_action(int action) { Fl_XMap *xmap = fl_current_xmap; + HDC gc = (HDC)fl_graphics_driver->get_gc(); // Wonko: we use some statistics to cache only a limited number // of brushes: #define FL_N_BRUSH 16 @@ -137,7 +140,7 @@ HBRUSH fl_brush_action(int action) { } brushes[FL_N_BRUSH]; if (action) { - SelectObject(fl_gc, GetStockObject(BLACK_BRUSH)); // Load stock object + SelectObject(gc, GetStockObject(BLACK_BRUSH)); // Load stock object for (int i=0; i<FL_N_BRUSH; i++) { if (brushes[i].brush) DeleteObject(brushes[i].brush); // delete all brushes in array @@ -168,8 +171,8 @@ HBRUSH fl_brush_action(int action) { } i = imin; HGDIOBJ tmpbrush = GetStockObject(BLACK_BRUSH); // get a stock brush - HGDIOBJ oldbrush = SelectObject(fl_gc,tmpbrush); // load in into current context - if (oldbrush != brushes[i].brush) SelectObject(fl_gc,oldbrush); // reload old one + HGDIOBJ oldbrush = SelectObject(gc,tmpbrush); // load in into current context + if (oldbrush != brushes[i].brush) SelectObject(gc,oldbrush); // reload old one DeleteObject(brushes[i].brush); // delete the one in list brushes[i].brush = NULL; brushes[i].backref->brush = -1; @@ -203,11 +206,11 @@ HPALETTE fl_select_palette(void) { static char beenhere; + HDC gc = (HDC)fl_graphics_driver->get_gc(); if (!beenhere) { beenhere = 1; - //if (GetDeviceCaps(fl_gc, BITSPIXEL) > 8) return NULL; - int nColors = GetDeviceCaps(fl_gc, SIZEPALETTE); + int nColors = GetDeviceCaps(gc, SIZEPALETTE); if (nColors <= 0 || nColors > 256) return NULL; // this will try to work on < 256 color screens, but will probably // come out quite badly. @@ -232,8 +235,8 @@ fl_select_palette(void) fl_palette = CreatePalette(pPal); } if (fl_palette) { - SelectPalette(fl_gc, fl_palette, FALSE); - RealizePalette(fl_gc); + SelectPalette(gc, fl_palette, FALSE); + RealizePalette(gc); } return fl_palette; } diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx index 07d9fbdba..e31f38234 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx @@ -113,10 +113,11 @@ enumcbw(CONST LOGFONTW *lpelf, } /* enumcbw */ Fl_Font Fl::set_fonts(const char* xstarname) { + HDC gc = (HDC)fl_graphics_driver->get_gc(); if (fl_free_font == FL_FREE_FONT) {// if not already been called - if (!fl_gc) fl_GetDC(0); + if (!gc) gc = fl_GetDC(0); - EnumFontFamiliesW(fl_gc, NULL, (FONTENUMPROCW)enumcbw, xstarname != 0); + EnumFontFamiliesW(gc, NULL, (FONTENUMPROCW)enumcbw, xstarname != 0); } return (Fl_Font)fl_free_font; @@ -168,8 +169,9 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { Fl_Fontdesc *s = fl_fonts+fnum; if (!s->name) s = fl_fonts; // empty slot in table, use entry 0 - if (!fl_gc) fl_GetDC(0); - cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY); + HDC gc = (HDC)fl_graphics_driver->get_gc(); + if (!gc) gc = fl_GetDC(0); + cyPerInch = GetDeviceCaps(gc, LOGPIXELSY); if (cyPerInch < 1) cyPerInch = 1; // int l = fl_utf_nb_char((unsigned char*)s->name+1, strlen(s->name+1)); @@ -181,7 +183,7 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short)); l = fl_utf8toUtf16(nm, (unsigned) len, b, (l+1)); // Now do the conversion b[l] = 0; - EnumFontFamiliesW(fl_gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0); + EnumFontFamiliesW(gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0); free(b); sizep = sizes; @@ -242,9 +244,10 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize fsize) { name // pointer to typeface name string ); angle = fl_angle_; - if (!fl_gc) fl_GetDC(0); - SelectObject(fl_gc, fid); - GetTextMetrics(fl_gc, &metr); + HDC gc = (HDC)fl_graphics_driver->get_gc(); + if (!gc) gc = fl_GetDC(0); + SelectObject(gc, fid); + GetTextMetrics(gc, &metr); // BOOL ret = GetCharWidthFloat(fl_gc, metr.tmFirstChar, metr.tmLastChar, font->width+metr.tmFirstChar); // ...would be the right call, but is not implemented into Window95! (WinNT?) //GetCharWidth(fl_gc, 0, 255, width); @@ -380,7 +383,7 @@ double Fl_GDI_Graphics_Driver::width(unsigned int c) { // This code assumes that these glyphs are rarely used and simply // measures them explicitly if they occur - This will be slow... if(c > 0x0000FFFF) { // UTF16 surrogate pair is needed - if (!fl_gc) { // We have no valid gc, so nothing to measure - bail out + if (!gc) { // We have no valid gc, so nothing to measure - bail out return 0.0; } int cc; // cell count @@ -388,9 +391,9 @@ double Fl_GDI_Graphics_Driver::width(unsigned int c) { // Creates a UTF16 string from a UCS code point. cc = fl_ucs_to_Utf16(c, u16, 4); // Make sure the current font is selected before we make the measurement - SelectObject(fl_gc, fl_fontsize->fid); + SelectObject(gc, fl_fontsize->fid); // measure the glyph width - GetTextExtentPoint32W(fl_gc, (WCHAR*)u16, cc, &s); + GetTextExtentPoint32W(gc, (WCHAR*)u16, cc, &s); return (double)s.cx; } // else - this falls through to the lookup-table for glyph widths @@ -411,19 +414,19 @@ double Fl_GDI_Graphics_Driver::width(unsigned int c) { // If that is null then we attempt to obtain the gc from the current screen // using (GetDC(NULL)). // This should resolve STR #2086 - HDC gc = fl_gc; + HDC gc2 = gc; HWND hWnd = 0; - if (!gc) { // We have no valid gc, try and obtain one + if (!gc2) { // We have no valid gc, try and obtain one // Use our first fltk window, or fallback to using the screen via GetDC(NULL) hWnd = Fl::first_window() ? fl_xid(Fl::first_window()) : NULL; - gc = GetDC(hWnd); + gc2 = GetDC(hWnd); } - if (!gc) Fl::fatal("Invalid graphic context: fl_width() failed because no valid HDC was found!"); - SelectObject(gc, fl_fontsize->fid); + if (!gc2) Fl::fatal("Invalid graphic context: fl_width() failed because no valid HDC was found!"); + SelectObject(gc2, fl_fontsize->fid); ii += c &0x03FF; - GetTextExtentPoint32W(gc, (WCHAR*)&ii, 1, &s); + GetTextExtentPoint32W(gc2, (WCHAR*)&ii, 1, &s); fl_fontsize->width[r][c&0x03FF] = s.cx; - if (gc && gc!=fl_gc) ReleaseDC(hWnd, gc); + if (gc2 && gc2 != gc) ReleaseDC(hWnd, gc2); return (double) fl_fontsize->width[r][c & 0x03FF]; } @@ -447,11 +450,11 @@ static void GetGlyphIndices_init() { have_loaded_GetGlyphIndices = -1; // set this non-zero when we have attempted to load GetGlyphIndicesW } // GetGlyphIndices_init function -static void on_printer_extents_update(int &dx, int &dy, int &w, int &h) +static void on_printer_extents_update(int &dx, int &dy, int &w, int &h, HDC gc) // converts text extents from device coords to logical coords { POINT pt[3] = { {0, 0}, {dx, dy}, {dx+w, dy+h} }; - DPtoLP(fl_gc, pt, 3); + DPtoLP(gc, pt, 3); w = pt[2].x - pt[1].x; h = pt[2].y - pt[1].y; dx = pt[1].x - pt[0].x; @@ -459,8 +462,10 @@ static void on_printer_extents_update(int &dx, int &dy, int &w, int &h) } // if printer context, extents shd be converted to logical coords -#define EXTENTS_UPDATE(x,y,w,h) \ - if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { on_printer_extents_update(x,y,w,h); } +#define EXTENTS_UPDATE(x,y,w,h,gc) \ + if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { \ + on_printer_extents_update(x,y,w,h,gc); \ + } // Function to determine the extent of the "inked" area of the glyphs in a string void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) { @@ -481,7 +486,7 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy int minx = 0, miny = -999999; unsigned len = 0, idx = 0; HWND hWnd = 0; - HDC gc = fl_gc; // local copy of current gc - make a copy in case we change it... + HDC gc2 = gc; // local copy of current gc - make a copy in case we change it... int has_surrogates; // will be set if the string contains surrogate pairs // Have we loaded the GetGlyphIndicesW function yet? @@ -493,12 +498,12 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy // The following code makes a best effort attempt to obtain a valid fl_gc. // See description in fl_width() above for an explanation. - if (!gc) { // We have no valid gc, try and obtain one + if (!gc2) { // We have no valid gc, try and obtain one // Use our first fltk window, or fallback to using the screen via GetDC(NULL) hWnd = Fl::first_window() ? fl_xid(Fl::first_window()) : NULL; - gc = GetDC(hWnd); + gc2 = GetDC(hWnd); } - if (!gc) goto exit_error; // no valid gc, attempt to use fallback measure + if (!gc2) goto exit_error; // no valid gc, attempt to use fallback measure // now convert the string to WCHAR and measure it len = fl_utf8toUtf16(c, n, ext_buff, wc_len); @@ -510,7 +515,7 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy w_buff = new WORD[wc_len]; len = fl_utf8toUtf16(c, n, ext_buff, wc_len); } - SelectObject(gc, fl_fontsize->fid); + SelectObject(gc2, fl_fontsize->fid); // Are there surrogate-pairs in this string? If so GetGlyphIndicesW will fail // since it can only handle the BMP range. @@ -533,7 +538,7 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy gcp_res.nGlyphs = wc_len; gcp_res.lStructSize = sizeof(gcp_res); - DWORD dr = GetCharacterPlacementW(gc, (WCHAR*)ext_buff, len, 0, &gcp_res, GCP_GLYPHSHAPE); + DWORD dr = GetCharacterPlacementW(gc2, (WCHAR*)ext_buff, len, 0, &gcp_res, GCP_GLYPHSHAPE); if(dr) { len = gcp_res.nGlyphs; } else goto exit_error; @@ -546,7 +551,7 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy // now we have the glyph array we measure each glyph in turn... for(idx = 0; idx < len; idx++){ - if (GetGlyphOutlineW (gc, w_buff[idx], GGO_METRICS | GGO_GLYPH_INDEX, + if (GetGlyphOutlineW (gc2, w_buff[idx], GGO_METRICS | GGO_GLYPH_INDEX, &metrics, 0, NULL, &matrix) == GDI_ERROR) { goto exit_error; } @@ -562,7 +567,7 @@ void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy h = maxh + miny; dx = minx; dy = -miny; - EXTENTS_UPDATE(dx, dy, w, h); + EXTENTS_UPDATE(dx, dy, w, h, gc); return; // normal exit exit_error: @@ -571,38 +576,38 @@ exit_error: h = height(); dx = 0; dy = descent() - h; - EXTENTS_UPDATE(dx, dy, w, h); + EXTENTS_UPDATE(dx, dy, w, h, gc); return; } // fl_text_extents void Fl_GDI_Graphics_Driver::draw(const char* str, int n, int x, int y) { - COLORREF oldColor = SetTextColor(fl_gc, fl_RGB()); + COLORREF oldColor = SetTextColor(gc, fl_RGB()); // avoid crash if no font has been set yet if (!font_descriptor()) this->font(FL_HELVETICA, FL_NORMAL_SIZE); - SelectObject(fl_gc, font_descriptor()->fid); + SelectObject(gc, font_descriptor()->fid); int wn = fl_utf8toUtf16(str, n, wstr, wstr_len); if(wn >= wstr_len) { wstr = (unsigned short*) realloc(wstr, sizeof(unsigned short) * (wn + 1)); wstr_len = wn + 1; wn = fl_utf8toUtf16(str, n, wstr, wstr_len); } - TextOutW(fl_gc, x, y, (WCHAR*)wstr, wn); - SetTextColor(fl_gc, oldColor); // restore initial state + TextOutW(gc, x, y, (WCHAR*)wstr, wn); + SetTextColor(gc, oldColor); // restore initial state } void Fl_GDI_Graphics_Driver::draw(int angle, const char* str, int n, int x, int y) { fl_font(this, Fl_Graphics_Driver::font(), size(), angle); int wn = 0; // count of UTF16 cells to render full string - COLORREF oldColor = SetTextColor(fl_gc, fl_RGB()); - SelectObject(fl_gc, font_descriptor()->fid); + COLORREF oldColor = SetTextColor(gc, fl_RGB()); + SelectObject(gc, font_descriptor()->fid); wn = fl_utf8toUtf16(str, n, wstr, wstr_len); if(wn >= wstr_len) { // Array too small wstr = (unsigned short*) realloc(wstr, sizeof(unsigned short) * (wn + 1)); wstr_len = wn + 1; wn = fl_utf8toUtf16(str, n, wstr, wstr_len); // respin the translation } - TextOutW(fl_gc, x, y, (WCHAR*)wstr, wn); - SetTextColor(fl_gc, oldColor); + TextOutW(gc, x, y, (WCHAR*)wstr, wn); + SetTextColor(gc, oldColor); fl_font(this, Fl_Graphics_Driver::font(), size(), 0); } @@ -615,26 +620,26 @@ void Fl_GDI_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) { wn = fl_utf8toUtf16(c, n, wstr, wstr_len); } - COLORREF oldColor = SetTextColor(fl_gc, fl_RGB()); - SelectObject(fl_gc, font_descriptor()->fid); + COLORREF oldColor = SetTextColor(gc, fl_RGB()); + SelectObject(gc, font_descriptor()->fid); #ifdef RTL_CHAR_BY_CHAR int i = 0; int lx = 0; while (i < wn) { // output char by char is very bad for Arabic but coherent with fl_width() lx = (int) width(wstr[i]); x -= lx; - TextOutW(fl_gc, x, y, (WCHAR*)wstr + i, 1); + TextOutW(gc, x, y, (WCHAR*)wstr + i, 1); if (fl_nonspacing(wstr[i])) { x += lx; } i++; } #else - UINT old_align = SetTextAlign(fl_gc, TA_RIGHT | TA_RTLREADING); - TextOutW(fl_gc, x, y - height() + descent(), (WCHAR*)wstr, wn); - SetTextAlign(fl_gc, old_align); + UINT old_align = SetTextAlign(gc, TA_RIGHT | TA_RTLREADING); + TextOutW(gc, x, y - height() + descent(), (WCHAR*)wstr, wn); + SetTextAlign(gc, old_align); #endif - SetTextColor(fl_gc, oldColor); + SetTextColor(gc, oldColor); } #endif // diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index eecb07fd7..3a128b69f 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -108,7 +108,7 @@ static void monodither(uchar* to, const uchar* from, int w, int delta) { static void innards(const uchar *buf, int X, int Y, int W, int H, int delta, int linedelta, int depth, - Fl_Draw_Image_Cb cb, void* userdata) + Fl_Draw_Image_Cb cb, void* userdata, HDC gc) { char indexed = 0; @@ -254,7 +254,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { // if print context, device and logical units are not equal, so SetDIBitsToDevice // does not do the expected job, whereas StretchDIBits does it. - StretchDIBits(fl_gc, x, y+j-k, w, k, 0, 0, w, k, + StretchDIBits(gc, x, y+j-k, w, k, 0, 0, w, k, (LPSTR)((uchar*)buffer+(blocking-k)*linesize), &bmi, #if USE_COLORMAP @@ -268,7 +268,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, buffer_size = 0; } else { - SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k, + SetDIBitsToDevice(gc, x, y+j-k, w, k, 0, 0, 0, k, (LPSTR)((uchar*)buffer+(blocking-k)*linesize), &bmi, #if USE_COLORMAP @@ -286,9 +286,9 @@ static int fl_abs(int v) { return v<0 ? -v : v; } void Fl_GDI_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){ if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) { d ^= FL_IMAGE_WITH_ALPHA; - innards(buf,x,y,w,h,d,l,fl_abs(d),0,0); + innards(buf,x,y,w,h,d,l,fl_abs(d),0,0, gc); } else { - innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0); + innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0, gc); } } @@ -296,18 +296,18 @@ void Fl_GDI_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data, int x, int y, int w, int h,int d) { if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) { d ^= FL_IMAGE_WITH_ALPHA; - innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data); + innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data, gc); } else { - innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data); + innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data, gc); } } void Fl_GDI_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){ if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) { d ^= FL_IMAGE_WITH_ALPHA; - innards(buf,x,y,w,h,d,l,1,0,0); + innards(buf,x,y,w,h,d,l,1,0,0, gc); } else { - innards(buf,x,y,w,h,d,l,1,0,0); + innards(buf,x,y,w,h,d,l,1,0,0, gc); } } @@ -315,9 +315,9 @@ void Fl_GDI_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int x, int y, int w, int h,int d) { if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) { d ^= FL_IMAGE_WITH_ALPHA; - innards(0,x,y,w,h,d,0,1,cb,data); + innards(0,x,y,w,h,d,0,1,cb,data, gc); } else { - innards(0,x,y,w,h,d,0,1,cb,data); + innards(0,x,y,w,h,d,0,1,cb,data, gc); } } @@ -327,7 +327,7 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { if (fl_palette) { uchar c[3]; c[0] = r; c[1] = g; c[2] = b; - innards(c,x,y,w,h,0,0,0,0,0); + innards(c,x,y,w,h,0,0,0,0,0,(HDC)fl_graphics_driver->get_gc()); return; } #endif @@ -346,8 +346,8 @@ Fl_Bitmask Fl_GDI_Graphics_Driver::create_bitmask(int w, int h, const uchar *dat static uchar loNibble[16] = { 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f }; - int np = GetDeviceCaps(fl_gc, PLANES); //: was always one on sample machines - int bpp = GetDeviceCaps(fl_gc, BITSPIXEL);//: 1,4,8,16,24,32 and more odd stuff? + int np = GetDeviceCaps(gc, PLANES); //: was always one on sample machines + int bpp = GetDeviceCaps(gc, BITSPIXEL);//: 1,4,8,16,24,32 and more odd stuff? int Bpr = (bpp*w+7)/8; //: bytes per row int pad = Bpr&1, w1 = (w+7)/8, shr = ((w-1)&7)+1; if (bpp==4) shr = (shr+1)/2; @@ -404,12 +404,12 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, return; } - HDC tempdc = CreateCompatibleDC(fl_gc); + HDC tempdc = CreateCompatibleDC(gc); int save = SaveDC(tempdc); SelectObject(tempdc, (HGDIOBJ)bm->id_); - SelectObject(fl_gc, fl_brush()); + SelectObject(gc, fl_brush()); // secret bitblt code found in old MSWindows reference manual: - BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L); + BitBlt(gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L); RestoreDC(tempdc, save); DeleteDC(tempdc); } @@ -447,15 +447,16 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, fl_color(background); fl_rectf(0,0,W,H); // use this color as offscreen background fl_color(save_c); // back to bitmap's color - tempdc = CreateCompatibleDC(fl_gc); + HDC off_gc = (HDC)fl_graphics_driver->get_gc(); + tempdc = CreateCompatibleDC(off_gc); save = SaveDC(tempdc); SelectObject(tempdc, (HGDIOBJ)bm->id_); - SelectObject(fl_gc, fl_brush()); // use bitmap's desired color - BitBlt(fl_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen + SelectObject(off_gc, fl_brush()); // use bitmap's desired color + BitBlt(off_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen fl_end_offscreen(); // offscreen data is in tmp_id SelectObject(tempdc, (HGDIOBJ)tmp_id); // use offscreen data // draw it to printer context with background color as transparent - fl_TransparentBlt(fl_gc, X,Y,W,H, tempdc, cx, cy, bm->w(), bm->h(), RGB(r, g, b) ); + fl_TransparentBlt(gc, X,Y,W,H, tempdc, cx, cy, bm->w(), bm->h(), RGB(r, g, b) ); fl_delete_offscreen(tmp_id); RestoreDC(tempdc, save); DeleteDC(tempdc); @@ -510,12 +511,12 @@ void Fl_GDI_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, int } if (!img->id_) img->id_ = (fl_uintptr_t)build_id(img, (void**)&(img->mask_)); if (img->mask_) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC(gc); int save = SaveDC(new_gc); SelectObject(new_gc, (void*)img->mask_); - BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND); + BitBlt(gc, X, Y, W, H, new_gc, cx, cy, SRCAND); SelectObject(new_gc, (void*)img->id_); - BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT); + BitBlt(gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT); RestoreDC(new_gc,save); DeleteDC(new_gc); } else if (img->d()==2 || img->d()==4) { @@ -527,15 +528,15 @@ void Fl_GDI_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, int int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP) { XFORM old_tr, tr; - GetWorldTransform(fl_gc, &old_tr); // storing old transform + GetWorldTransform(gc, &old_tr); // storing old transform tr.eM11 = float(WP)/float(img->w()); tr.eM22 = float(HP)/float(img->h()); tr.eM12 = tr.eM21 = 0; tr.eDx = float(XP); tr.eDy = float(YP); - ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY); + ModifyWorldTransform(gc, &tr, MWT_LEFTMULTIPLY); img->draw(0, 0, img->w(), img->h(), 0, 0); - SetWorldTransform(fl_gc, &old_tr); + SetWorldTransform(gc, &old_tr); return 1; } @@ -592,12 +593,12 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP int X, Y, W, H; if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return; if (pxm->mask_) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC(gc); int save = SaveDC(new_gc); SelectObject(new_gc, (void*)pxm->mask_); - BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND); + BitBlt(gc, X, Y, W, H, new_gc, cx, cy, SRCAND); SelectObject(new_gc, (void*)pxm->id_); - BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT); + BitBlt(gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT); RestoreDC(new_gc,save); DeleteDC(new_gc); } else { @@ -617,11 +618,11 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt"); } if (fl_TransparentBlt) { - HDC new_gc = CreateCompatibleDC(fl_gc); + HDC new_gc = CreateCompatibleDC(gc); int save = SaveDC(new_gc); SelectObject(new_gc, (void*)pxm->id_); // print all of offscreen but its parts in background color - fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, W, H, pxm->pixmap_bg_color ); + fl_TransparentBlt(gc, X, Y, W, H, new_gc, cx, cy, W, H, pxm->pixmap_bg_color ); RestoreDC(new_gc,save); DeleteDC(new_gc); } diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx index 385586b2c..b855a1349 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx @@ -63,7 +63,7 @@ void Fl_GDI_Graphics_Driver::line_style(int style, int width, char* dashes) { Fl::error("fl_line_style(): Could not create GDI pen object."); return; } - HPEN oldpen = (HPEN)SelectObject(fl_gc, newpen); + HPEN oldpen = (HPEN)SelectObject(gc, newpen); DeleteObject(oldpen); DeleteObject(fl_current_xmap->pen); fl_current_xmap->pen = newpen; diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 796896cdd..78b3482aa 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -36,16 +36,16 @@ // --- line and polygon drawing with integer coordinates void Fl_GDI_Graphics_Driver::point(int x, int y) { - SetPixel(fl_gc, x, y, fl_RGB()); + SetPixel(gc, x, y, fl_RGB()); } void Fl_GDI_Graphics_Driver::rect(int x, int y, int w, int h) { if (w<=0 || h<=0) return; - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x+w-1, y); - LineTo(fl_gc, x+w-1, y+h-1); - LineTo(fl_gc, x, y+h-1); - LineTo(fl_gc, x, y); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x+w-1, y); + LineTo(gc, x+w-1, y+h-1); + LineTo(gc, x, y+h-1); + LineTo(gc, x, y); } void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) { @@ -64,79 +64,79 @@ void Fl_GDI_Graphics_Driver::rectf(int x, int y, int w, int h) { RECT rect; rect.left = x; rect.top = y; rect.right = x + w; rect.bottom = y + h; - FillRect(fl_gc, &rect, fl_brush()); + FillRect(gc, &rect, fl_brush()); } void Fl_GDI_Graphics_Driver::line(int x, int y, int x1, int y1) { - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y1); - SetPixel(fl_gc, x1, y1, fl_RGB()); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y1); + SetPixel(gc, x1, y1, fl_RGB()); } void Fl_GDI_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y2) { - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y1); - LineTo(fl_gc, x2, y2); - SetPixel(fl_gc, x2, y2, fl_RGB()); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y1); + LineTo(gc, x2, y2); + SetPixel(gc, x2, y2, fl_RGB()); } void Fl_GDI_Graphics_Driver::xyline(int x, int y, int x1) { - MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y); + MoveToEx(gc, x, y, 0L); LineTo(gc, x1+1, y); } void Fl_GDI_Graphics_Driver::xyline(int x, int y, int x1, int y2) { if (y2 < y) y2--; else y2++; - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y); - LineTo(fl_gc, x1, y2); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y); + LineTo(gc, x1, y2); } void Fl_GDI_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) { if(x3 < x1) x3--; else x3++; - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y); - LineTo(fl_gc, x1, y2); - LineTo(fl_gc, x3, y2); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y); + LineTo(gc, x1, y2); + LineTo(gc, x3, y2); } void Fl_GDI_Graphics_Driver::yxline(int x, int y, int y1) { if (y1 < y) y1--; else y1++; - MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1); + MoveToEx(gc, x, y, 0L); LineTo(gc, x, y1); } void Fl_GDI_Graphics_Driver::yxline(int x, int y, int y1, int x2) { if (x2 > x) x2++; else x2--; - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x, y1); - LineTo(fl_gc, x2, y1); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x, y1); + LineTo(gc, x2, y1); } void Fl_GDI_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) { if(y3<y1) y3--; else y3++; - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x, y1); - LineTo(fl_gc, x2, y1); - LineTo(fl_gc, x2, y3); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x, y1); + LineTo(gc, x2, y1); + LineTo(gc, x2, y3); } void Fl_GDI_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2) { - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y1); - LineTo(fl_gc, x2, y2); - LineTo(fl_gc, x, y); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y1); + LineTo(gc, x2, y2); + LineTo(gc, x, y); } void Fl_GDI_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { - MoveToEx(fl_gc, x, y, 0L); - LineTo(fl_gc, x1, y1); - LineTo(fl_gc, x2, y2); - LineTo(fl_gc, x3, y3); - LineTo(fl_gc, x, y); + MoveToEx(gc, x, y, 0L); + LineTo(gc, x1, y1); + LineTo(gc, x2, y2); + LineTo(gc, x3, y3); + LineTo(gc, x, y); } void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2) { @@ -144,8 +144,8 @@ void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y p[0].x = x; p[0].y = y; p[1].x = x1; p[1].y = y1; p[2].x = x2; p[2].y = y2; - SelectObject(fl_gc, fl_brush()); - Polygon(fl_gc, p, 3); + SelectObject(gc, fl_brush()); + Polygon(gc, p, 3); } void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { @@ -154,8 +154,8 @@ void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y p[1].x = x1; p[1].y = y1; p[2].x = x2; p[2].y = y2; p[3].x = x3; p[3].y = y3; - SelectObject(fl_gc, fl_brush()); - Polygon(fl_gc, p, 4); + SelectObject(gc, fl_brush()); + Polygon(gc, p, 4); } // --- clipping @@ -197,7 +197,7 @@ int Fl_GDI_Graphics_Driver::clip_box(int x, int y, int w, int h, int& X, int& Y, GetRgnBox(temp, &rect); if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { // if print context, convert coords from device to logical POINT pt[2] = { {rect.left, rect.top}, {rect.right, rect.bottom} }; - DPtoLP(fl_gc, pt, 2); + DPtoLP(gc, pt, 2); X = pt[0].x; Y = pt[0].y; W = pt[1].x - X; H = pt[1].y - Y; } else { @@ -217,7 +217,7 @@ int Fl_GDI_Graphics_Driver::not_clipped(int x, int y, int w, int h) { RECT rect; if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { // in case of print context, convert coords from logical to device POINT pt[2] = { {x, y}, {x + w, y + h} }; - LPtoDP(fl_gc, pt, 2); + LPtoDP(gc, pt, 2); rect.left = pt[0].x; rect.top = pt[0].y; rect.right = pt[1].x; rect.bottom = pt[1].y; } else { rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h; @@ -244,7 +244,7 @@ void Fl_GDI_Graphics_Driver::pop_clip() { void Fl_GDI_Graphics_Driver::restore_clip() { fl_clip_state_number++; Fl_Region r = rstack[rstackptr]; - SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared + SelectClipRgn(gc, r); //if r is NULL, clip is automatically cleared } diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx index ee12c9ad8..4107a47fc 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx @@ -41,7 +41,7 @@ void Fl_GDI_Graphics_Driver::vertex(double x,double y) { } void Fl_GDI_Graphics_Driver::end_points() { - for (int i=0; i<n; i++) SetPixel(fl_gc, p[i].x, p[i].y, fl_RGB()); + for (int i=0; i<n; i++) SetPixel(gc, p[i].x, p[i].y, fl_RGB()); } void Fl_GDI_Graphics_Driver::end_line() { @@ -49,7 +49,7 @@ void Fl_GDI_Graphics_Driver::end_line() { end_points(); return; } - if (n>1) Polyline(fl_gc, p, n); + if (n>1) Polyline(gc, p, n); } void Fl_GDI_Graphics_Driver::end_loop() { @@ -65,8 +65,8 @@ void Fl_GDI_Graphics_Driver::end_polygon() { return; } if (n>2) { - SelectObject(fl_gc, fl_brush()); - Polygon(fl_gc, p, n); + SelectObject(gc, fl_brush()); + Polygon(gc, p, n); } } @@ -94,8 +94,8 @@ void Fl_GDI_Graphics_Driver::end_complex_polygon() { return; } if (n>2) { - SelectObject(fl_gc, fl_brush()); - PolyPolygon(fl_gc, p, counts, numcount); + SelectObject(gc, fl_brush()); + PolyPolygon(gc, p, counts, numcount); } } @@ -114,10 +114,10 @@ void Fl_GDI_Graphics_Driver::circle(double x, double y,double r) { int h = (int)rint(yt+ry)-lly; if (what==POLYGON) { - SelectObject(fl_gc, fl_brush()); - Pie(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0); + SelectObject(gc, fl_brush()); + Pie(gc, llx, lly, llx+w, lly+h, 0,0, 0,0); } else - Arc(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0); + Arc(gc, llx, lly, llx+w, lly+h, 0,0, 0,0); } #endif // FL_CFG_GFX_GDI_VERTEX_CXX |
