adjust cursor shadow

This commit is contained in:
nakst 2021-11-22 14:20:12 +00:00
parent 7e513a3507
commit 0a4dc62ce6
5 changed files with 11 additions and 7 deletions

View File

@ -8,7 +8,6 @@ const EsListViewEnumString colorStrings[] = {
// We are using enum strings for the favorite color.
// "\a ... ]" is a bit of rich text markup.
// "#" sets the color to the hex code.
#define COLOR_RED (0)
{ "\a#e00]Red", -1 },
#define COLOR_GREEN (1)

View File

@ -7237,8 +7237,8 @@ bool UISetCursor(EsWindow *window) {
CURSOR(case ES_CURSOR_MOVE_DRAG, 197, 13, 10, 10, 24, 24);
CURSOR(case ES_CURSOR_ROTATE_HOVER, 228, 49, 9, 10, 24, 32);
CURSOR(case ES_CURSOR_ROTATE_DRAG, 198, 49, 9, 10, 22, 22);
CURSOR(case ES_CURSOR_BLANK, 5, 13, 0, 0, 1, 1);
CURSOR(default, 23, 18, 1, 1, 15, 24);
CURSOR(case ES_CURSOR_BLANK, 0, 0, 0, 0, 1, 1);
CURSOR(default, 24, 19, 0, 0, 11, 20);
}
bool shadow = cursorStyle != ES_CURSOR_TEXT && api.global->showCursorShadow;

View File

@ -6,6 +6,10 @@
#define CURSOR_SHADOW_OFFSET_X (0)
#define CURSOR_SHADOW_OFFSET_Y (1)
#define CURSOR_PADDING_T (2)
#define CURSOR_PADDING_B (4)
#define CURSOR_PADDING_L (3)
#define CURSOR_PADDING_R (3)
struct Surface : EsPaintTarget {
bool Resize(size_t newResX, size_t newResY, uint32_t clearColor = 0, bool copyOldBits = false);
@ -483,7 +487,7 @@ void Surface::Draw(Surface *source, EsRectangle destinationRegion, int sourceX,
}
void Surface::CreateCursorShadow(Surface *temporary) {
const uint32_t kernel[] = { 14, 43, 82, 43, 14 };
const uint32_t kernel[] = { 14, 43, 82, 39, 11 };
uint32_t *bits1 = (uint32_t *) bits;
uint32_t *bits2 = (uint32_t *) temporary->bits;

View File

@ -911,13 +911,14 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_WINDOW_SET_CURSOR) {
windowManager.cursorImageOffsetY = (int8_t) ((argument2 >> 8) & 0xFF);
windowManager.cursorShadow = argument3 & (1 << 30);
int width = imageWidth + CURSOR_SHADOW_OFFSET_X;
int height = imageHeight + CURSOR_SHADOW_OFFSET_Y;
int width = imageWidth + CURSOR_PADDING_L + CURSOR_PADDING_R;
int height = imageHeight + CURSOR_PADDING_T + CURSOR_PADDING_B;
if (windowManager.cursorSurface.Resize(width, height)
&& windowManager.cursorSwap.Resize(width, height)
&& windowManager.cursorTemporary.Resize(width, height)) {
windowManager.cursorSurface.SetBits((K_USER_BUFFER const void *) argument1, argument3 & 0xFFFFFF, ES_RECT_2S(imageWidth, imageHeight));
windowManager.cursorSurface.SetBits((K_USER_BUFFER const void *) argument1, argument3 & 0xFFFFFF,
ES_RECT_4PD(CURSOR_PADDING_L, CURSOR_PADDING_T, imageWidth, imageHeight));
if (windowManager.cursorShadow) {
windowManager.cursorSurface.CreateCursorShadow(&windowManager.cursorTemporary);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB