mirror of https://gitlab.com/nakst/essence
fix fast scroll glitches
This commit is contained in:
parent
599a2786d8
commit
b4dfe96d85
|
@ -2830,6 +2830,10 @@ void ScrollPane::SetPosition(int axis, double newScroll, bool sendMovedMessage)
|
|||
if (newScroll < 0) newScroll = 0;
|
||||
else if (newScroll > limit[axis]) newScroll = limit[axis];
|
||||
if (newScroll == position[axis]) return;
|
||||
|
||||
// Since we might be about to fast scroll, make sure the bits we are scrolling are valid.
|
||||
UIWindowPaintNow(parent->window, nullptr, false);
|
||||
|
||||
double previous = position[axis];
|
||||
position[axis] = newScroll;
|
||||
if (bar[axis]) ScrollbarSetPosition(bar[axis], position[axis], false, false);
|
||||
|
@ -6089,7 +6093,7 @@ void EsElementRepaint(EsElement *element, const EsRectangle *region) {
|
|||
}
|
||||
|
||||
void EsElementRepaintForScroll(EsElement *element, EsMessage *message) {
|
||||
// TODO Support custom borders sizes.
|
||||
// TODO Support custom border sizes.
|
||||
|
||||
EsRectangle borders = ES_RECT_4(element->internalOffsetLeft, element->internalOffsetRight,
|
||||
element->internalOffsetTop, element->internalOffsetBottom);
|
||||
|
|
|
@ -222,7 +222,11 @@ void Surface::Scroll(EsRectangle region, ptrdiff_t delta, bool vertical) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// TODO.
|
||||
for (intptr_t i = region.t; i < region.b; i++) {
|
||||
for (intptr_t j = region.r - 1; j >= region.l; j--) {
|
||||
((uint32_t *) bits)[j - delta + i * stride / 4] = ((uint32_t *) bits)[j + i * stride / 4];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,6 +505,7 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_WINDOW_SET_BITS) {
|
|||
if (argument3 == WINDOW_SET_BITS_SCROLL_VERTICAL || argument3 == WINDOW_SET_BITS_SCROLL_HORIZONTAL) {
|
||||
ptrdiff_t scrollDelta = argument2;
|
||||
bool scrollVertical = argument3 == WINDOW_SET_BITS_SCROLL_VERTICAL;
|
||||
EsRectangle originalRegion = region;
|
||||
|
||||
if (scrollVertical) {
|
||||
if (scrollDelta < 0) region.b += scrollDelta;
|
||||
|
@ -522,7 +523,7 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_WINDOW_SET_BITS) {
|
|||
|| region.l >= region.r || region.t >= region.b) {
|
||||
} else {
|
||||
surface->Scroll(region, scrollDelta, scrollVertical);
|
||||
window->Update(®ion, true);
|
||||
window->Update(&originalRegion, true);
|
||||
window->queuedScrollUpdate = true;
|
||||
// Don't update the screen until the rest of the window is painted.
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Terminology:
|
||||
// Dynamic resize - flicker-free resizing in container windows with an embedded window owned by a separate process.
|
||||
// Direct update - paint first onto the video card's framebuffer, then onto the window manager's; used to reduce latency.
|
||||
// Fast scroll - scrolling by shifting the bits in the window's surface, rather than repainting the entire area. TODO This is currently a bit broken.
|
||||
// Fast scroll - scrolling by shifting the bits in the window's surface, rather than repainting the entire area.
|
||||
|
||||
struct EmbeddedWindow {
|
||||
void Destroy();
|
||||
|
|
Loading…
Reference in New Issue