From: <ar...@us...> - 2010-12-23 15:45:31
|
Revision: 30758 http://xbmc4xbox.svn.sourceforge.net/xbmc4xbox/?rev=30758&view=rev Author: arnova Date: 2010-12-23 15:45:25 +0000 (Thu, 23 Dec 2010) Log Message: ----------- merged: xbmc mainline/trunk revisions 35141,35258,35307,35473,35509,35579,35625,35626 (mainly guilib updates/fixes) Modified Paths: -------------- trunk/guilib/GUIBaseContainer.cpp trunk/guilib/GUIButtonScroller.cpp trunk/guilib/GUIDialog.cpp trunk/guilib/GUIFadeLabelControl.cpp trunk/guilib/GUIListContainer.cpp trunk/guilib/GUIMultiImage.cpp trunk/guilib/GUITextBox.cpp trunk/guilib/GUIWindow.cpp trunk/guilib/GUIWindowManager.cpp trunk/guilib/GUIWindowManager.h trunk/guilib/GraphicContext.h trunk/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp Modified: trunk/guilib/GUIBaseContainer.cpp =================================================================== --- trunk/guilib/GUIBaseContainer.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIBaseContainer.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -82,7 +82,8 @@ if ((int)m_items.size() > m_itemsPerPage + cacheBefore + cacheAfter) FreeMemory(CorrectOffset(offset - cacheBefore, 0), CorrectOffset(offset + m_itemsPerPage + 1 + cacheAfter, 0)); - g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height); + if (g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) + { float posX = m_posX + m_renderOffset.x; float posY = m_posY + m_renderOffset.y; float pos = (m_orientation == VERTICAL) ? posY : posX; @@ -136,6 +137,7 @@ } g_graphicsContext.RestoreClipRegion(); + } UpdatePageControl(offset); Modified: trunk/guilib/GUIButtonScroller.cpp =================================================================== --- trunk/guilib/GUIButtonScroller.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIButtonScroller.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -715,7 +715,7 @@ color_t blendedAlpha = (alpha * ((color & 0xff000000) >> 24)) / 255; color_t blendedColor = (blendedAlpha << 24) | (color & 0xFFFFFF); blendedAlpha = (alpha * ((m_label.shadowColor & 0xff000000) >> 24)) / 255; - color_t shadowColor = (alpha << 24) | (m_label.shadowColor & 0xFFFFFF); + color_t shadowColor = (blendedAlpha << 24) | (m_label.shadowColor & 0xFFFFFF); CGUITextLayout::DrawText(m_label.font, fPosX, fPosY, blendedColor, shadowColor, label, m_label.align); } else Modified: trunk/guilib/GUIDialog.cpp =================================================================== --- trunk/guilib/GUIDialog.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIDialog.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -143,6 +143,9 @@ //maybe we should have a critical section per window instead?? CSingleLock lock(g_graphicsContext); + if (!g_windowManager.Initialized()) + return; // don't do anything + m_dialogClosing = false; m_bModal = true; // set running before it's added to the window manager, else the auto-show code @@ -192,6 +195,9 @@ if (m_bRunning && !m_dialogClosing && !IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) return; + if (!g_windowManager.Initialized()) + return; // don't do anything + m_bModal = false; // set running before it's added to the window manager, else the auto-show code Modified: trunk/guilib/GUIFadeLabelControl.cpp =================================================================== --- trunk/guilib/GUIFadeLabelControl.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIFadeLabelControl.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -92,7 +92,7 @@ void CGUIFadeLabelControl::Render() { - if (m_infoLabels.size() == 0) + if (m_infoLabels.size() == 0 || !m_label.font) { // nothing to render CGUIControl::Render(); return ; Modified: trunk/guilib/GUIListContainer.cpp =================================================================== --- trunk/guilib/GUIListContainer.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIListContainer.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -126,7 +126,10 @@ else if (message.GetMessage() == GUI_MSG_SETFOCUS) { if (message.GetParam1()) // subfocus item is specified, so set the offset appropriately - m_cursor = (int)message.GetParam1() - 1; + { + int item = min(m_offset + (int)message.GetParam1() - 1, (int)m_items.size() - 1); + SelectItem(item); + } } } return CGUIBaseContainer::OnMessage(message); Modified: trunk/guilib/GUIMultiImage.cpp =================================================================== --- trunk/guilib/GUIMultiImage.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIMultiImage.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -102,11 +102,9 @@ void CGUIMultiImage::Render() { - if (!m_files.empty()) + // Set a viewport so that we don't render outside the defined area + if (!m_files.empty() && g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) { - // Set a viewport so that we don't render outside the defined area - g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height); - unsigned int nextImage = m_currentImage + 1; if (nextImage >= m_files.size()) nextImage = m_loop ? 0 : m_currentImage; // stay on the last image if <loop>no</loop> Modified: trunk/guilib/GUITextBox.cpp =================================================================== --- trunk/guilib/GUITextBox.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUITextBox.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -59,6 +59,8 @@ m_autoScrollTime = from.m_autoScrollTime; m_autoScrollDelay = from.m_autoScrollDelay; m_autoScrollRepeatAnim = NULL; + if (from.m_autoScrollRepeatAnim) + m_autoScrollRepeatAnim = new CAnimation(*from.m_autoScrollRepeatAnim); m_label = from.m_label; m_info = from.m_info; // defaults @@ -175,8 +177,8 @@ int offset = (int)(m_scrollOffset / m_itemHeight); - g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height); - + if (g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) + { // we offset our draw position to take into account scrolling and whether or not our focused // item is offscreen "above" the list. float posX = m_posX; @@ -205,6 +207,7 @@ } g_graphicsContext.RestoreClipRegion(); + } if (m_pageControl) { Modified: trunk/guilib/GUIWindow.cpp =================================================================== --- trunk/guilib/GUIWindow.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIWindow.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -693,6 +693,8 @@ bool CGUIWindow::Initialize() { + if (!g_windowManager.Initialized()) + return false; // can't load if we have no skin yet return Load(GetProperty("xmlfile")); } Modified: trunk/guilib/GUIWindowManager.cpp =================================================================== --- trunk/guilib/GUIWindowManager.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIWindowManager.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -42,6 +42,7 @@ { m_pCallback = NULL; m_bShowOverlay = true; + m_initialized = false; } CGUIWindowManager::~CGUIWindowManager(void) @@ -51,6 +52,7 @@ void CGUIWindowManager::Initialize() { LoadNotOnDemandWindows(); + m_initialized = true; } bool CGUIWindowManager::SendMessage(int message, int senderID, int destID, int param1, int param2) @@ -320,7 +322,6 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStdString>& params, bool swappingWindows) { - bool passParams = true; // translate virtual windows // virtual music window which returns the last open music window (aka the music start window) if (iWindowID == WINDOW_MUSIC) @@ -329,8 +330,6 @@ // ensure the music virtual window only returns music files and music library windows if (iWindowID != WINDOW_MUSIC_NAV) iWindowID = WINDOW_MUSIC_FILES; - // destination path cannot be used with virtual window - passParams = false; } // virtual video window which returns the last open video window (aka the video start window) if (iWindowID == WINDOW_VIDEOS) @@ -339,8 +338,6 @@ // ensure the virtual video window only returns video windows if (iWindowID != WINDOW_VIDEO_NAV) iWindowID = WINDOW_VIDEO_FILES; - // destination path cannot be used with virtual window - passParams = false; } // debug @@ -364,7 +361,7 @@ else if (pNewWindow->IsDialog()) { // if we have a dialog, we do a DoModal() rather than activate the window if (!pNewWindow->IsDialogRunning()) - ((CGUIDialog *)pNewWindow)->DoModal(iWindowID, (passParams && params.size()) ? params[0] : ""); + ((CGUIDialog *)pNewWindow)->DoModal(iWindowID, params.size() ? params[0] : ""); return; } @@ -397,8 +394,7 @@ g_audioManager.PlayWindowSound(pNewWindow->GetID(), SOUND_INIT); // Send the init message CGUIMessage msg(GUI_MSG_WINDOW_INIT, 0, 0, currentWindow, iWindowID); - if (passParams) - msg.SetStringParams(params); + msg.SetStringParams(params); pNewWindow->OnMessage(msg); // g_infoManager.SetPreviousWindow(WINDOW_INVALID); } @@ -578,6 +574,8 @@ // clear our vectors of windows m_vecCustomWindows.clear(); m_activeDialogs.clear(); + + m_initialized = false; } /// \brief Route to a window Modified: trunk/guilib/GUIWindowManager.h =================================================================== --- trunk/guilib/GUIWindowManager.h 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GUIWindowManager.h 2010-12-23 15:45:25 UTC (rev 30758) @@ -74,7 +74,14 @@ on screen. It should only be called from the application thread. */ void FrameMove(); - + + /*! \brief Return whether the window manager is initialized. + The window manager is initialized on skin load - if the skin isn't yet loaded, + no windows should be able to be initialized. + \return true if the window manager is initialized, false otherwise. + */ + bool Initialized() const { return m_initialized; }; + void RenderDialogs(); CGUIWindow* GetWindow(int id) const; void Process(bool renderOnly = false); @@ -137,6 +144,7 @@ std::vector <IMsgTargetCallback*> m_vecMsgTargets; bool m_bShowOverlay; + bool m_initialized; }; /*! Modified: trunk/guilib/GraphicContext.h =================================================================== --- trunk/guilib/GraphicContext.h 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/guilib/GraphicContext.h 2010-12-23 15:45:25 UTC (rev 30758) @@ -167,7 +167,37 @@ void RestoreOrigin(); void SetCameraPosition(const CPoint &camera); void RestoreCameraPosition(); + /*! \brief Set a region in which to clip all rendering + Anything that is rendered after setting a clip region will be clipped so that no part renders + outside of the clip region. Successive calls to SetClipRegion intersect the clip region, which + means the clip region may eventually become an empty set. In this case SetClipRegion returns false + to indicate that no rendering need be performed. + + This call must be matched with a RestoreClipRegion call unless SetClipRegion returns false. + + Usage should be of the form: + + if (SetClipRegion(x, y, w, h)) + { + ... + perform rendering + ... + RestoreClipRegion(); + } + + \param x the left-most coordinate of the clip region + \param y the top-most coordinate of the clip region + \param w the width of the clip region + \param h the height of the clip region + \returns true if the region is set and the result is non-empty. Returns false if the resulting region is empty. + \sa RestoreClipRegion + */ bool SetClipRegion(float x, float y, float w, float h); + + /*! \brief Restore a clip region to the previous clip region (if any) prior to the last SetClipRegion call + This function should be within an if (SetClipRegion(x,y,w,h)) block. + \sa SetClipRegion + */ void RestoreClipRegion(); void ClipRect(CRect &vertex, CRect &texture, CRect *diffuse = NULL); inline void ResetWindowTransform() Modified: trunk/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp =================================================================== --- trunk/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp 2010-12-23 13:50:20 UTC (rev 30757) +++ trunk/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp 2010-12-23 15:45:25 UTC (rev 30758) @@ -298,6 +298,8 @@ { if (clear) { + for(std::vector<CPlayerCoreConfig *>::iterator it = s_vecCoreConfigs.begin(); it != s_vecCoreConfigs.end(); it++) + delete *it; s_vecCoreConfigs.clear(); // Builtin players; hard-coded because re-ordering them would break scripts CPlayerCoreConfig* dvdplayer = new CPlayerCoreConfig("DVDPlayer", EPC_DVDPLAYER, NULL); @@ -307,15 +309,18 @@ CPlayerCoreConfig* mplayer = new CPlayerCoreConfig("MPlayer", EPC_MPLAYER, NULL); mplayer->m_bPlaysAudio = mplayer->m_bPlaysVideo = true; s_vecCoreConfigs.push_back(mplayer); - + CPlayerCoreConfig* paplayer = new CPlayerCoreConfig("PAPlayer", EPC_PAPLAYER, NULL); paplayer->m_bPlaysAudio = true; s_vecCoreConfigs.push_back(paplayer); - CPlayerCoreConfig* modplayer = new CPlayerCoreConfig("MODPlayer", EPC_MODPLAYER, NULL); - modplayer->m_bPlaysAudio = true; - s_vecCoreConfigs.push_back(modplayer); - + CPlayerCoreConfig* modplayer = new CPlayerCoreConfig("MODPlayer", EPC_MODPLAYER, NULL); + modplayer->m_bPlaysAudio = true; + s_vecCoreConfigs.push_back(modplayer); + + for(std::vector<CPlayerSelectionRule *>::iterator it = s_vecCoreSelectionRules.begin(); it != s_vecCoreSelectionRules.end(); it++) + delete *it; + s_vecCoreSelectionRules.clear(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |