CI / build (push) Successful in 48s
While the renderer process runs, the adapter makes the client's render targets itself and the renderer process draws frames into them: texture targets are drawn with like any texture, and a pixmap target's frame is read back through the channel into its Pixmap (protocol version 4: BeginFrame names its target, CreateRenderTarget, Channel::readSize and the -read event). Frames into render targets are drawn even while the window is hidden. The client uses pixmap targets for snapshots (outfit pictures, photos), checked to look right. The render target interfaces are declared from IMVU's vtables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#pragma once
|
|
// IMVU's images (Pixmap), through pixmap.dll's exported methods rather than depending on their layout (only their
|
|
// size, for making our own).
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
|
|
#include "t5de/imvu/types.hpp"
|
|
|
|
namespace t5de {
|
|
|
|
struct PixmapPixels {
|
|
std::uint32_t width;
|
|
std::uint32_t height;
|
|
std::uint32_t rowBytes;
|
|
std::uint32_t* pixels; // 0xAARRGGBB, rows rowBytes apart
|
|
};
|
|
|
|
// Null if pixmap.dll's methods can't be found.
|
|
std::optional<PixmapPixels> pixmap_pixels(const imvu::Pixmap& pixmap);
|
|
|
|
// A Pixmap of our own, made and destroyed by pixmap.dll.
|
|
class OwnedPixmap {
|
|
public:
|
|
// Width by height; invalid if pixmap.dll's methods can't be found.
|
|
OwnedPixmap(int width, int height);
|
|
OwnedPixmap(const OwnedPixmap&) = delete;
|
|
OwnedPixmap& operator=(const OwnedPixmap&) = delete;
|
|
~OwnedPixmap();
|
|
|
|
[[nodiscard]] bool valid() const { return valid_; }
|
|
[[nodiscard]] const imvu::Pixmap& get() const { return *reinterpret_cast<const imvu::Pixmap*>(storage_); }
|
|
|
|
// Constructs a copy in result (raw memory for a Pixmap, as for a Pixmap returned by value); an empty Pixmap if
|
|
// this one isn't valid.
|
|
imvu::Pixmap* copyTo(imvu::Pixmap* result) const;
|
|
|
|
private:
|
|
// sizeof(Pixmap) in pixmap.dll: its constructors set 7 fields.
|
|
alignas(4) std::byte storage_[28];
|
|
bool valid_ = false;
|
|
};
|
|
|
|
} // namespace t5de
|