Implement quick&dirty approach to update window size and position
This commit is contained in:
parent
f2e39fb2f7
commit
b05b8bae8b
9 changed files with 53 additions and 8 deletions
|
|
@ -497,6 +497,13 @@ FrameBufferWindow* FrameBuffer::createWindow(int x, int y, int width, int height
|
|||
return window;
|
||||
}
|
||||
|
||||
void FrameBuffer::updateWindow(FrameBufferWindow *window, int x, int y, int width, int height) {
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
updateSubWindow(window->native_window, x, y, width, height);
|
||||
}
|
||||
|
||||
void FrameBuffer::destroyWindow(FrameBufferWindow *window) {
|
||||
if (!window)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public:
|
|||
static bool initialize(EGLNativeDisplayType nativeDisplay);
|
||||
|
||||
FrameBufferWindow* createWindow(int x, int y, int width, int height);
|
||||
void updateWindow(FrameBufferWindow *window, int x, int y, int width, int height);
|
||||
void destroyWindow(FrameBufferWindow *window);
|
||||
|
||||
// Finalize the instance.
|
||||
|
|
|
|||
|
|
@ -82,13 +82,16 @@ void LayerManager::post_layer(const LayerInfo &layer) {
|
|||
l.second.updated = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("New layer '%s' {%d,%d,%d,%d}\n", layer.name.c_str());
|
||||
window = FrameBuffer::getFB()->createWindow(
|
||||
layer.display_frame.left,
|
||||
layer.display_frame.top,
|
||||
layer.display_frame.right,
|
||||
layer.display_frame.bottom);
|
||||
|
||||
auto width = layer.display_frame.right - layer.display_frame.left;
|
||||
auto height = layer.display_frame.bottom - layer.display_frame.top;
|
||||
|
||||
if (!window) {
|
||||
auto buffer = FrameBuffer::getFB()->getColorBufferFromHandle(layer.buffer_handle);
|
||||
|
||||
window = FrameBuffer::getFB()->createWindow(layer.display_frame.left,
|
||||
layer.display_frame.top,
|
||||
width, height);
|
||||
if (!window) {
|
||||
printf("Failed to create window for layer '%s'\n", layer.name.c_str());
|
||||
return;
|
||||
|
|
@ -97,7 +100,10 @@ void LayerManager::post_layer(const LayerInfo &layer) {
|
|||
}
|
||||
|
||||
printf("%s: window %p buffer %d\n", __func__, window, layer.buffer_handle);
|
||||
|
||||
FrameBuffer::getFB()->updateWindow(window,
|
||||
layer.display_frame.left,
|
||||
layer.display_frame.top,
|
||||
width, height);
|
||||
FrameBuffer::getFB()->post(window, layer.buffer_handle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class SubWindowHandler {
|
|||
public:
|
||||
virtual ~SubWindowHandler() { }
|
||||
virtual EGLNativeWindowType create_window(int x, int y, int width, int height) = 0;
|
||||
virtual void update_window(EGLNativeWindowType win, int x, int y, int width, int height) = 0;
|
||||
virtual void destroy_window(EGLNativeWindowType win) = 0;
|
||||
};
|
||||
|
||||
|
|
@ -55,6 +56,8 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
void updateSubWindow(EGLNativeWindowType win, int x, int y, int width, int height);
|
||||
|
||||
// Destroy a sub-window previously created through createSubWindow() above.
|
||||
void destroySubWindow(EGLNativeWindowType win);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,13 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
|||
return current_handler->create_window(x, y, width, height);
|
||||
}
|
||||
|
||||
void updateSubWindow(EGLNativeWindowType win, int x, int y, int width, int height) {
|
||||
if (!current_handler)
|
||||
return;
|
||||
|
||||
return current_handler->update_window(win, x, y, width, height);
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win) {
|
||||
if (!current_handler)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue