Skip to content

Commit

Permalink
Add Guillaume's screenshot patches for Mac. (Part of Stellarium#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Jun 21, 2018
1 parent c266f9d commit 1cdcea0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/StelMainView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,8 @@ void StelMainView::doScreenshot(void)
// First, image size:
glWidget->makeCurrent();
float pixelRatio = QOpenGLContext::currentContext()->screen()->devicePixelRatio();
int imgWidth =stelScene->width() * pixelRatio;
int imgHeight=stelScene->height() * pixelRatio;
int imgWidth =stelScene->width();
int imgHeight=stelScene->height();
if (flagUseCustomScreenshotSize)
{
// Borrowed from Scenery3d renderer: determine maximum framebuffer size as minimum of texture, viewport and renderbuffer size
Expand Down Expand Up @@ -1477,7 +1477,7 @@ void StelMainView::doScreenshot(void)
QOpenGLFramebufferObjectFormat fbFormat;
fbFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fbFormat.setInternalTextureFormat(isGLES ? GL_RGBA : GL_RGB); // try to avoid transparent background!
QOpenGLFramebufferObject * fbObj = new QOpenGLFramebufferObject(imgWidth, imgHeight, fbFormat);
QOpenGLFramebufferObject * fbObj = new QOpenGLFramebufferObject(imgWidth * pixelRatio, imgHeight * pixelRatio, fbFormat);
fbObj->bind();
// Now the painter has to be convinced to paint to the potentially larger image frame.
QOpenGLPaintDevice fbObjPaintDev(imgWidth, imgHeight);
Expand All @@ -1491,7 +1491,7 @@ void StelMainView::doScreenshot(void)
sParams.viewportXywh[3]=imgHeight;

// Configure a helper value to allow some modules to tweak their output sizes. Currently used by StarMgr, maybe solve font issues?
customScreenshotMagnification=imgHeight/QApplication::desktop()->screenGeometry().height();
customScreenshotMagnification=(float)imgHeight/QApplication::desktop()->screenGeometry().height();

sParams.viewportCenter.set(0.0+(0.5+pParams.viewportCenterOffset.v[0])*imgWidth, 0.0+(0.5+pParams.viewportCenterOffset.v[1])*imgHeight);
sParams.viewportFovDiameter = qMin(imgWidth,imgHeight);
Expand Down

0 comments on commit 1cdcea0

Please sign in to comment.