mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
32 lines
712 B
C++
32 lines
712 B
C++
#include "QDUtils.h"
|
|
#include "MemoryManager.h"
|
|
#include "SharedTypes.h"
|
|
|
|
namespace PortabilityLayer
|
|
{
|
|
Region **QDUtils::CreateRegion(const Rect &rect)
|
|
{
|
|
PL_STATIC_ASSERT(sizeof(Region) == 10);
|
|
|
|
Region **rgnHandle = MemoryManager::GetInstance()->NewHandle<Region>();
|
|
if (!rgnHandle)
|
|
return nullptr;
|
|
|
|
Region ®ion = (**rgnHandle);
|
|
region.rect = rect;
|
|
region.size = sizeof(Region);
|
|
|
|
return rgnHandle;
|
|
}
|
|
|
|
void QDUtils::ResetRegionToRect(Region **regionHdl, const Rect &rect)
|
|
{
|
|
if (MemoryManager::GetInstance()->ResizeHandle(reinterpret_cast<MMHandleBlock*>(regionHdl), sizeof(Region)))
|
|
{
|
|
Region ®ion = **regionHdl;
|
|
region.size = sizeof(Region);
|
|
region.rect = rect;
|
|
}
|
|
}
|
|
}
|