2018-05-20 12:23:33 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-05-21 20:39:19 +00:00
|
|
|
#include "common/debug.h"
|
2018-05-20 12:23:33 +00:00
|
|
|
#include "common/file.h"
|
2018-05-22 21:55:44 +00:00
|
|
|
#include "common/system.h"
|
2018-05-23 17:52:41 +00:00
|
|
|
#include "common/ustr.h"
|
2022-09-23 14:33:24 +00:00
|
|
|
#include "common/unicode-bidi.h"
|
2018-05-20 12:23:33 +00:00
|
|
|
|
2018-05-22 19:16:26 +00:00
|
|
|
#include "graphics/fonts/ttf.h"
|
2018-05-22 21:55:44 +00:00
|
|
|
#include "graphics/font.h"
|
2018-05-22 19:16:26 +00:00
|
|
|
#include "graphics/fontman.h"
|
2018-05-22 21:55:44 +00:00
|
|
|
#include "graphics/surface.h"
|
2018-05-22 19:16:26 +00:00
|
|
|
|
2018-05-20 13:39:11 +00:00
|
|
|
#include "video/subtitles.h"
|
2022-09-26 10:44:37 +00:00
|
|
|
#include "common/config-manager.h"
|
2018-05-20 12:23:33 +00:00
|
|
|
|
|
|
|
namespace Video {
|
|
|
|
|
|
|
|
SRTParser::SRTParser() {
|
|
|
|
}
|
|
|
|
|
|
|
|
SRTParser::~SRTParser() {
|
2018-05-20 12:51:47 +00:00
|
|
|
cleanup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SRTParser::cleanup() {
|
|
|
|
for (Common::Array<SRTEntry *>::const_iterator item = _entries.begin(); item != _entries.end(); ++item)
|
|
|
|
delete *item;
|
2018-05-22 19:04:55 +00:00
|
|
|
|
|
|
|
_entries.clear();
|
2018-05-20 12:23:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool parseTime(const char **pptr, uint32 *res) {
|
|
|
|
int hours, mins, secs, msecs;
|
|
|
|
const char *ptr = *pptr;
|
|
|
|
|
|
|
|
hours = (*ptr++ - '0') * 10;
|
|
|
|
hours += *ptr++ - '0';
|
|
|
|
|
|
|
|
if (hours > 24 || hours < 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (*ptr++ != ':')
|
|
|
|
return false;
|
|
|
|
|
|
|
|
mins = (*ptr++ - '0') * 10;
|
|
|
|
mins += *ptr++ - '0';
|
|
|
|
|
|
|
|
if (mins > 60 || mins < 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (*ptr++ != ':')
|
|
|
|
return false;
|
|
|
|
|
|
|
|
secs = (*ptr++ - '0') * 10;
|
|
|
|
secs += *ptr++ - '0';
|
|
|
|
|
|
|
|
if (secs > 60 || secs < 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (*ptr++ != ',')
|
|
|
|
return false;
|
|
|
|
|
|
|
|
msecs = (*ptr++ - '0') * 100;
|
|
|
|
msecs += (*ptr++ - '0') * 10;
|
|
|
|
msecs += *ptr++ - '0';
|
|
|
|
|
|
|
|
if (msecs > 1000 || msecs < 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*res = 1000 * (3600 * hours + 60 * mins + secs) + msecs;
|
|
|
|
|
|
|
|
*pptr = ptr;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-05-20 13:09:21 +00:00
|
|
|
int SRTEntryComparator(const void *item1, const void *item2) {
|
2018-05-23 15:25:12 +00:00
|
|
|
const SRTEntry *l = *(const SRTEntry * const *)item1;
|
|
|
|
const SRTEntry *r = *(const SRTEntry * const *)item2;
|
2018-05-20 13:09:21 +00:00
|
|
|
|
|
|
|
return l->start - r->start;
|
|
|
|
}
|
2018-05-20 12:23:33 +00:00
|
|
|
|
2018-05-20 13:34:50 +00:00
|
|
|
int SRTEntryComparatorBSearch(const void *item1, const void *item2) {
|
2018-05-23 15:25:12 +00:00
|
|
|
const SRTEntry *k = *(const SRTEntry * const *)item1;
|
|
|
|
const SRTEntry *i = *(const SRTEntry * const *)item2;
|
2018-05-20 13:34:50 +00:00
|
|
|
|
|
|
|
if (k->start < i->start)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (k->start > i->end - 1)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-31 11:36:53 +00:00
|
|
|
bool SRTParser::parseFile(const Common::Path &fname) {
|
2018-05-20 12:23:33 +00:00
|
|
|
Common::File f;
|
|
|
|
|
2018-05-21 20:39:19 +00:00
|
|
|
cleanup();
|
|
|
|
|
2022-09-26 10:44:37 +00:00
|
|
|
if (!f.open(fname)) {
|
2018-05-20 12:23:33 +00:00
|
|
|
return false;
|
2022-09-26 10:44:37 +00:00
|
|
|
}
|
2018-05-20 12:23:33 +00:00
|
|
|
|
|
|
|
byte buf[3];
|
|
|
|
f.read(buf, 3);
|
|
|
|
|
|
|
|
int line = 0;
|
|
|
|
|
|
|
|
// Skip UTF header if present
|
|
|
|
if (buf[0] != 0xef || buf[1] != 0xbb || buf[2] != 0xbf)
|
|
|
|
f.seek(0);
|
|
|
|
|
|
|
|
while (!f.eos()) {
|
|
|
|
Common::String sseq, stimespec, stmp, text;
|
|
|
|
|
|
|
|
sseq = f.readLine(); line++;
|
|
|
|
stimespec = f.readLine(); line++;
|
|
|
|
text = f.readLine(); line++;
|
|
|
|
|
|
|
|
if (sseq.empty()) {
|
|
|
|
if (f.eos()) {
|
|
|
|
// Normal end of stream
|
|
|
|
break;
|
|
|
|
} else {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (spec): %s at line %d", fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stimespec.empty() || text.empty()) {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (spec): %s at line %d", fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read all multiline text
|
|
|
|
while (!f.eos()) {
|
|
|
|
stmp = f.readLine(); line++;
|
|
|
|
|
|
|
|
if (!stmp.empty()) {
|
|
|
|
text += '\n';
|
|
|
|
text += stmp;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 seq = atol(sseq.c_str());
|
|
|
|
if (seq == 0) {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (seq): %s at line %d", fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 00:20:41,150 --> 00:20:45,109
|
|
|
|
if (stimespec.size() < 29) {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (timespec length %d): %s at line %d", stimespec.size(), fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ptr = stimespec.c_str();
|
|
|
|
uint32 start, end;
|
|
|
|
if (!parseTime(&ptr, &start)) {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (timespec start): %s at line %d", fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (*ptr == ' ')
|
|
|
|
ptr++;
|
|
|
|
|
|
|
|
while (*ptr == '-')
|
|
|
|
ptr++;
|
|
|
|
|
|
|
|
if (*ptr != '>') {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (timespec middle ('%c')): %s at line %d", *ptr, fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr++;
|
|
|
|
|
|
|
|
while (*ptr == ' ')
|
|
|
|
ptr++;
|
|
|
|
|
|
|
|
if (!parseTime(&ptr, &end)) {
|
2023-10-31 11:36:53 +00:00
|
|
|
warning("Bad SRT file format (timespec end): %s at line %d", fname.toString().c_str(), line);
|
2018-05-20 12:23:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-05-20 12:51:47 +00:00
|
|
|
_entries.push_back(new SRTEntry(seq, start, end, text));
|
2018-05-20 12:23:33 +00:00
|
|
|
}
|
|
|
|
|
2018-05-20 13:09:21 +00:00
|
|
|
qsort(_entries.data(), _entries.size(), sizeof(SRTEntry *), &SRTEntryComparator);
|
2018-05-20 12:51:47 +00:00
|
|
|
|
2018-05-22 19:04:55 +00:00
|
|
|
debug(6, "SRTParser: Loaded %d entries", _entries.size());
|
|
|
|
|
2018-05-20 12:23:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-07-07 09:01:36 +00:00
|
|
|
Common::String SRTParser::getSubtitle(uint32 timestamp) const {
|
2018-05-20 13:09:21 +00:00
|
|
|
SRTEntry test(0, timestamp, 0, "");
|
2018-05-20 13:34:50 +00:00
|
|
|
SRTEntry *testptr = &test;
|
2018-05-20 13:09:21 +00:00
|
|
|
|
2018-05-20 13:34:50 +00:00
|
|
|
const SRTEntry **entry = (const SRTEntry **)bsearch(&testptr, _entries.data(), _entries.size(), sizeof(SRTEntry *), &SRTEntryComparatorBSearch);
|
2018-05-20 13:09:21 +00:00
|
|
|
|
2018-05-20 13:34:50 +00:00
|
|
|
if (entry == NULL)
|
|
|
|
return "";
|
2018-05-20 13:09:21 +00:00
|
|
|
|
2018-05-20 13:34:50 +00:00
|
|
|
return (*entry)->text;
|
2018-05-20 13:09:21 +00:00
|
|
|
}
|
|
|
|
|
2018-05-24 19:53:48 +00:00
|
|
|
#define SHADOW 1
|
2018-05-24 19:37:40 +00:00
|
|
|
|
2022-11-18 23:36:22 +00:00
|
|
|
Subtitles::Subtitles() : _loaded(false), _font(nullptr), _hPad(0), _vPad(0), _overlayHasAlpha(true),
|
|
|
|
_lastOverlayWidth(-1), _lastOverlayHeight(-1) {
|
2018-05-22 21:55:44 +00:00
|
|
|
_surface = new Graphics::Surface();
|
2022-09-26 10:44:37 +00:00
|
|
|
_subtitleDev = ConfMan.getBool("subtitle_dev");
|
2018-05-21 20:39:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Subtitles::~Subtitles() {
|
2018-05-22 21:55:44 +00:00
|
|
|
delete _surface;
|
2018-05-21 20:39:19 +00:00
|
|
|
}
|
|
|
|
|
2018-05-23 15:25:12 +00:00
|
|
|
void Subtitles::setFont(const char *fontname, int height) {
|
2018-05-22 19:16:26 +00:00
|
|
|
Common::File file;
|
|
|
|
|
|
|
|
_fontHeight = height;
|
|
|
|
|
2022-09-23 22:42:28 +00:00
|
|
|
#ifdef USE_FREETYPE2
|
2018-05-23 15:25:12 +00:00
|
|
|
if (file.open(fontname)) {
|
2018-05-24 19:53:48 +00:00
|
|
|
_font = Graphics::loadTTFFont(file, _fontHeight, Graphics::kTTFSizeModeCharacter, 96);
|
2018-05-22 19:16:26 +00:00
|
|
|
}
|
2023-01-25 21:48:36 +00:00
|
|
|
|
|
|
|
if (!_font) {
|
|
|
|
_font = Graphics::loadTTFFontFromArchive(fontname, _fontHeight, Graphics::kTTFSizeModeCharacter, 96);
|
|
|
|
}
|
2022-09-23 22:42:28 +00:00
|
|
|
#endif
|
2018-05-22 19:16:26 +00:00
|
|
|
|
2018-05-23 15:25:12 +00:00
|
|
|
if (!_font) {
|
2023-01-25 21:48:36 +00:00
|
|
|
debug(1, "Cannot load font %s directly", fontname);
|
2018-05-22 19:16:26 +00:00
|
|
|
_font = FontMan.getFontByName(fontname);
|
2018-05-23 15:25:12 +00:00
|
|
|
}
|
2018-05-22 19:16:26 +00:00
|
|
|
|
|
|
|
if (!_font) {
|
|
|
|
warning("Cannot load font %s", fontname);
|
|
|
|
|
|
|
|
_font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-31 11:36:53 +00:00
|
|
|
void Subtitles::loadSRTFile(const Common::Path &fname) {
|
|
|
|
debug(1, "loadSRTFile('%s')", fname.toString().c_str());
|
2018-05-21 20:39:19 +00:00
|
|
|
|
2022-11-11 11:41:26 +00:00
|
|
|
if (_subtitleDev) {
|
|
|
|
_fname = fname;
|
|
|
|
}
|
2018-05-21 20:39:19 +00:00
|
|
|
_loaded = _srtParser.parseFile(fname);
|
|
|
|
}
|
|
|
|
|
2018-05-22 21:55:44 +00:00
|
|
|
void Subtitles::setBBox(const Common::Rect bbox) {
|
2022-11-18 23:36:22 +00:00
|
|
|
_requestedBBox = bbox;
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
|
|
|
|
_overlayHasAlpha = overlayFormat.aBits() != 0;
|
2022-11-18 23:36:22 +00:00
|
|
|
_surface->create(_requestedBBox.width() + SHADOW * 2, _requestedBBox.height() + SHADOW * 2, overlayFormat);
|
|
|
|
// Force recalculation of real bounding box
|
|
|
|
_lastOverlayWidth = -1;
|
|
|
|
_lastOverlayHeight = -1;
|
2018-05-22 21:55:44 +00:00
|
|
|
}
|
|
|
|
|
2018-05-23 15:25:12 +00:00
|
|
|
void Subtitles::setColor(byte r, byte g, byte b) {
|
|
|
|
_color = _surface->format.ARGBToColor(255, r, g, b);
|
2018-05-24 19:37:40 +00:00
|
|
|
_blackColor = _surface->format.ARGBToColor(255, 0, 0, 0);
|
2018-05-23 15:25:12 +00:00
|
|
|
_transparentColor = _surface->format.ARGBToColor(0, 0, 0, 0);
|
|
|
|
}
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-09-22 23:00:59 +00:00
|
|
|
void Subtitles::setPadding(uint16 horizontal, uint16 vertical) {
|
|
|
|
_hPad = horizontal;
|
|
|
|
_vPad = vertical;
|
|
|
|
}
|
|
|
|
|
2023-07-07 09:01:36 +00:00
|
|
|
bool Subtitles::drawSubtitle(uint32 timestamp, bool force) const {
|
2022-11-11 11:41:26 +00:00
|
|
|
Common::String subtitle;
|
|
|
|
if (_loaded) {
|
|
|
|
subtitle = _srtParser.getSubtitle(timestamp);
|
|
|
|
} else if (_subtitleDev) {
|
2023-10-31 11:36:53 +00:00
|
|
|
subtitle = _fname.toString('/');
|
2022-09-26 10:44:37 +00:00
|
|
|
uint32 hours, mins, secs, msecs;
|
|
|
|
secs = timestamp / 1000;
|
|
|
|
hours = secs / 3600;
|
|
|
|
mins = (secs / 60) % 60;
|
|
|
|
secs %= 60;
|
|
|
|
msecs = timestamp % 1000;
|
2022-11-11 11:41:26 +00:00
|
|
|
subtitle += " " + Common::String::format("%02u:%02u:%02u,%03u", hours, mins, secs, msecs);
|
|
|
|
} else {
|
|
|
|
return false;
|
2022-09-26 10:44:37 +00:00
|
|
|
}
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-11-18 23:36:22 +00:00
|
|
|
int16 width = g_system->getOverlayWidth(),
|
|
|
|
height = g_system->getOverlayHeight();
|
|
|
|
|
|
|
|
if (width != _lastOverlayWidth ||
|
|
|
|
height != _lastOverlayHeight) {
|
|
|
|
_lastOverlayWidth = width;
|
|
|
|
_lastOverlayHeight = height;
|
|
|
|
|
|
|
|
// Recalculate the real bounding box to use
|
|
|
|
_realBBox = _requestedBBox;
|
|
|
|
|
|
|
|
if (_realBBox.bottom > height) {
|
|
|
|
// First try to move the bounding box
|
|
|
|
_realBBox.top -= _realBBox.bottom - height;
|
|
|
|
_realBBox.bottom = height;
|
|
|
|
}
|
|
|
|
if (_realBBox.top < 0) {
|
|
|
|
// Not enough space
|
|
|
|
_realBBox.top = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_realBBox.right > width) {
|
|
|
|
// First try to move the bounding box
|
|
|
|
_realBBox.left -= _realBBox.right - width;
|
|
|
|
_realBBox.right = width;
|
|
|
|
}
|
|
|
|
if (_realBBox.left < 0) {
|
|
|
|
// Not enough space
|
|
|
|
_realBBox.left = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
force = true;
|
|
|
|
}
|
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
if (!force && _overlayHasAlpha && subtitle == _subtitle)
|
|
|
|
return false;
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
if (force || subtitle != _subtitle) {
|
|
|
|
debug(1, "%d: %s", timestamp, subtitle.c_str());
|
2018-05-23 15:25:12 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
_subtitle = subtitle;
|
|
|
|
renderSubtitle();
|
|
|
|
}
|
2018-05-23 15:25:12 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
if (_overlayHasAlpha) {
|
|
|
|
// When we have alpha, draw the whole surface without thinking it more
|
2022-11-18 23:36:22 +00:00
|
|
|
g_system->copyRectToOverlay(_surface->getPixels(), _surface->pitch, _realBBox.left, _realBBox.top, _realBBox.width(), _realBBox.height());
|
2022-11-11 10:40:10 +00:00
|
|
|
} else {
|
|
|
|
// When overlay doesn't have alpha, showing it hides the underlying game screen
|
|
|
|
// We force a copy of the game screen to the overlay by clearing it
|
|
|
|
// We then draw the smallest possible surface to minimize black rectangle behind text
|
|
|
|
g_system->clearOverlay();
|
|
|
|
g_system->copyRectToOverlay((byte *)_surface->getPixels() + _drawRect.top * _surface->pitch + _drawRect.left * _surface->format.bytesPerPixel, _surface->pitch,
|
2022-11-18 23:36:22 +00:00
|
|
|
_realBBox.left + _drawRect.left, _realBBox.top + _drawRect.top, _drawRect.width(), _drawRect.height());
|
2022-11-11 10:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-07-07 09:01:36 +00:00
|
|
|
void Subtitles::renderSubtitle() const {
|
2022-11-11 10:40:10 +00:00
|
|
|
_surface->fillRect(Common::Rect(0, 0, _surface->w, _surface->h), _transparentColor);
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2018-05-23 17:52:41 +00:00
|
|
|
Common::Array<Common::U32String> lines;
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-11-18 23:36:22 +00:00
|
|
|
_font->wordWrapText(convertUtf8ToUtf32(_subtitle), _realBBox.width(), lines);
|
2022-11-11 10:40:10 +00:00
|
|
|
|
|
|
|
if (lines.empty()) {
|
|
|
|
_drawRect.left = 0;
|
|
|
|
_drawRect.top = 0;
|
|
|
|
_drawRect.right = 0;
|
|
|
|
_drawRect.bottom = 0;
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-09-22 23:00:59 +00:00
|
|
|
return;
|
2022-11-11 10:40:10 +00:00
|
|
|
}
|
2022-09-22 23:00:59 +00:00
|
|
|
|
|
|
|
int height = _vPad;
|
|
|
|
|
|
|
|
int width = 0;
|
|
|
|
for (uint i = 0; i < lines.size(); i++)
|
|
|
|
width = MAX(_font->getStringWidth(lines[i]), width);
|
2022-11-18 23:36:22 +00:00
|
|
|
width = MIN(width + 2 * _hPad, (int)_realBBox.width());
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-11-18 23:36:22 +00:00
|
|
|
int originX = (_realBBox.width() - width) / 2;
|
2022-11-11 10:40:10 +00:00
|
|
|
|
2022-09-22 23:00:59 +00:00
|
|
|
for (uint i = 0; i < lines.size(); i++) {
|
2022-09-23 14:33:24 +00:00
|
|
|
Common::U32String line = convertBiDiU32String(lines[i]).visual;
|
2018-05-24 19:37:40 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
_font->drawString(_surface, line, originX, height, width, _blackColor, Graphics::kTextAlignCenter);
|
|
|
|
_font->drawString(_surface, line, originX + SHADOW * 2, height, width, _blackColor, Graphics::kTextAlignCenter);
|
|
|
|
_font->drawString(_surface, line, originX, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
|
|
|
|
_font->drawString(_surface, line, originX + SHADOW * 2, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
|
2022-09-23 14:33:24 +00:00
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
_font->drawString(_surface, line, originX + SHADOW, height + SHADOW, width, _color, Graphics::kTextAlignCenter);
|
2018-05-22 21:55:44 +00:00
|
|
|
|
2022-09-22 23:00:59 +00:00
|
|
|
height += _font->getFontHeight();
|
2018-05-23 15:25:12 +00:00
|
|
|
|
2022-11-18 23:36:22 +00:00
|
|
|
if (height + _vPad > _realBBox.bottom)
|
2018-05-23 15:25:12 +00:00
|
|
|
break;
|
2018-05-22 21:55:44 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 23:00:59 +00:00
|
|
|
height += _vPad;
|
|
|
|
|
2022-11-11 10:40:10 +00:00
|
|
|
_drawRect.left = originX;
|
|
|
|
_drawRect.top = 0;
|
|
|
|
_drawRect.setWidth(width + SHADOW * 2);
|
|
|
|
_drawRect.setHeight(height + SHADOW * 2);
|
2018-05-22 21:55:44 +00:00
|
|
|
}
|
|
|
|
|
2018-05-20 12:23:33 +00:00
|
|
|
} // End of namespace Video
|