[waffle] [PATCH 4/7] nacl: add implementation for window create and resize
Tapani Pälli
tapani.palli at intel.com
Thu Jan 22 23:59:36 PST 2015
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/waffle/nacl/nacl_container.cpp | 18 ++++++++++++++++++
src/waffle/nacl/nacl_container.h | 1 +
src/waffle/nacl/nacl_window.c | 7 ++++++-
src/waffle/nacl/nacl_window.h | 1 +
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/waffle/nacl/nacl_container.cpp b/src/waffle/nacl/nacl_container.cpp
index e352da9..bca39eb 100644
--- a/src/waffle/nacl/nacl_container.cpp
+++ b/src/waffle/nacl/nacl_container.cpp
@@ -26,6 +26,7 @@
#include "ppapi/cpp/graphics_3d.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
+#include "ppapi/c/pp_errors.h"
#include "nacl_container.h"
namespace waffle {
@@ -125,6 +126,15 @@ nacl_context_init(waffle::nacl_container *nc, struct nacl_config *cfg)
return true;
}
+static bool
+nacl_resize(struct nacl_container *nc, int32_t width, int32_t height)
+{
+ if (!nc || nc->ctx.ResizeBuffers(width, height) != PP_OK)
+ return false;
+
+ return true;
+}
+
}; // namespace waffle ends
extern "C" struct nacl_container*
@@ -145,3 +155,11 @@ nacl_context_init(struct nacl_container *nc, struct nacl_config *cfg)
return waffle::nacl_context_init(
reinterpret_cast<waffle::nacl_container*>(nc), cfg);
}
+
+extern "C" bool
+nacl_resize(struct nacl_container *nc, int32_t width, int32_t height)
+{
+ return waffle::nacl_resize(
+ reinterpret_cast<waffle::nacl_container*>(nc),
+ width, height);
+}
diff --git a/src/waffle/nacl/nacl_container.h b/src/waffle/nacl/nacl_container.h
index 81472cc..f3ede41 100644
--- a/src/waffle/nacl/nacl_container.h
+++ b/src/waffle/nacl/nacl_container.h
@@ -40,6 +40,7 @@ struct nacl_container;
struct nacl_container *nacl_init();
void nacl_teardown(struct nacl_container *nc);
bool nacl_context_init(struct nacl_container *nc, struct nacl_config *cfg);
+bool nacl_resize(struct nacl_container *nc, int32_t width, int32_t height);
#ifdef __cplusplus
};
diff --git a/src/waffle/nacl/nacl_window.c b/src/waffle/nacl/nacl_window.c
index c5ba4e0..eef1d1d 100644
--- a/src/waffle/nacl/nacl_window.c
+++ b/src/waffle/nacl/nacl_window.c
@@ -50,12 +50,16 @@ nacl_window_create(struct wcore_platform *wc_plat,
int height)
{
struct nacl_window *self;
+ struct nacl_platform *nplat = nacl_platform(wc_plat);
bool ok = true;
self = wcore_calloc(sizeof(*self));
if (self == NULL)
return NULL;
+ // Set requested dimensions for the backing surface.
+ nacl_resize(nplat->nacl, width, height);
+
ok = wcore_window_init(&self->wcore, wc_config);
if (!ok)
goto error;
@@ -80,7 +84,8 @@ bool
nacl_window_resize(struct wcore_window *wc_self,
int32_t width, int32_t height)
{
- return false;
+ struct nacl_platform *plat = nacl_platform(wc_self->display->platform);
+ return nacl_resize(plat->nacl, width, height);
}
bool
diff --git a/src/waffle/nacl/nacl_window.h b/src/waffle/nacl/nacl_window.h
index 5f0906d..9bbbb29 100644
--- a/src/waffle/nacl/nacl_window.h
+++ b/src/waffle/nacl/nacl_window.h
@@ -27,6 +27,7 @@
#include "wcore_window.h"
#include "wcore_util.h"
+#include "nacl_container.h"
#include "nacl_platform.h"
struct wcore_platform;
--
2.1.0
More information about the waffle
mailing list