Select faster ink (INK_COPY) when we use an opaque color and opacity = 255

This commit is contained in:
David Capello 2015-07-28 10:31:09 -03:00
parent 88c4cd8d87
commit bee6baf812

View File

@ -59,9 +59,42 @@ public:
m_proc = ink_processing[INK_BRUSH][depth];
else {
switch (m_type) {
case Copy: m_proc = ink_processing[INK_COPY][depth]; break;
case LockAlpha: m_proc = ink_processing[INK_LOCKALPHA][depth]; break;
default: m_proc = ink_processing[INK_TRANSPARENT][depth]; break;
case Merge: {
bool opaque = false;
if (loop->getOpacity() == 255) {
color_t color = loop->getPrimaryColor();
switch (loop->sprite()->pixelFormat()) {
case IMAGE_RGB:
opaque = (rgba_geta(color) == 255);
break;
case IMAGE_GRAYSCALE:
opaque = (graya_geta(color) == 255);
break;
case IMAGE_INDEXED:
color = get_current_palette()->getEntry(color);
opaque = (rgba_geta(color) == 255);
break;
}
}
// Use a faster ink, direct copy
if (opaque)
m_proc = ink_processing[INK_COPY][depth];
else
m_proc = ink_processing[INK_TRANSPARENT][depth];
break;
}
case Copy:
m_proc = ink_processing[INK_COPY][depth];
break;
case LockAlpha:
m_proc = ink_processing[INK_LOCKALPHA][depth];
break;
default:
m_proc = ink_processing[INK_TRANSPARENT][depth];
break;
}
}
}