Lightgraph
C++17 light-graph engine API reference
Loading...
Searching...
No Matches
drawing_session.hpp
Go to the documentation of this file.
1#ifndef LIGHTGRAPH_INTEGRATION_DRAWING_SESSION_HPP
2#define LIGHTGRAPH_INTEGRATION_DRAWING_SESSION_HPP
3
4#pragma once
5#include "drawing.hpp"
7constexpr std::size_t DRAWING_IMAGE_CHUNK_BYTES = 768;
8
9// Serialized by the same owner/lock as its runtime. Owns only transfer metadata;
10// image bytes remain in the runtime's two image slots.
12 public:
13 DrawingSession() = default;
14 explicit DrawingSession(DrawingRuntime& runtime) { bind(runtime); }
18 void bind(DrawingRuntime& runtime);
20 DrawingResult imageChunk(std::uint64_t producer, std::uint32_t nowMillis, std::int32_t frameId,
21 std::uint8_t width, std::uint8_t height, std::uint8_t chunkIndex,
22 const std::uint8_t* bytes, std::size_t size,
23 DrawingHandle* ready = nullptr);
24 DrawingResult imageCommit(std::uint64_t producer, std::uint32_t nowMillis, std::int32_t frameId,
25 DrawingHandle* ready = nullptr);
26 void expireTransfer(std::uint32_t nowMillis);
27
28 private:
29 void detach();
30 void synchronize();
31 void reject(const char* reason);
32 DrawingResult present(DrawingHandle* ready);
33 DrawingRuntime* runtime_ = nullptr;
34 DrawingRuntime::Lifetime lifetime_;
35 std::array<char, 17> generation_{};
36 DrawingRuntime::ImageLease lease_{};
37 bool assembling_ = false;
38 bool queued_ = false;
39 bool poisoned_ = false;
40 bool committed_ = false;
41 std::uint64_t producer_ = 0;
42 std::uint32_t started_ = 0;
43 std::uint8_t mask_ = 0;
44 std::uint32_t dropped_ = 0;
45};
46} // namespace lightgraph::integration
47
48#endif // LIGHTGRAPH_INTEGRATION_DRAWING_SESSION_HPP
DrawingSession & operator=(const DrawingSession &)=delete
DrawingResult imageChunk(std::uint64_t producer, std::uint32_t nowMillis, std::int32_t frameId, std::uint8_t width, std::uint8_t height, std::uint8_t chunkIndex, const std::uint8_t *bytes, std::size_t size, DrawingHandle *ready=nullptr)
DrawingResult imageCommit(std::uint64_t producer, std::uint32_t nowMillis, std::int32_t frameId, DrawingHandle *ready=nullptr)
void expireTransfer(std::uint32_t nowMillis)
DrawingSession(const DrawingSession &)=delete
void bind(DrawingRuntime &runtime)
constexpr std::size_t DRAWING_IMAGE_CHUNK_BYTES