Merge changes Ifd3d7a17,Icb1701bf

* changes:
  [escher] Fix an invalid array access
  [kandinsky] Optimize KDColor::blend
This commit is contained in:
Émilie Feral
2016-09-30 17:59:07 +02:00
committed by Gerrit
2 changed files with 13 additions and 1 deletions

View File

@@ -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 {

View File

@@ -1,6 +1,16 @@
#include <kandinsky/color.h>
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