From ba5e09f4d79d866181f04e1408b2279ba5347fad Mon Sep 17 00:00:00 2001
From: Lawrence Rust <lvr@softsystem.co.uk>
Date: Mon, 18 Jul 2011 20:17:45 +0200
Subject: [PATCH 2/9] freemheg: Support bitmaps with included content
Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
---
mythtv/libs/libmythfreemheg/Bitmap.cpp | 20 ++++++++++++--------
mythtv/libs/libmythfreemheg/Bitmap.h | 2 ++
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/mythtv/libs/libmythfreemheg/Bitmap.cpp b/mythtv/libs/libmythfreemheg/Bitmap.cpp
index 42c9df1..6e6bbc4 100644
|
a
|
b
|
void MHBitmap::ContentPreparation(MHEngine *engine)
|
| 127 | 127 | MHERROR("Bitmap must contain a content"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | | if (m_ContentType == IN_IncludedContent) // We can't handle included content at the moment. |
| 131 | | { |
| 132 | | MHERROR("Included content in bitmap is not implemented"); |
| 133 | | } |
| | 130 | if (m_ContentType == IN_IncludedContent) |
| | 131 | CreateContent(m_IncludedContent.Bytes(), m_IncludedContent.Size(), engine); |
| 134 | 132 | } |
| 135 | 133 | |
| 136 | 134 | // Decode the content. |
| … |
… |
void MHBitmap::ContentArrived(const unsigned char *data, int length, MHEngine *e
|
| 143 | 141 | return; // Shouldn't happen. |
| 144 | 142 | } |
| 145 | 143 | |
| | 144 | CreateContent(data, length, engine); |
| | 145 | // Now signal that the content is available. |
| | 146 | engine->EventTriggered(this, EventContentAvailable); |
| | 147 | } |
| | 148 | |
| | 149 | void MHBitmap::CreateContent(const unsigned char *data, int length, MHEngine *engine) |
| | 150 | { |
| | 151 | QRegion updateArea = GetVisibleArea(); // If there's any content already we have to redraw it. |
| | 152 | |
| 146 | 153 | int nCHook = m_nContentHook; |
| 147 | 154 | |
| 148 | 155 | if (nCHook == 0) |
| … |
… |
void MHBitmap::ContentArrived(const unsigned char *data, int length, MHEngine *e
|
| 165 | 172 | |
| 166 | 173 | else |
| 167 | 174 | { |
| | 175 | // 1,3,5,8 are reserved. 7= H.264 Intra Frame |
| 168 | 176 | MHERROR(QString("Unknown bitmap content hook %1").arg(nCHook)); |
| 169 | 177 | } |
| 170 | 178 | |
| 171 | 179 | updateArea += GetVisibleArea(); // Redraw this bitmap. |
| 172 | 180 | engine->Redraw(updateArea); // Mark for redrawing |
| 173 | | |
| 174 | | // Now signal that the content is available. |
| 175 | | engine->EventTriggered(this, EventContentAvailable); |
| 176 | 181 | } |
| 177 | 182 | |
| 178 | 183 | |
| 179 | | |
| 180 | 184 | // Set the transparency. |
| 181 | 185 | void MHBitmap::SetTransparency(int nTransPerCent, MHEngine *) |
| 182 | 186 | { |
diff --git a/mythtv/libs/libmythfreemheg/Bitmap.h b/mythtv/libs/libmythfreemheg/Bitmap.h
index 06d5f0b..e37c67d 100644
|
a
|
b
|
class MHBitmap : public MHVisible
|
| 69 | 69 | int m_nXDecodeOffset, m_nYDecodeOffset; |
| 70 | 70 | |
| 71 | 71 | MHBitmapDisplay *m_pContent; // Pointer to current image if any. |
| | 72 | |
| | 73 | void CreateContent(const unsigned char *p, int s, MHEngine *engine); |
| 72 | 74 | }; |
| 73 | 75 | |
| 74 | 76 | // Actions. |