Source
...
Target
Commits (2)
  • Jeffrey Lee's avatar
    Avoid unnecessary remainder calculations · 117db38f
    Jeffrey Lee authored
    Detail:
      s/StartUp - Avoid unnecessary remainder calculations in DivRem macro
    Admin:
      Tested on Cortex-A15
    
    
    Version 0.20. Tagged as 'DragASprit-0_20'
    117db38f
  • Jeffrey Lee's avatar
    Fix redraw issue with alpha drop shadow · ac32c2a9
    Jeffrey Lee authored
    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'
    ac32c2a9
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.19"
Module_Version SETA 19
Module_MajorVersion SETS "0.21"
Module_Version SETA 21
Module_MinorVersion SETS ""
Module_Date SETS "05 Jul 2014"
Module_ApplicationDate SETS "05-Jul-14"
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.19"
Module_HelpVersion SETS "0.19 (05 Jul 2014)"
Module_FullVersion SETS "0.21"
Module_HelpVersion SETS "0.21 (30 Aug 2017)"
END
/* (0.19)
/* (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.19
#define Module_MajorVersion_CMHG 0.21
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 05 Jul 2014
#define Module_Date_CMHG 30 Aug 2017
#define Module_MajorVersion "0.19"
#define Module_Version 19
#define Module_MajorVersion "0.21"
#define Module_Version 21
#define Module_MinorVersion ""
#define Module_Date "05 Jul 2014"
#define Module_Date "30 Aug 2017"
#define Module_ApplicationDate "05-Jul-14"
#define Module_ApplicationDate "30-Aug-17"
#define Module_ComponentName "DragASprit"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/DragASprit"
#define Module_FullVersion "0.19"
#define Module_HelpVersion "0.19 (05 Jul 2014)"
#define Module_LibraryVersionInfo "0:19"
#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
......@@ -1177,7 +1177,7 @@ GTDS_frame_size * :INDEX: @
RSB r3, r3, #256 ; r3 = Ac
; Calculate s
MOV r4, r4, LSL #8
DivRem r8, r4, r3, lr ; r8 = s
DivRem r8, r4, r3, lr, norem ; r8 = s
; Calculate final RGB
; This is rather simple, since we want the drop shadow to be black
MUL r5, r8, r5
......