mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 09:04:02 +00:00
Select faster ink (INK_COPY) when we use an opaque color and opacity = 255
This commit is contained in:
parent
88c4cd8d87
commit
bee6baf812
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user