mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Merge changes Ifd3d7a17,Icb1701bf
* changes: [escher] Fix an invalid array access [kandinsky] Optimize KDColor::blend
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user