Blitting improvements

* Use a single QImage copy for actual drawing
* Use std::array and std::unique_ptr for image buffers
* Signal immediately after copying the buffer to internal image
This commit is contained in:
Cacodemon345
2021-12-21 16:38:13 +06:00
parent bbb0b38d31
commit 67a0f7a85f
9 changed files with 17 additions and 25 deletions

View File

@@ -35,11 +35,11 @@ void HardwareRenderer::setRenderType(RenderType type) {
setFormat(format);
}
void HardwareRenderer::onBlit(const QImage& img, int x, int y, int w, int h, std::atomic_flag* in_use) {
image = img;
void HardwareRenderer::onBlit(const std::unique_ptr<uint8_t>* img, int x, int y, int w, int h, std::atomic_flag* in_use) {
memcpy(image.bits(), img->get(), 2048 * 2048 * 4);
in_use->clear();
source.setRect(x, y, w, h);
update();
in_use->clear();
}
void HardwareRenderer::resizeEvent(QResizeEvent *event) {