[Bf-blender-cvs] [29c7f17] soc-2014-viewport_context: Merge branch 'master' into soc-2014-viewport_context

Campbell Barton noreply at git.blender.org
Sun Jul 27 06:00:03 CEST 2014


Commit: 29c7f17e5089a64d80059a3d55873a7329f60192
Author: Campbell Barton
Date:   Sun Jul 27 13:59:41 2014 +1000
Branches: soc-2014-viewport_context
https://developer.blender.org/rB29c7f17e5089a64d80059a3d55873a7329f60192

Merge branch 'master' into soc-2014-viewport_context

Conflicts:
	intern/ghost/intern/GHOST_SystemWin32.cpp
	intern/ghost/intern/GHOST_WindowWin32.cpp

===================================================================



===================================================================

diff --cc intern/ghost/intern/GHOST_SystemWin32.cpp
index b06bbd7,91ac854..ea5c655
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@@ -214,36 -214,48 +214,40 @@@ void GHOST_SystemWin32::getAllDisplayDi
  }
  
  GHOST_IWindow *GHOST_SystemWin32::createWindow(
- 		const STR_String& title,
- 		GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
- 		GHOST_TWindowState state, GHOST_TDrawingContextType type,
- 		bool wantStereoVisual, const bool exclusive, const GHOST_TUns16 wantNumOfAASamples, const GHOST_TEmbedderWindowID parentWindow)
+         const STR_String &title,
+         GHOST_TInt32 left, GHOST_TInt32 top,
+         GHOST_TUns32 width, GHOST_TUns32 height,
+         GHOST_TWindowState state, GHOST_TDrawingContextType type,
 -        bool stereoVisual,
++        bool wantStereoVisual,
+         const bool exclusive,
 -        const GHOST_TUns16 numOfAASamples,
++        const GHOST_TUns16 wantNumOfAASamples,
+         const GHOST_TEmbedderWindowID parentWindow)
  {
 -	GHOST_Window *window = 0;
 -	window = new GHOST_WindowWin32(this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples, parentWindow);
 -	if (window) {
 -		if (window->getValid()) {
 -			// Store the pointer to the window
 -//			if (state != GHOST_kWindowStateFullScreen) {
 -			m_windowManager->addWindow(window);
 -			m_windowManager->setActiveWindow(window);
 -//			}
 -		}
 -		else {
 -
 -			// Invalid parent window hwnd
 -			if (((GHOST_WindowWin32 *)window)->getNextWindow() == NULL) {
 -				delete window;
 -				window = 0;
 -				return window;
 -			}
 -
 -			// An invalid window could be one that was used to test for AA
 -			window = ((GHOST_WindowWin32 *)window)->getNextWindow();
 -			
 -			// If another window is found, let the wm know about that one, but not the old one
 -			if (window->getValid()) {
 -				m_windowManager->addWindow(window);
 -			}
 -			else {
 -				delete window;
 -				window = 0;
 -			}
 -
 -		}
 +	GHOST_Window *window =
 +		new GHOST_WindowWin32(
 +		        this,
 +		        title,
 +		        left,
 +		        top,
 +		        width,
 +		        height,
 +		        state,
 +		        type,
 +		        wantStereoVisual,
 +		        wantNumOfAASamples,
 +		        parentWindow);
 +
 +	if (window->getValid()) {
 +		// Store the pointer to the window
 +		m_windowManager->addWindow(window);
 +		m_windowManager->setActiveWindow(window);
  	}
 +	else {
 +		GHOST_PRINT("GHOST_SystemWin32::createWindow(): window invalid\n");
 +		delete window;
 +		window = 0;
 +	}
 +
  	return window;
  }
  
diff --cc intern/ghost/intern/GHOST_WindowWin32.cpp
index 2b3abf0,f8264b6..76ec050
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@@ -63,33 -112,46 +63,32 @@@ extern "C" 
  }
  
  GHOST_WindowWin32::GHOST_WindowWin32(
-     GHOST_SystemWin32 *system,
-     const STR_String& title,
-     GHOST_TInt32 left,
-     GHOST_TInt32 top,
-     GHOST_TUns32 width,
-     GHOST_TUns32 height,
-     GHOST_TWindowState state,
-     GHOST_TDrawingContextType type,
-     bool wantStereoVisual,
-     GHOST_TUns16 wantNumOfAASamples,
-     GHOST_TEmbedderWindowID parentwindowhwnd)
- 	:
- 	GHOST_Window(width, height, state,
- 	             wantStereoVisual, false, wantNumOfAASamples),
- 	m_inLiveResize(false),
- 	m_system(system),
- 	m_hDC(0),
- 	m_hasMouseCaptured(false),
- 	m_hasGrabMouse(false),
- 	m_nPressedButtons(0),
- 	m_customCursor(0),
- 	m_wintab(NULL),
- 	m_tabletData(NULL),
- 	m_tablet(0),
- 	m_maxPressure(0),
- 	m_normal_state(GHOST_kWindowStateNormal),
- 	m_parentWindowHwnd(parentwindowhwnd)
+         GHOST_SystemWin32 *system,
+         const STR_String &title,
+         GHOST_TInt32 left,
+         GHOST_TInt32 top,
+         GHOST_TUns32 width,
+         GHOST_TUns32 height,
+         GHOST_TWindowState state,
+         GHOST_TDrawingContextType type,
 -        const bool stereoVisual,
 -        const GHOST_TUns16 numOfAASamples,
 -        GHOST_TEmbedderWindowID parentwindowhwnd,
 -        GHOST_TSuccess msEnabled,
 -        int msPixelFormat)
 -    : GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone,
 -                   stereoVisual, false, numOfAASamples),
