Skip to content

Commit

Permalink
RetroPlayer: Remove unneeded geometry variables
Browse files Browse the repository at this point in the history
  • Loading branch information
garbear committed Jul 2, 2018
1 parent f952eaa commit 0f64ca6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
25 changes: 6 additions & 19 deletions xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ CRPBaseRenderer::CRPBaseRenderer(const CRenderSettings &renderSettings, CRenderC
m_bufferPool(std::move(bufferPool)),
m_renderSettings(renderSettings)
{
m_oldDestRect.SetRect(0.0f, 0.0f, 0.0f, 0.0f);

for(int i=0; i < 4; i++)
{
m_rotatedDestCoords[i].x = 0;
m_rotatedDestCoords[i].y = 0;
}

m_bufferPool->RegisterRenderer(this);
}

Expand Down Expand Up @@ -180,7 +172,8 @@ void CRPBaseRenderer::ManageRenderArea()
CRenderUtils::CalculateViewMode(viewMode, rotationDegCCW, m_sourceWidth, m_sourceHeight, screenWidth, screenHeight, pixelRatio, zoomAmount);

// Calculate destination dimensions
CRenderUtils::CalcNormalRenderRect(viewRect, GetAspectRatio() * pixelRatio, zoomAmount, m_dimensions);
CRect destRect;
CRenderUtils::CalcNormalRenderRect(viewRect, GetAspectRatio() * pixelRatio, zoomAmount, destRect);

m_sourceRect.x1 = 0.0f;
m_sourceRect.y1 = 0.0f;
Expand All @@ -189,17 +182,11 @@ void CRPBaseRenderer::ManageRenderArea()

// Clip as needed
if (!(m_context.IsFullScreenVideo() || m_context.IsCalibrating()))
CRenderUtils::ClipRect(viewRect, m_sourceRect, m_dimensions);
CRenderUtils::ClipRect(viewRect, m_sourceRect, destRect);

const CRect &destRect = m_dimensions;
if (m_oldDestRect != destRect || m_oldRenderOrientation != rotationDegCCW)
{
// Adapt the drawing rect points if we have to rotate and either destRect
// or orientation changed
m_rotatedDestCoords = CRenderUtils::ReorderDrawPoints(destRect, rotationDegCCW, GetAspectRatio());
m_oldDestRect = destRect;
m_oldRenderOrientation = rotationDegCCW;
}
// Adapt the drawing rect points if we have to rotate and either destRect
// or orientation changed
m_rotatedDestCoords = CRenderUtils::ReorderDrawPoints(destRect, rotationDegCCW, GetAspectRatio());
}

void CRPBaseRenderer::MarkDirty()
Expand Down
14 changes: 2 additions & 12 deletions xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,13 @@ namespace RETRO
unsigned int m_sourceHeight = 0;
unsigned int m_renderOrientation = 0; // Degrees counter-clockwise

/*!
* \brief Orientation of the previous frame
*
* For drawing the texture with glVertex4f (holds all 4 corner points of the
* destination rect with correct orientation based on m_renderOrientation.
*/
unsigned int m_oldRenderOrientation = 0;

// Rendering properties
CRenderSettings m_renderSettings;
CRect m_dimensions;
IRenderBuffer *m_renderBuffer = nullptr;

// Geometry properties
std::array<CPoint, 4> m_rotatedDestCoords;
CRect m_oldDestRect; // destrect of the previous frame
CRect m_sourceRect; // original size of the video
CRect m_sourceRect;
std::array<CPoint, 4> m_rotatedDestCoords{};

private:
/*!
Expand Down

0 comments on commit 0f64ca6

Please sign in to comment.