Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Unified Diff: tools/viewer/sk_app/mac/GLWindowContext_mac.cpp

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/sk_app/mac/GLWindowContext_mac.h ('k') | tools/viewer/sk_app/mac/WindowContextFactory_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/mac/GLWindowContext_mac.cpp
diff --git a/tools/viewer/sk_app/mac/GLWindowContext_mac.cpp b/tools/viewer/sk_app/mac/GLWindowContext_mac.cpp
index aa700e31656ecb12bdac283711bd77c39f7191ae..c2de0df621b61da53d958e1efebb5d1cda5a1317 100644
--- a/tools/viewer/sk_app/mac/GLWindowContext_mac.cpp
+++ b/tools/viewer/sk_app/mac/GLWindowContext_mac.cpp
@@ -6,26 +6,41 @@
* found in the LICENSE file.
*/
-#include "GLWindowContext_mac.h"
+#include "../GLWindowContext.h"
+#include "WindowContextFactory_mac.h"
//#include <GL/gl.h>
-#include "Window_mac.h"
-
-namespace sk_app {
-
-// platform-dependent create
-GLWindowContext* GLWindowContext::Create(void* platformData, const DisplayParams& params) {
- GLWindowContext_mac* ctx = new GLWindowContext_mac(platformData, params);
- if (!ctx->isValid()) {
- delete ctx;
- return nullptr;
- }
- return ctx;
-}
+using sk_app::DisplayParams;
+using sk_app::window_context_factory::MacWindowInfo;
+using sk_app::GLWindowContext;
+
+namespace {
+
+class GLWindowContext_mac : public GLWindowContext {
+public:
+ GLWindowContext_mac(const MacWindowInfo&, const DisplayParams&);
+
+ ~GLWindowContext_mac() override;
+
+ void onSwapBuffers() override;
+
+ void onInitializeContext() override;
+ void onDestroyContext() override;
+
+private:
+
+#if 0
+ // TODO: add Mac-specific GL display objects
+ Display* fDisplay;
+ XWindow fWindow;
+ XVisualInfo* fVisualInfo;
+ GLXContext fGLContext;
+#endif
+};
-GLWindowContext_mac::GLWindowContext_mac(void* platformData, const DisplayParams& params)
- : GLWindowContext(platformData, params)
+GLWindowContext_mac::GLWindowContext_mac(const MacWindowInfo& info, const DisplayParams& params)
+ : GLWindowContext(params)
#if 0
// TODO: init Mac-specific OpenGL objects
, fDisplay(nullptr)
@@ -36,24 +51,16 @@ GLWindowContext_mac::GLWindowContext_mac(void* platformData, const DisplayParams
// any config code here (particularly for msaa)?
- this->initializeContext(platformData, params);
+ this->initializeContext();
}
GLWindowContext_mac::~GLWindowContext_mac() {
this->destroyContext();
}
-void GLWindowContext_mac::onInitializeContext(void* platformData, const DisplayParams& params) {
+void GLWindowContext_mac::onInitializeContext() {
#if 0
// TODO: Init for Mac
- ContextPlatformData_mac* unixPlatformData =
- reinterpret_cast<ContextPlatformData_mac*>(platformData);
-
- if (unixPlatformData) {
- fDisplay = unixPlatformData->fDisplay;
- fWindow = unixPlatformData->fWindow;
- fVisualInfo = unixPlatformData->fVisualInfo;
- }
SkASSERT(fDisplay);
fGLContext = glXCreateContext(fDisplay, fVisualInfo, nullptr, GL_TRUE);
@@ -107,5 +114,20 @@ void GLWindowContext_mac::onSwapBuffers() {
#endif
}
+} // anonymous namespace
+
+
+namespace sk_app {
+namespace window_context_factory {
+
+WindowContext* MakeGLForMac(const MacWindowInfo& info, const DisplayParams& params) {
+ WindowContext* ctx = new GLWindowContext_mac(info, params);
+ if (!ctx->isValid()) {
+ delete ctx;
+ return nullptr;
+ }
+ return ctx;
+}
-} //namespace sk_app
+} // namespace window_context_factory
+} // namespace sk_app
« no previous file with comments | « tools/viewer/sk_app/mac/GLWindowContext_mac.h ('k') | tools/viewer/sk_app/mac/WindowContextFactory_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698