Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost/intern/GHOST_Window.cpp')
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp88
1 files changed, 71 insertions, 17 deletions
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index 3673831c7b1..82dc039b840 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -38,21 +38,26 @@
#include "GHOST_Window.h"
+#include "GHOST_ContextNone.h"
+
#include <assert.h>
+
+
GHOST_Window::GHOST_Window(
- GHOST_TUns32 width, GHOST_TUns32 height,
- GHOST_TWindowState state,
- GHOST_TDrawingContextType type,
- const bool stereoVisual,
- const bool exclusive,
- const GHOST_TUns16 numOfAASamples)
- : m_drawingContextType(type),
- m_cursorVisible(true),
- m_cursorGrab(GHOST_kGrabDisable),
- m_cursorShape(GHOST_kStandardCursorDefault),
- m_stereoVisual(stereoVisual),
- m_numOfAASamples(numOfAASamples)
+ GHOST_TUns32 width, GHOST_TUns32 height,
+ GHOST_TWindowState state,
+ const bool wantStereoVisual,
+ const bool exclusive,
+ const GHOST_TUns16 wantNumOfAASamples
+)
+ : m_drawingContextType(GHOST_kDrawingContextTypeNone)
+ , m_cursorVisible(true)
+ , m_cursorGrab(GHOST_kGrabDisable)
+ , m_cursorShape(GHOST_kStandardCursorDefault)
+ , m_wantStereoVisual(wantStereoVisual)
+ , m_wantNumOfAASamples(wantNumOfAASamples)
+ , m_context(new GHOST_ContextNone(false, 0))
{
m_isUnsavedChanges = false;
m_canAcceptDragOperation = false;
@@ -65,6 +70,7 @@ GHOST_Window::GHOST_Window(
m_nativePixelSize = 1.0f;
m_fullScreen = state == GHOST_kWindowStateFullScreen;
+
if (m_fullScreen) {
m_fullScreenWidth = width;
m_fullScreenHeight = height;
@@ -72,29 +78,77 @@ GHOST_Window::GHOST_Window(
}
+
GHOST_Window::~GHOST_Window()
{
+ delete m_context;
}
+
+
void *GHOST_Window::getOSWindow() const
{
return NULL;
}
+
GHOST_TSuccess GHOST_Window::setDrawingContextType(GHOST_TDrawingContextType type)
{
- GHOST_TSuccess success = GHOST_kSuccess;
if (type != m_drawingContextType) {
- success = removeDrawingContext();
- if (success) {
- success = installDrawingContext(type);
+ delete m_context;
+ m_context = NULL;
+
+ if (type != GHOST_kDrawingContextTypeNone)
+ m_context = newDrawingContext(type);
+
+ if (m_context != NULL) {
m_drawingContextType = type;
}
else {
+ m_context = new GHOST_ContextNone(m_wantStereoVisual, m_wantNumOfAASamples);
m_drawingContextType = GHOST_kDrawingContextTypeNone;
}
+
+ return (type == m_drawingContextType) ? GHOST_kSuccess : GHOST_kFailure;
+ }
+ else {
+ return GHOST_kSuccess;
}
- return success;
+}
+
+GHOST_TSuccess GHOST_Window::swapBuffers()
+{
+ return m_context->swapBuffers();
+}
+
+GHOST_TSuccess GHOST_Window::setSwapInterval(int interval)
+{
+ return m_context->setSwapInterval(interval);
+}
+
+GHOST_TSuccess GHOST_Window::getSwapInterval(int& intervalOut)
+{
+ return m_context->getSwapInterval(intervalOut);
+}
+
+GHOST_TUns16 GHOST_Window::getNumOfAASamples()
+{
+ return m_context->getNumOfAASamples();
+}
+
+GHOST_TSuccess GHOST_Window::activateDrawingContext()
+{
+ return m_context->activateDrawingContext();
+}
+
+GHOST_TSuccess GHOST_Window::updateDrawingContext()
+{
+ return m_context->updateDrawingContext();
+}
+
+GHOST_TSuccess GHOST_Window::releaseNativeHandles()
+{
+ return m_context->releaseNativeHandles();
}
GHOST_TSuccess GHOST_Window::setCursorVisibility(bool visible)