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