mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 14:40:35 +05:00
pixel-scale fixes for Mac-Retina resolution: dbl-click, snapshot
This commit is contained in:
parent
6df972be05
commit
75dc76cc95
18
ng/ngpkg.cpp
18
ng/ngpkg.cpp
@ -25,6 +25,8 @@ The interface between the GUI and the netgen library
|
|||||||
|
|
||||||
// to be sure to include the 'right' togl-version
|
// to be sure to include the 'right' togl-version
|
||||||
#include "Togl2.1/togl.h"
|
#include "Togl2.1/togl.h"
|
||||||
|
extern "C" int Togl_PixelScale (const Togl * togl);
|
||||||
|
|
||||||
#include "fonts.hpp"
|
#include "fonts.hpp"
|
||||||
|
|
||||||
extern bool nodisplay;
|
extern bool nodisplay;
|
||||||
@ -1994,7 +1996,6 @@ namespace netgen
|
|||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int Ng_SnapShot(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const *argv)
|
static int Ng_SnapShot(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const *argv)
|
||||||
{
|
{
|
||||||
struct Togl *togl;
|
struct Togl *togl;
|
||||||
@ -2003,9 +2004,8 @@ namespace netgen
|
|||||||
const char * filename = Tcl_GetString(argv[2]);
|
const char * filename = Tcl_GetString(argv[2]);
|
||||||
|
|
||||||
int len = strlen(filename);
|
int len = strlen(filename);
|
||||||
|
int w = Togl_PixelScale(togl)*Togl_Width (togl);
|
||||||
int w = Togl_Width (togl);
|
int h = Togl_PixelScale(togl)*Togl_Height (togl);
|
||||||
int h = Togl_Height (togl);
|
|
||||||
|
|
||||||
Array<unsigned char> buffer(w*h*3);
|
Array<unsigned char> buffer(w*h*3);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||||
@ -2064,8 +2064,8 @@ namespace netgen
|
|||||||
|
|
||||||
cout << "Snapshot to file '" << filename << endl;
|
cout << "Snapshot to file '" << filename << endl;
|
||||||
|
|
||||||
int w = Togl_Width (togl);
|
// int w = Togl_Width (togl);
|
||||||
int h = Togl_Height (togl);
|
// int h = Togl_Height (togl);
|
||||||
|
|
||||||
ofstream outfile(filename2);
|
ofstream outfile(filename2);
|
||||||
outfile << "P6" << endl
|
outfile << "P6" << endl
|
||||||
@ -2184,10 +2184,8 @@ namespace netgen
|
|||||||
Tcl_Interp * interp,
|
Tcl_Interp * interp,
|
||||||
int argc, tcl_const char *argv[])
|
int argc, tcl_const char *argv[])
|
||||||
{
|
{
|
||||||
int px, py;
|
int px = Togl_PixelScale(togl)*atoi (argv[1]);
|
||||||
|
int py = Togl_PixelScale(togl)*atoi (argv[2]);
|
||||||
px = atoi (argv[1]);
|
|
||||||
py = atoi (argv[2]);
|
|
||||||
|
|
||||||
SetVisualScene(interp);
|
SetVisualScene(interp);
|
||||||
vs->MouseDblClick (px, py);
|
vs->MouseDblClick (px, py);
|
||||||
|
Loading…
Reference in New Issue
Block a user