VIDEO: Allow drawing subtitles in const methods

This commit is contained in:
BLooperZ 2023-07-07 12:01:36 +03:00 committed by Eugene Sandulenko
parent b70519b3c7
commit 5ff6bd08cb
2 changed files with 10 additions and 10 deletions

View File

@ -216,7 +216,7 @@ bool SRTParser::parseFile(const char *fname) {
return true;
}
Common::String SRTParser::getSubtitle(uint32 timestamp) {
Common::String SRTParser::getSubtitle(uint32 timestamp) const {
SRTEntry test(0, timestamp, 0, "");
SRTEntry *testptr = &test;
@ -299,7 +299,7 @@ void Subtitles::setPadding(uint16 horizontal, uint16 vertical) {
_vPad = vertical;
}
bool Subtitles::drawSubtitle(uint32 timestamp, bool force) {
bool Subtitles::drawSubtitle(uint32 timestamp, bool force) const {
Common::String subtitle;
if (_loaded) {
subtitle = _srtParser.getSubtitle(timestamp);
@ -375,7 +375,7 @@ bool Subtitles::drawSubtitle(uint32 timestamp, bool force) {
return true;
}
void Subtitles::renderSubtitle() {
void Subtitles::renderSubtitle() const {
_surface->fillRect(Common::Rect(0, 0, _surface->w, _surface->h), _transparentColor);
Common::Array<Common::U32String> lines;

View File

@ -52,7 +52,7 @@ public:
void cleanup();
bool parseFile(const char *fname);
Common::String getSubtitle(uint32 timestamp);
Common::String getSubtitle(uint32 timestamp) const;
private:
Common::Array<SRTEntry *> _entries;
@ -69,11 +69,11 @@ public:
void setBBox(const Common::Rect bbox);
void setColor(byte r, byte g, byte b);
void setPadding(uint16 horizontal, uint16 vertical);
bool drawSubtitle(uint32 timestamp, bool force = false);
bool drawSubtitle(uint32 timestamp, bool force = false) const;
bool isLoaded() const { return _loaded || _subtitleDev; }
private:
void renderSubtitle();
void renderSubtitle() const;
SRTParser _srtParser;
bool _loaded;
@ -85,13 +85,13 @@ private:
Graphics::Surface *_surface;
Common::Rect _drawRect;
mutable Common::Rect _drawRect;
Common::Rect _requestedBBox;
Common::Rect _realBBox;
int16 _lastOverlayWidth, _lastOverlayHeight;
mutable Common::Rect _realBBox;
mutable int16 _lastOverlayWidth, _lastOverlayHeight;
Common::String _fname;
Common::String _subtitle;
mutable Common::String _subtitle;
uint32 _color;
uint32 _blackColor;
uint32 _transparentColor;