diff --git a/escher/src/tab_view.cpp b/escher/src/tab_view.cpp index ce03117c8..5779c210b 100644 --- a/escher/src/tab_view.cpp +++ b/escher/src/tab_view.cpp @@ -47,7 +47,9 @@ void TabView::setSelectedIndex(int index) { m_cells[m_selectedTabIndex].setSelected(false); } m_selectedTabIndex = index; - m_cells[m_selectedTabIndex].setSelected(true); + if (m_selectedTabIndex >= 0) { + m_cells[m_selectedTabIndex].setSelected(true); + } } int TabView::numberOfSubviews() const { diff --git a/kandinsky/src/color.cpp b/kandinsky/src/color.cpp index 3d076b5f6..4b76f7314 100644 --- a/kandinsky/src/color.cpp +++ b/kandinsky/src/color.cpp @@ -1,6 +1,16 @@ #include KDColor KDColor::blend(KDColor first, KDColor second, uint8_t alpha) { + /* This function is a hot path since it's being called for every single pixel + * whenever we want to display a string. In this context, we're quite often + * calling it with a value of either 0 or 0xFF, which can be very trivially + * dealt with. So let's make a special case for them. */ + if (alpha == 0) { + return second; + } else if (alpha == 0xFF) { + return first; + } + // We want to do first*alpha + second*(1-alpha) // First is RRRRR GGGGGG BBBBB // Second is same