mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 07:37:37 +03:00
Some checks are pending
CI / build (push) Waiting to run
## Summary * Update EpdFontFamily::Style to be u8 instead of u32 (saving 3 bytes per word) * Update layout width/height to be u16 from int * Update page element count to be u16 from u32 * Update text block element count to be u16 from u32 * Bumped section bin version to version 8
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#pragma once
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
#include "Epub.h"
|
|
|
|
class Page;
|
|
class GfxRenderer;
|
|
|
|
class Section {
|
|
std::shared_ptr<Epub> epub;
|
|
const int spineIndex;
|
|
GfxRenderer& renderer;
|
|
std::string filePath;
|
|
FsFile file;
|
|
|
|
void writeSectionFileHeader(int fontId, float lineCompression, bool extraParagraphSpacing, uint16_t viewportWidth,
|
|
uint16_t viewportHeight);
|
|
uint32_t onPageComplete(std::unique_ptr<Page> page);
|
|
|
|
public:
|
|
uint16_t pageCount = 0;
|
|
int currentPage = 0;
|
|
|
|
explicit Section(const std::shared_ptr<Epub>& epub, const int spineIndex, GfxRenderer& renderer)
|
|
: epub(epub),
|
|
spineIndex(spineIndex),
|
|
renderer(renderer),
|
|
filePath(epub->getCachePath() + "/sections/" + std::to_string(spineIndex) + ".bin") {}
|
|
~Section() = default;
|
|
bool loadSectionFile(int fontId, float lineCompression, bool extraParagraphSpacing, uint16_t viewportWidth,
|
|
uint16_t viewportHeight);
|
|
bool clearCache() const;
|
|
bool createSectionFile(int fontId, float lineCompression, bool extraParagraphSpacing, uint16_t viewportWidth,
|
|
uint16_t viewportHeight, const std::function<void()>& progressSetupFn = nullptr,
|
|
const std::function<void(int)>& progressFn = nullptr);
|
|
std::unique_ptr<Page> loadPageFromSectionFile();
|
|
};
|