[perf] accelerate Kitty and ANSI rendering

This commit is contained in:
dijunkun
2026-10-31 00:36:27 +08:00
parent cd5e1c95d7
commit e2cd4959c6
12 changed files with 760 additions and 112 deletions
+16
View File
@@ -10,6 +10,7 @@
#include <atomic>
#include <csignal>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
@@ -34,6 +35,21 @@ struct TerminalSize {
};
TerminalSize GetTerminalSize(int fd);
// One private, uniquely named pixel buffer. Keep it alive until the terminal
// acknowledges reading it; Reset also unlinks objects the terminal left behind.
class SharedImage {
public:
SharedImage();
~SharedImage();
bool Assign(const uint8_t *data, size_t size);
void Reset();
const std::string &Name() const;
private:
struct State;
std::unique_ptr<State> state_;
};
class NonBlocking {
public:
explicit NonBlocking(int fd, bool output = false);