Cleaning for opengl rendering prep.
This commit is contained in:
parent
402f381d10
commit
7c6a92f4ec
58 changed files with 570 additions and 533 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "Screen.h"
|
||||
#include "ImagePrimitives.h"
|
||||
#include "XcbGlWindowInterface.h"
|
||||
#include "DrawingContext.h"
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
|
@ -42,14 +43,16 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
|
|||
hwnd, /* window Id */
|
||||
xcb_screen->GetNativeScreen()->root, /* parent window */
|
||||
0, 0, /* x, y */
|
||||
window->GetWidth(), window->GetHeight(), /* width, height */
|
||||
window->getWidth(), window->getHeight(), /* width, height */
|
||||
10, /* border_width */
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
|
||||
xcb_screen->GetNativeScreen()->root_visual, /* visual */
|
||||
mask, values ); /* masks */
|
||||
|
||||
auto xcb_window = std::make_unique<XcbWindow>(window, hwnd, connection, xcbGlInterface);
|
||||
window->SetPlatformWindow(std::move(xcb_window));
|
||||
|
||||
const auto drawing_mode = xcbGlInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
|
||||
window->setPlatformWindow(std::move(xcb_window), drawing_mode);
|
||||
}
|
||||
|
||||
int XcbWindow::getHandle() const
|
||||
|
@ -67,54 +70,40 @@ void XcbWindow::show()
|
|||
map();
|
||||
}
|
||||
|
||||
void XcbWindow::paint(mt::Screen* screen)
|
||||
{
|
||||
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
|
||||
|
||||
if (mGlInterface)
|
||||
{
|
||||
paintHardware(xcb_screen);
|
||||
}
|
||||
else
|
||||
{
|
||||
paintSoftware(xcb_screen);
|
||||
}
|
||||
}
|
||||
|
||||
void XcbWindow::paintHardware(XcbScreen* screen)
|
||||
void XcbWindow::beforePaint(mt::Screen* screen)
|
||||
{
|
||||
if (mGlInterface)
|
||||
{
|
||||
mGlInterface->initialize(mHandle);
|
||||
mGlInterface->draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
|
||||
if (!mBackingImage)
|
||||
{
|
||||
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, xcb_screen->GetNativeScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XcbWindow::paintSoftware(XcbScreen* screen)
|
||||
void XcbWindow::afterPaint(mt::Screen* screen)
|
||||
{
|
||||
if (!mBackingImage)
|
||||
if (mGlInterface)
|
||||
{
|
||||
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, screen->GetNativeScreen());
|
||||
mGlInterface->afterPaint();
|
||||
}
|
||||
|
||||
auto backing_image = mWindow->getBackingImage();
|
||||
backing_image->initialize();
|
||||
//ImagePrimitives::drawCheckerboard(const_cast<unsigned char*>(backing_image->getDataPtr()), backing_image->getWidth(), backing_image->getHeight(), 0);
|
||||
|
||||
mBackingImage->update(mWindow, screen->GetNativeScreen(), mConnection, screen->GetGraphicsContext());
|
||||
|
||||
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, screen->GetGraphicsContext(), 0, 0 ,0 , 0, backing_image->getWidth(), backing_image->getHeight());
|
||||
/*
|
||||
for(const auto& layer : mWindow->GetLayers())
|
||||
else
|
||||
{
|
||||
XcbLayerInterface::AddLayer(mConnection, xcb_screen->GetNativeScreen(), mHandle, xcb_screen->GetGraphicsContext(), layer);
|
||||
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
|
||||
mBackingImage->update(mWindow, xcb_screen->GetNativeScreen(), mConnection, xcb_screen->GetGraphicsContext());
|
||||
|
||||
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, xcb_screen->GetGraphicsContext(), 0, 0 ,0 , 0, mWindow->getWidth(), mWindow->getHeight());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void XcbWindow::clear()
|
||||
{
|
||||
xcb_clear_area(mConnection, 1, mHandle, 0, 0, mWindow->GetWidth(), mWindow->GetHeight());
|
||||
xcb_clear_area(mConnection, 1, mHandle, 0, 0, mWindow->getWidth(), mWindow->getHeight());
|
||||
xcb_flush(mConnection);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue