Skip to content

Commit

Permalink
MythRenderD3D9: Update video textures directly from hardware decoded …
Browse files Browse the repository at this point in the history
…surfaces.
  • Loading branch information
mark-kendall committed Feb 25, 2011
1 parent 3525239 commit 8de92f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
18 changes: 16 additions & 2 deletions mythtv/libs/libmythui/mythrender_d3d9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ bool D3D9Image::SetAsRenderTarget(void)
return m_valid;
}

bool D3D9Image::UpdateImage(IDirect3DSurface9 *surface)
{
if (m_valid)
return m_render->StretchRect(m_texture, surface, false);
return false;
}

bool D3D9Image::UpdateImage(const MythImage *img)
{
bool result = true;
Expand Down Expand Up @@ -493,11 +500,18 @@ bool MythRenderD3D9::End(void)
return true;
}

void MythRenderD3D9::CopyFrame(void* surface, D3D9Image *img)
{
if (surface && img)
img->UpdateImage((IDirect3DSurface9*)surface);
}

bool MythRenderD3D9::StretchRect(IDirect3DTexture9 *texture,
IDirect3DSurface9 *surface)
IDirect3DSurface9 *surface,
bool known_surface)
{
if (!m_textures.contains(texture) ||
!m_surfaces.contains(surface))
(known_surface && !m_surfaces.contains(surface)))
return false;

QMutexLocker locker(&m_lock);
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythui/mythrender_d3d9.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class MUI_PUBLIC D3D9Image
bool IsValid(void) const { return m_valid; }
QSize GetSize(void) const { return m_size; }
bool SetAsRenderTarget(void);
bool UpdateImage(IDirect3DSurface9 *surface);
bool UpdateImage(const MythImage *img);
bool UpdateVertices(const QRect &dvr, const QRect &vr, int alpha = 255,
bool video = false);
Expand All @@ -46,10 +47,13 @@ class MUI_PUBLIC MythRenderD3D9
bool Create(QSize size, HWND window);
bool Test(bool &reset);

IDirect3DDevice9* GetDevice(void) { return m_d3dDevice; }
bool ClearBuffer(void);
bool Begin(void);
bool End(void);
bool StretchRect(IDirect3DTexture9 *texture, IDirect3DSurface9 *surface);
void CopyFrame(void* surface, D3D9Image *img);
bool StretchRect(IDirect3DTexture9 *texture, IDirect3DSurface9 *surface,
bool known_surface = true);
bool DrawTexturedQuad(IDirect3DVertexBuffer9 *vertexbuffer);
void DrawRect(const QRect &rect, const QColor &color);
bool Present(HWND win);
Expand Down

0 comments on commit 8de92f1

Please sign in to comment.