diff options
author | Underground78 <underground78@users.sourceforge.net> | 2014-11-11 02:56:42 +0300 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2014-11-11 23:55:39 +0300 |
commit | 9a5231d9f6849dea0c12b58cc14f7c3aa7bcdf66 (patch) | |
tree | 29fe47853ae8330a75b5b7bb77715a85159efff1 /src/Subtitles | |
parent | 76e410ec885d6ec7a51d7e9da0accdf6ed13ec0e (diff) |
Text subtitles: Don't fail too hard if an opaque box cannot be allocated.
Properly catch the memory allocation error and continue painting since a missing opaque box is not critical.
Diffstat (limited to 'src/Subtitles')
-rw-r--r-- | src/Subtitles/RTS.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index dad2b2975..df74cce0d 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -123,17 +123,13 @@ void CWord::Paint(const CPoint& p, const CPoint& org) if (m_renderingCaches.overlayCache.Lookup(overlayKey, m_pOverlayData)) {
m_fDrawn = m_renderingCaches.outlineCache.Lookup(overlayKey, m_pOutlineData);
if (m_style.borderStyle == 1) {
- if (!CreateOpaqueBox()) {
- return;
- }
+ VERIFY(CreateOpaqueBox());
}
} else {
if (!m_fDrawn) {
if (m_renderingCaches.outlineCache.Lookup(overlayKey, m_pOutlineData)) {
if (m_style.borderStyle == 1) {
- if (!CreateOpaqueBox()) {
- return;
- }
+ VERIFY(CreateOpaqueBox());
}
} else {
if (!CreatePath()) {
@@ -163,9 +159,7 @@ void CWord::Paint(const CPoint& p, const CPoint& org) return;
}
} else if (m_style.borderStyle == 1) {
- if (!CreateOpaqueBox()) {
- return;
- }
+ VERIFY(CreateOpaqueBox());
}
m_renderingCaches.outlineCache.SetAt(overlayKey, m_pOutlineData);
@@ -224,7 +218,12 @@ bool CWord::CreateOpaqueBox() (m_width + w + 4) / 8, (m_ascent + m_descent + h + 4) / 8,
-(w + 4) / 8, (m_ascent + m_descent + h + 4) / 8);
- m_pOpaqueBox = DEBUG_NEW CPolygon(style, str, 0, 0, 0, 1.0, 1.0, 0, m_renderingCaches);
+ try {
+ m_pOpaqueBox = DEBUG_NEW CPolygon(style, str, 0, 0, 0, 1.0, 1.0, 0, m_renderingCaches);
+ } catch (CMemoryException* e) {
+ e->Delete();
+ m_pOpaqueBox = nullptr;
+ }
return !!m_pOpaqueBox;
}
|