FLTK sandbox

Check-in [8fd80b6646]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:1) For the X11 and the Mac OS platforms, a default font (FL_HELVETICA, FL_NORMAL_SIZE) is used when fl_draw() is called while no font has been set before. This commit does the same on the MSWindows platform, for consistency. 2) Slightly improved Fl_Image_Surface::draw_decorated_window() under WIN32. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@10996 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8fd80b664624e32235e563d8963dd4325097a6df
User & Date: manolo@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 2016-01-05 05:48:58
Context
2016-01-05
11:59
1) The Fl_Window::decorated_h() computation was incorrect under MSWindows10 because it did not use the correct dwmapi.dll - based implementation. This commit uses the correct way to compute the width and height of window borders in Fl_Window::decorated_h() and in Fl_Paged_Device::draw_decorated_window(). 2) Fixed the computation of enhanced metafile units that correspond to a given pixel size used by the Fl_Copy_Surface class on the WIN32 platform. Tested with MSWindows XP, 7 and 10 using the device test app. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@10997 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 check-in: bf99db0bbb user: manolo@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 tags: trunk
05:48
1) For the X11 and the Mac OS platforms, a default font (FL_HELVETICA, FL_NORMAL_SIZE) is used when fl_draw() is called while no font has been set before. This commit does the same on the MSWindows platform, for consistency. 2) Slightly improved Fl_Image_Surface::draw_decorated_window() under WIN32. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@10996 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 check-in: 8fd80b6646 user: manolo@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 tags: trunk
2016-01-04
13:16
Implemented Fl_Image_Surface::draw_decorated_window(). This gives the same drawing capabilities to all supported drawing surfaces: display, printer, clipboard, in-memory bitmap image, PostScript file. Also, completed the Mac OS implementation of Fl_Copy_Surface::draw_decorated_window(Fl_Window *win, int delta_x=0, int delta_y=0) that did not honor non-zero last arguments. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@10990 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 check-in: b71f77c2cb user: manolo@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/Fl_Image_Surface.cxx.

182
183
184
185
186
187
188
189
190


191
192
193
194
195
196
197
198
199
 \param delta_x and \param delta_y give
 the position in the image of the top-left corner of the window's title bar
*/
void Fl_Image_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int delta_y)
{
#ifdef WIN32
  // draw_decorated_window() will change the current drawing surface, and set it
  // back to us; it's necessary to call image() before for this to work
  delete image();


#endif
  helper->draw_decorated_window(win, delta_x, delta_y, this);
}
#endif


//
// End of "$Id$".
//







|
|
>
>









182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
 \param delta_x and \param delta_y give
 the position in the image of the top-left corner of the window's title bar
*/
void Fl_Image_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int delta_y)
{
#ifdef WIN32
  // draw_decorated_window() will change the current drawing surface, and set it
  // back to us; it's necessary to do some cleaning before
  fl_pop_clip();
  RestoreDC(fl_gc, _savedc);
  DeleteDC(fl_gc);
#endif
  helper->draw_decorated_window(win, delta_x, delta_y, this);
}
#endif


//
// End of "$Id$".
//

Changes to src/fl_font_win32.cxx.

379
380
381
382
383
384
385


386
387
388
389
390
391
392
  dy = descent() - h;
  EXTENTS_UPDATE(dx, dy, w, h);
  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());


  SelectObject(fl_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);
  }







>
>







379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
  dy = descent() - h;
  EXTENTS_UPDATE(dx, dy, w, h);
  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());
  // 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);
  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);
  }