Commit ac32c2a9 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix redraw issue with alpha drop shadow

Detail:
  s/StartUp - When the alpha drop shadow is in use, the foreground sprite is one row+column larger than normal, to allow the shadow to be feathered. However the drag box calculations weren't taking this into account, resulting in slightly wonky coordinates that can result in redraw issues in some situations (specifically, the screen area under the sprite's current location is filled with a plain colour if the bounding box overlaps the graphics window in a certain manner). Introduce orig_x_size and orig_y_size variables so that the drag box calculations can be correct regardless of how much padding is added to the image (with the limitation that the padding must be on the right / bottom)
  Also, fix the AtPointer support so that the pointer is placed at the centre of the input sprite, not the padded sprite.
Admin:
  Tested on Raspberry Pi
  Resolves ticket #402, and similar corruption with animated windows (e.g. start a drag of a sprite which overlaps !Alarm's icon)


Version 0.21. Tagged as 'DragASprit-0_21'
parent 117db38f
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.20"
Module_Version SETA 20
Module_MajorVersion SETS "0.21"
Module_Version SETA 21
Module_MinorVersion SETS ""
Module_Date SETS "08 May 2016"
Module_ApplicationDate SETS "08-May-16"
Module_Date SETS "30 Aug 2017"
Module_ApplicationDate SETS "30-Aug-17"
Module_ComponentName SETS "DragASprit"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/DragASprit"
Module_FullVersion SETS "0.20"
Module_HelpVersion SETS "0.20 (08 May 2016)"
Module_FullVersion SETS "0.21"
Module_HelpVersion SETS "0.21 (30 Aug 2017)"
END
/* (0.20)
/* (0.21)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.20
#define Module_MajorVersion_CMHG 0.21
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 May 2016
#define Module_Date_CMHG 30 Aug 2017
#define Module_MajorVersion "0.20"
#define Module_Version 20
#define Module_MajorVersion "0.21"
#define Module_Version 21
#define Module_MinorVersion ""
#define Module_Date "08 May 2016"
#define Module_Date "30 Aug 2017"
#define Module_ApplicationDate "08-May-16"
#define Module_ApplicationDate "30-Aug-17"
#define Module_ComponentName "DragASprit"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/DragASprit"
#define Module_FullVersion "0.20"
#define Module_HelpVersion "0.20 (08 May 2016)"
#define Module_LibraryVersionInfo "0:20"
#define Module_FullVersion "0.21"
#define Module_HelpVersion "0.21 (30 Aug 2017)"
#define Module_LibraryVersionInfo "0:21"
......@@ -89,6 +89,8 @@ scale_block # 16
tx_block # 16
spr_dragbox # 16 ; Box to use for sprite dragging calculations
local_flags # 4
orig_x_size # 4 ; Size in OS units of input sprite
orig_y_size # 4 ; Size in OS units of input sprite
StartUp_frame_size * :INDEX: @
StartUp Entry "r0-r8", StartUp_frame_size
......@@ -208,6 +210,10 @@ StartUp Entry "r0-r8", StartUp_frame_size
; Probably failed due to missing sprite, hence...
BVS ResortToNormalDrag
; Remember original size so we can get drag box calculations correct
STR r0, orig_x_size
STR r1, orig_y_size
; If there's a drop-shadow grow the size by the required distance
LDR r2, local_flags
TestAFlag r2, DropShadow, Present, r14
......@@ -616,7 +622,7 @@ wibble2
LDR r1, [r2]
LDR r14, [r3, #box_x0]
SUB r1, r1, r14
LDR r14, x_size
LDR r14, orig_x_size
SUB r1, r1, r14, LSR #1
STR r1, bl_offset_x ; Store x offset
......@@ -624,9 +630,7 @@ wibble2
LDR r1, [r2, #4]
LDR r14, [r3, #box_y0]
SUB r1, r1, r14
LDR r14, y_size
SUB r1, r1, r14, LSR #1 ; This value will be stord after next branch
B %FT65
B %FT61 ; Share centre justify code
54
]
......@@ -644,19 +648,15 @@ wibble2
LDR r2, [r3, #box_x0]
SUB r1, r1, r2
MOV r1, r1, ASR #1
LDR r2, x_size
TestAFlag r0, DropShadow, Present, r14
SUBEQ r2, r2, #DS_DropShadowDistance
LDR r2, orig_x_size
SUB r1, r1, r2, ASR #1
B %FT57
55
; Right justify
LDR r1, [r3, #box_x1]
LDR r2, x_size
LDR r2, orig_x_size
SUB r1, r1, r2
TestAFlag r0, DropShadow, Present, r14
ADDEQ r1, r1, #DS_DropShadowDistance
LDR lr, [r3, #box_x0]
SUB r1, r1, lr
......@@ -667,9 +667,9 @@ wibble2
BNE %FT60
; Bottom justify
MOV r1, #0
TestAFlag r0, DropShadow, Present, r14
SUBEQ r1, r1, #DS_DropShadowDistance
LDR r14, orig_y_size
LDR r1, y_size
SUB r1, r14, r1
B %FT65
......@@ -682,9 +682,10 @@ wibble2
LDR r2, [r3, #box_y0]
SUB r1, r1, r2
MOV r1, r1, ASR #1
61
LDR r14, orig_y_size
LDR r2, y_size
TestAFlag r0, DropShadow, Present, r14
ADDEQ r2, r2, #DS_DropShadowDistance
RSB r2, r14, r2, LSL #1 ; i.e. orig_y_size + 2*padding
SUB r1, r1, r2, ASR #1
B %FT65
......@@ -700,23 +701,22 @@ wibble2
STR r1, bl_offset_y
; Given the bl offsets and the original box, generate the sprite's drag box
TestAFlag r0, DropShadow, Present, r14
LDR r1, [r3, #box_x0]
LDR r2, bl_offset_x
ADD r1, r1, r2
STR r1, spr_dragbox + box_x0
LDR r2, x_size
LDR r2, orig_x_size
ADD r1, r1, r2
SUBEQ r1, r1, #DS_DropShadowDistance
STR r1, spr_dragbox + box_x1
LDR r1, [r3, #box_y0]
LDR r2, bl_offset_y
ADD r1, r1, r2
ADDEQ r1, r1, #DS_DropShadowDistance
LDR r2, orig_y_size
LDR r14, y_size
SUB r14, r14, r2
ADD r1, r1, r14
STR r1, spr_dragbox + box_y0
LDR r2, y_size
ADD r1, r1, r2
SUBEQ r1, r1, #DS_DropShadowDistance
STR r1, spr_dragbox + box_y1
[ debugstart
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment