MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / CreateWindowBuffer

Method CreateWindowBuffer

System/LemonWM/wm.cpp:83–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83int64_t WMInstance::CreateWindowBuffer(int width, int height, WindowBuffer** buffer){
84 size_t windowBufferSize = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F)) + ((width * height * 4 + 0x1F) & (~0x1F) /* Round up to 32 bytes */) * 2;
85
86 int64_t windowBufferKey = Lemon::CreateSharedMemory(windowBufferSize, SMEM_FLAGS_SHARED);
87 if(windowBufferKey <= 0){
88 printf("[LemonWM] Warning: Error %ld obtaining shared memory for window\n", -windowBufferKey);
89 return windowBufferKey;
90 }
91
92 WindowBuffer* windowBufferInfo = (WindowBuffer*)Lemon::MapSharedMemory(windowBufferKey);
93 windowBufferInfo->currentBuffer = 0;
94 windowBufferInfo->buffer1Offset = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F));
95 windowBufferInfo->buffer2Offset = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F)) + ((width * height * 4 + 0x1F) & (~0x1F) /* Round up to 32 bytes*/);
96
97 *buffer = windowBufferInfo;
98
99 return windowBufferKey;
100}
101
102void WMInstance::Poll(){
103 Lemon::Message m;

Callers

nothing calls this directly

Calls 2

CreateSharedMemoryFunction · 0.50
MapSharedMemoryFunction · 0.50

Tested by

no test coverage detected