36 lines
1.2 KiB
C
Raw Normal View History

2025-12-03 22:00:29 +11:00
#pragma once
#include <memory>
2025-12-03 22:00:29 +11:00
#include "Epub.h"
class Page;
class GfxRenderer;
2025-12-03 22:00:29 +11:00
class Section {
std::shared_ptr<Epub> epub;
2025-12-03 22:00:29 +11:00
const int spineIndex;
GfxRenderer& renderer;
2025-12-03 22:00:29 +11:00
std::string cachePath;
void writeCacheMetadata(int fontId, float lineCompression, int marginTop, int marginRight, int marginBottom,
int marginLeft, bool extraParagraphSpacing) const;
void onPageComplete(std::unique_ptr<Page> page);
2025-12-03 22:00:29 +11:00
public:
int pageCount = 0;
int currentPage = 0;
explicit Section(const std::shared_ptr<Epub>& epub, const int spineIndex, GfxRenderer& renderer)
2025-12-03 22:00:29 +11:00
: epub(epub), spineIndex(spineIndex), renderer(renderer) {
cachePath = epub->getCachePath() + "/" + std::to_string(spineIndex);
}
~Section() = default;
bool loadCacheMetadata(int fontId, float lineCompression, int marginTop, int marginRight, int marginBottom,
int marginLeft, bool extraParagraphSpacing);
2025-12-03 22:00:29 +11:00
void setupCacheDir() const;
bool clearCache() const;
bool persistPageDataToSD(int fontId, float lineCompression, int marginTop, int marginRight, int marginBottom,
int marginLeft, bool extraParagraphSpacing);
std::unique_ptr<Page> loadPageFromSD() const;
2025-12-03 22:00:29 +11:00
};