diff --git a/video/subtitles.cpp b/video/subtitles.cpp index 91007387974..19b12075891 100644 --- a/video/subtitles.cpp +++ b/video/subtitles.cpp @@ -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 lines; diff --git a/video/subtitles.h b/video/subtitles.h index f649921567b..0060e610fd1 100644 --- a/video/subtitles.h +++ b/video/subtitles.h @@ -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 _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;