From 2571ed0b5ef14155d204540d38b564a7d4cd47b6 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sun, 8 Jun 2014 08:11:57 +0200
Subject: Bug 741 HiDPI: Add ScalableSurface interface to get/set pixelScale w/
 full OSX impl.

Add ScalableSurface interface
  - To set pixelScale before and after realization
  - To get pixelScale

  - Implemented on:
    - NEWT Window
      - Generic impl. in WindowImpl
      - OSX WindowDriver impl.
        - Also propagetes pixelScale to parent JAWTWindow if offscreen (NewtCanvasAWT)
      - AWT WindowDriver impl.

    - JAWTWindow / OSXCalayer
      - AWT GLCanvas
      - AWT GLJPanel
      - NEWTCanvasAWT:
        - Propagates NEWT Window's pixelScale to underlying JAWTWindow

    - WrappedSurface for pixelScale propagation
      using offscreen drawables, i.e. GLJPanel

    - Generic helper in SurfaceScaleUtils (nativewindow package)

  - Fully implemented on OSX

  - Capable to switch pixelScale before realization,
    i.e. native-creation, as well as on-the-fly.

  - Impl. uses int[2] for pixelScale to support
    non-uniform scale.

Test cases:
  - com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT
  - com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT
  - com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT
  - com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT

  - Press 'x' to toggle HiDPI
  - Commandline '-pixelScale <value>'
  - Added basic auto unit test (setting pre-realization)
---
 src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src/jogl/native/macosx')

diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index fb6fd18e9..652b0545e 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -292,13 +292,17 @@ static const GLfloat gl_verts[] = {
             gl_texCoords[i] = 0.0f;
         }
     }
-    if( _texWidth != _winWidth ) {
+    /** 
+     * Set via 
+     *   - OSXUtil_SetCALayerPixelScale0
+     *   - OSXUtil_AddCASublayer0 
 NS_DURING
-        // Available >= 10.7
-        [self setContentsScale: (CGFloat)_texWidth/(CGFloat)_winWidth];
+    // Available >= 10.7
+    [self setContentsScale: (CGFloat)_texWidth/(CGFloat)_winWidth];
 NS_HANDLER
 NS_ENDHANDLER
-    }
+    */
+
     parentPixelFmt = [_parentPixelFmt retain]; // until destruction
     glContext = [[MyNSOpenGLContext alloc] initWithFormat:parentPixelFmt shareContext:parentCtx];
     gl3ShaderProgramName = _gl3ShaderProgramName;
-- 
cgit v1.2.3