Skip to content

Commit

Permalink
freemheg: Support bitmaps with included content
Browse files Browse the repository at this point in the history
Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
Lawrence Rust authored and stuartm committed Jul 6, 2012
1 parent e4f3d08 commit d94970b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 12 additions & 8 deletions mythtv/libs/libmythfreemheg/Bitmap.cpp
Expand Up @@ -127,10 +127,8 @@ void MHBitmap::ContentPreparation(MHEngine *engine)
MHERROR("Bitmap must contain a content");
}

if (m_ContentType == IN_IncludedContent) // We can't handle included content at the moment.
{
MHERROR("Included content in bitmap is not implemented");
}
if (m_ContentType == IN_IncludedContent)
CreateContent(m_IncludedContent.Bytes(), m_IncludedContent.Size(), engine);
}

// Decode the content.
Expand All @@ -143,6 +141,15 @@ void MHBitmap::ContentArrived(const unsigned char *data, int length, MHEngine *e
return; // Shouldn't happen.
}

CreateContent(data, length, engine);
// Now signal that the content is available.
engine->EventTriggered(this, EventContentAvailable);
}

void MHBitmap::CreateContent(const unsigned char *data, int length, MHEngine *engine)
{
QRegion updateArea = GetVisibleArea(); // If there's any content already we have to redraw it.

int nCHook = m_nContentHook;

if (nCHook == 0)
Expand All @@ -165,18 +172,15 @@ void MHBitmap::ContentArrived(const unsigned char *data, int length, MHEngine *e

else
{
// 1,3,5,8 are reserved. 7= H.264 Intra Frame
MHERROR(QString("Unknown bitmap content hook %1").arg(nCHook));
}

updateArea += GetVisibleArea(); // Redraw this bitmap.
engine->Redraw(updateArea); // Mark for redrawing

// Now signal that the content is available.
engine->EventTriggered(this, EventContentAvailable);
}



// Set the transparency.
void MHBitmap::SetTransparency(int nTransPerCent, MHEngine *)
{
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythfreemheg/Bitmap.h
Expand Up @@ -69,6 +69,8 @@ class MHBitmap : public MHVisible
int m_nXDecodeOffset, m_nYDecodeOffset;

MHBitmapDisplay *m_pContent; // Pointer to current image if any.

void CreateContent(const unsigned char *p, int s, MHEngine *engine);
};

// Actions.
Expand Down

0 comments on commit d94970b

Please sign in to comment.