Make written bytes observable
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenVulkano
|
||||
|
||||
Observable(const T& initValue) : object(initValue) {}
|
||||
|
||||
Observable(T&& initValue) : object(std::forward(initValue)) {}
|
||||
Observable(T&& initValue) : object(std::forward<T>(initValue)) {}
|
||||
|
||||
//TODO make this somehow only work for none string types to prevent issues?
|
||||
/*template<typename = std::enable_if_t<std::is_default_constructible_v<T>>>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "ArchiveBase.hpp"
|
||||
#include "ArchiveConfiguration.hpp"
|
||||
#include "IArchiveWriter.hpp"
|
||||
#include "Base/Observable.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace OpenVulkano
|
||||
friend ArchiveStreamBufferWriter;
|
||||
|
||||
ArchiveConfiguration m_archiveConfig;
|
||||
size_t m_bytesWritten = 0;
|
||||
Observable<size_t> m_bytesWritten { 0 };
|
||||
ArchiveOStream::ASBufferPtr m_asBuffer = nullptr;
|
||||
bool m_lastCompressed = true;
|
||||
std::function<bool(const FileDescription&)> m_shouldCompress;
|
||||
@@ -49,6 +50,8 @@ namespace OpenVulkano
|
||||
|
||||
void SetShouldCompressFunction(const std::function<bool(const FileDescription&)>& shouldComp) override { m_shouldCompress = shouldComp; }
|
||||
|
||||
decltype(m_bytesWritten)& GetBytesWrittenObservable() { return m_bytesWritten; }
|
||||
|
||||
private:
|
||||
void WriteHeader(const FileDescription& fileDescription);
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace OpenVulkano
|
||||
{
|
||||
if (srcLumRowPadding)
|
||||
{
|
||||
uint32_t srcOffset = 0, destOffset = 0;
|
||||
for(uint32_t y = 0, srcOffset = 0, destOffset = 0; y < sizeLumY; y++, srcOffset += sizeLumX + srcLumRowPadding, destOffset += sizeLumX)
|
||||
{
|
||||
memcpy(buffer.get() + destOffset, srcLum + srcOffset, sizeLumX);
|
||||
|
||||
Reference in New Issue
Block a user