if (g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height))
{
- CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset;
- float pos = (m_orientation == VERTICAL) ? origin.y : origin.x;
- float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width;
-
- // we offset our draw position to take into account scrolling and whether or not our focused
- // item is offscreen "above" the list.
- float drawOffset = (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scrollOffset;
- if (m_offset + m_cursor < offset)
- drawOffset += m_focusedLayout->Size(m_orientation) - m_layout->Size(m_orientation);
- pos += drawOffset;
- end += cacheAfter * m_layout->Size(m_orientation);
-
- float focusedPos = 0;
- CGUIListItemPtr focusedItem;
- int current = offset - cacheBefore;
- while (pos < end && m_items.size())
- {
- int itemNo = CorrectOffset(current, 0);
- if (itemNo >= (int)m_items.size())
- break;
- bool focused = (current == m_offset + m_cursor);
- if (itemNo >= 0)
+ CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset;
+ float pos = (m_orientation == VERTICAL) ? origin.y : origin.x;
+ float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width;
+
+ // we offset our draw position to take into account scrolling and whether or not our focused
+ // item is offscreen "above" the list.
+ float drawOffset = (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scrollOffset;
+ if (m_offset + m_cursor < offset)
+ drawOffset += m_focusedLayout->Size(m_orientation) - m_layout->Size(m_orientation);
+ pos += drawOffset;
+ end += cacheAfter * m_layout->Size(m_orientation);
+
+ float focusedPos = 0;
+ CGUIListItemPtr focusedItem;
+ int current = offset - cacheBefore;
+ while (pos < end && m_items.size())
{
- CGUIListItemPtr item = m_items[itemNo];
- // render our item
- if (focused)
- {
- focusedPos = pos;
- focusedItem = item;
- }
- else
+ int itemNo = CorrectOffset(current, 0);
+ if (itemNo >= (int)m_items.size())
+ break;
+ bool focused = (current == m_offset + m_cursor);
+ if (itemNo >= 0)
{
- if (m_orientation == VERTICAL)
- RenderItem(origin.x, pos, item.get(), false);
+ CGUIListItemPtr item = m_items[itemNo];
+ // render our item
+ if (focused)
+ {
+ focusedPos = pos;
+ focusedItem = item;
+ }
else
- RenderItem(pos, origin.y, item.get(), false);
+ {
+ if (m_orientation == VERTICAL)
+ RenderItem(origin.x, pos, item.get(), false);
+ else
+ RenderItem(pos, origin.y, item.get(), false);
+ }
}
+ // increment our position
+ pos += focused ? m_focusedLayout->Size(m_orientation) : m_layout->Size(m_orientation);
+ current++;
+ }
+ // render focused item last so it can overlap other items
+ if (focusedItem)
+ {
+ if (m_orientation == VERTICAL)
+ RenderItem(origin.x, focusedPos, focusedItem.get(), true);
+ else
+ RenderItem(focusedPos, origin.y, focusedItem.get(), true);
}
- // increment our position
- pos += focused ? m_focusedLayout->Size(m_orientation) : m_layout->Size(m_orientation);
- current++;
- }
- // render focused item last so it can overlap other items
- if (focusedItem)
- {
- if (m_orientation == VERTICAL)
- RenderItem(origin.x, focusedPos, focusedItem.get(), true);
- else
- RenderItem(focusedPos, origin.y, focusedItem.get(), true);
- }
- g_graphicsContext.RestoreClipRegion();
+ g_graphicsContext.RestoreClipRegion();
}
UpdatePageControl(offset);
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;
- float posY = m_posY + offset * m_itemHeight - m_scrollOffset;
-
- // alignment correction
- if (m_label.align & XBFONT_CENTER_X)
- posX += m_width * 0.5f;
- if (m_label.align & XBFONT_RIGHT)
- posX += m_width;
-
- if (m_font)
- {
- m_font->Begin();
- int current = offset;
- while (posY < m_posY + m_height && current < (int)m_lines.size())
+ // 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;
+ float posY = m_posY + offset * m_itemHeight - m_scrollOffset;
+
+ // alignment correction
+ if (m_label.align & XBFONT_CENTER_X)
+ posX += m_width * 0.5f;
+ if (m_label.align & XBFONT_RIGHT)
+ posX += m_width;
+
+ if (m_font)
{
- uint32_t align = m_label.align;
- if (m_lines[current].m_text.size() && m_lines[current].m_carriageReturn)
- align &= ~XBFONT_JUSTIFIED; // last line of a paragraph shouldn't be justified
- m_font->DrawText(posX, posY + 2, m_colors, m_label.shadowColor, m_lines[current].m_text, align, m_width);
- posY += m_itemHeight;
- current++;
+ m_font->Begin();
+ int current = offset;
+ while (posY < m_posY + m_height && current < (int)m_lines.size())
+ {
+ uint32_t align = m_label.align;
+ if (m_lines[current].m_text.size() && m_lines[current].m_carriageReturn)
+ align &= ~XBFONT_JUSTIFIED; // last line of a paragraph shouldn't be justified
+ m_font->DrawText(posX, posY + 2, m_colors, m_label.shadowColor, m_lines[current].m_text, align, m_width);
+ posY += m_itemHeight;
+ current++;
+ }
+ m_font->End();
}
- m_font->End();
- }
- g_graphicsContext.RestoreClipRegion();
+ g_graphicsContext.RestoreClipRegion();
}
if (m_pageControl)