++        bool wantStereoVisual,
++        GHOST_TUns16 wantNumOfAASamples,
++        GHOST_TEmbedderWindowID parentwindowhwnd)
++    : GHOST_Window(width, height, state,
++                   wantStereoVisual, false, wantNumOfAASamples),
+       m_inLiveResize(false),
+       m_system(system),
+       m_hDC(0),
 -      m_hGlRc(0),
+       m_hasMouseCaptured(false),
+       m_hasGrabMouse(false),
+       m_nPressedButtons(0),
+       m_customCursor(0),
+       m_wintab(NULL),
+       m_tabletData(NULL),
+       m_tablet(0),
+       m_maxPressure(0),
 -      m_multisample(numOfAASamples),
 -      m_multisampleEnabled(msEnabled),
 -      m_msPixelFormat(msPixelFormat),
 -      //For recreation
 -      m_title(title),
 -      m_left(left),
 -      m_top(top),
 -      m_width(width),
 -      m_height(height),
+       m_normal_state(GHOST_kWindowStateNormal),
 -      m_stereo(stereoVisual),
 -      m_nextWindow(NULL),
+       m_parentWindowHwnd(parentwindowhwnd)
  {
  	OSVERSIONINFOEX versionInfo;
  	bool hasMinVersionForTaskbar = false;
@@@ -348,9 -415,16 +349,10 @@@ GHOST_WindowWin32::~GHOST_WindowWin32(
  		m_customCursor = NULL;
  	}
  
 -	::wglMakeCurrent(NULL, NULL);
 -	m_multisampleEnabled = GHOST_kFailure;
 -	m_multisample = 0;
 -	setDrawingContextType(GHOST_kDrawingContextTypeNone);
 -
 -	if (m_hDC && m_hDC != s_firstHDC) {
 +	if (m_hWnd != NULL && m_hDC != NULL && releaseNativeHandles()) {
  		::ReleaseDC(m_hWnd, m_hDC);
 -		m_hDC = 0;
  	}
+ 
  	if (m_hWnd) {
  		if (m_dropTarget) {
  			// Disable DragDrop
@@@ -601,94 -733,257 +613,93 @@@ GHOST_TSuccess GHOST_WindowWin32::inval
  	return success;
  }
  
 -GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
 -{
 -	int pixelFormat;
 -	bool success = FALSE;
 -	UINT numFormats;
 -	HDC hDC = GetDC(getHWND());
 -	float fAttributes[] = {0, 0};
 -	UINT nMaxFormats = 1;
 -
 -	// The attributes to look for
 -	int iAttributes[] = {
 -		WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
 -		WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
 -		WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
 -		WGL_COLOR_BITS_ARB, pfd.cColorBits,
 -		WGL_DEPTH_BITS_ARB, pfd.cDepthBits,
 -#ifdef GHOST_OPENGL_ALPHA
 -		WGL_ALPHA_BITS_ARB, pfd.cAlphaBits,
 -#endif
 -		WGL_STENCIL_BITS_ARB, pfd.cStencilBits,
 -		WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
 -		WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
 -		WGL_SAMPLES_ARB, m_multisample,
 -		0, 0
 -	};
 -
 -	// Get the function
 -	PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
 -
 -	if (!wglChoosePixelFormatARB) {
 -		m_multisampleEnabled = GHOST_kFailure;
 -		return GHOST_kFailure;
 -	}
  
 -	// iAttributes[17] is the initial multisample. If not valid try to use the closest valid value under it.
 -	while (iAttributes[17] > 0) {
 -		// See if the format is valid
 -		success = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, nMaxFormats, &pixelFormat, &numFormats);
 -		GHOST_PRINTF("WGL_SAMPLES_ARB = %i --> success = %i, %i formats\n", iAttributes[17], success, numFormats);
 -
 -		if (success && numFormats >= 1 && m_multisampleEnabled == GHOST_kFailure) {
 -			GHOST_PRINTF("valid pixel format with %i multisamples\n", iAttributes[17]);
 -			m_multisampleEnabled = GHOST_kSuccess;
 -			m_msPixelFormat = pixelFormat;
 -		}
 -		iAttributes[17] -= 1;
 -		success = GHOST_kFailure;
 -	}
 -	if (m_multisampleEnabled == GHOST_kSuccess) {
 -		return GHOST_kSuccess;
 -	}
 -	GHOST_PRINT("no available pixel format\n");
 -	return GHOST_kFailure;
 -}
--
 -GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextType type)
 +GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType type)
  {
 -	GHOST_TSuccess success;
 -	switch (type) {
 -		case GHOST_kDrawingContextTypeOpenGL:
 -		{
 -			// If this window has multisample enabled, use the supplied format
 -			if (m_multisampleEnabled)
 -			{
 -				if (SetPixelFormat(m_hDC, m_msPixelFormat, &sPreferredFormat) == FALSE)
 -				{
 -					success = GHOST_kFailure;
 -					break;
 -				}
 -
 -				// Create the context
 -				m_hGlRc = ::wglCreateContext(m_hDC);
 -				if (m_hGlRc) {
 -					if (::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE) {
 -						if (s_firsthGLRc) {
 -							if (is_crappy_intel_card()) {
 -								if (::wglMakeCurrent(NULL, NULL) == TRUE) {
 -									::wglDeleteContext(m_hGlRc);
 -									m_hGlRc = s_firsthGLRc;
 -								}
 -								else {
 -									::wglDeleteContext(m_hGlRc);
 -									m_hGlRc = NULL;
 -								}
 -							}
 -							else {
 -								::wglCopyContext(s_firsthGLRc, m_hGlRc, GL_ALL_ATTRIB_BITS);
 -								::wglShareLists(s_firsthGLRc, m_hGlRc);
 -							}
 -						}
 -						else {
 -							s_firsthGLRc = m_hGlRc;
 -						}
 -
 -						if (m_hGlRc) {
 -							success = ::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
 -						}
 -						else {
 -							success = GHOST_kFailure;
 -						}
 -					}
 -					else {
 -						success = GHOST_kFailure;
 -					}
 -				}
 -				else {
 -					success = GHOST_kFailure;
 -				}
 -
 -				if (success == GHOST_kFailure) {
 -					printf("Failed to get a context....\n");
 -				}
 -			}
 -			else {
 -				if (m_stereoVisual)
 -					sPreferredFormat.dwFlags |= PFD_STEREO;
 -
 -				// Attempt to match device context pixel format to the preferred format
 -				int iPixelFormat = EnumPixelFormats(m_hDC);
 -				if (iPixelFormat == 0) {
 -					success = GHOST_kFailure;
 -					break;
 -				}
 -				if (::SetPixelFormat(m_hDC, iPixelFormat, &sPreferredFormat) == FALSE) {
 -					success = GHOST_kFailure;
 -					break;
 -				}
 -				// For debugging only: retrieve the pixel format chosen
 -				PIXELFORMATDESCRIPTOR preferredFormat;
 -				::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &preferredFormat);
 -
 -				// Create the context
 -				m_hGlRc = ::wglCreateContext(m_hDC);
 -				if (m_hGlRc) {
 -					if (::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE) {
 -						if (

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list