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:
@@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <array>
|
||||
|
||||
namespace Ui {
|
||||
class RendererStack;
|
||||
@@ -42,7 +43,7 @@ public:
|
||||
void switchRenderer(Renderer renderer);
|
||||
|
||||
signals:
|
||||
void blitToRenderer(const QImage& img, int, int, int, int, std::atomic_flag* in_use);
|
||||
void blitToRenderer(const std::unique_ptr<uint8_t>* img, int, int, int, int, std::atomic_flag* in_use);
|
||||
|
||||
public slots:
|
||||
void blit(int x, int y, int w, int h);
|
||||
@@ -59,11 +60,8 @@ private:
|
||||
|
||||
int x, y, w, h, sx, sy, sw, sh;
|
||||
|
||||
// always have a qimage available for writing, which is _probably_ unused
|
||||
// worst case - it will just get reallocated because it's refcounter is > 1
|
||||
// when calling bits();
|
||||
int currentBuf = 0;
|
||||
QVector<QImage> imagebufs;
|
||||
std::array<std::unique_ptr<uint8_t>, 2> imagebufs;
|
||||
|
||||
std::unique_ptr<QWidget> current;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user