Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: switch pair! from integer! to float32! #4049

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FEAT: use float32! pair! for macos view
  • Loading branch information
bitbegin committed Sep 24, 2019
commit ba676a62c00f3f5fc09c0676889d1d6a94031a55
20 changes: 10 additions & 10 deletions modules/view/backends/macOS/delegates.reds
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 647,8 @@ text-will-selection: func [
sel: as red-pair! (get-face-values self) FACE_OBJ_SELECTED
either zero? len2 [sel/header: TYPE_NONE][
sel/header: TYPE_PAIR
sel/x: idx2 1
sel/y: idx2 len2
sel/x: as float32! idx2 1
sel/y: as float32! idx2 len2
]

make-event self 0 EVT_SELECT
Expand Down Expand Up @@ -1022,8 1022,8 @@ win-did-resize: func [
v: objc_msgSend [self sel_getUid "contentView"]
rc: objc_msgSend_rect [v sel_getUid "frame"]
sz: (as red-pair! get-face-values self) FACE_OBJ_SIZE ;-- update face/size
sz/x: as-integer rc/w
sz/y: as-integer rc/h
sz/x: rc/w
sz/y: rc/h
]

win-live-resize: func [
Expand All @@ -1046,8 1046,8 @@ win-did-move: func [
][
rc: as NSRect! (as int-ptr! self) 2
sz: (as red-pair! get-face-values self) FACE_OBJ_OFFSET ;-- update face/offset
sz/x: as-integer rc/x
sz/y: screen-size-y - as-integer (rc/y rc/h)
sz/x: rc/x
sz/y: (as float32! screen-size-y) - (rc/y rc/h)
make-event self 0 EVT_MOVE
]

Expand Down Expand Up @@ -1431,9 1431,9 @@ hit-test: func [
]
w: IMAGE_WIDTH(img/size)
h: IMAGE_HEIGHT(img/size)
ratio: (as float32! w) / (as float32! sz/x)
ratio: (as float32! w) / sz/x
x: as-integer pt/x * ratio
ratio: (as float32! h) / (as float32! sz/y)
ratio: (as float32! h) / sz/y
y: as-integer pt/y * ratio
pixel: OS-image/get-pixel img/node y * w x
if pixel >>> 24 = 0 [v: 0]
Expand Down Expand Up @@ -1485,12 1485,12 @@ draw-rect: func [
paint-background ctx clr/array1 x y width height
]
if TYPE_OF(img) = TYPE_IMAGE [
CG-draw-image ctx OS-image/to-cgimage img 0 0 size/x size/y
CG-draw-image ctx OS-image/to-cgimage img 0 0 as integer! size/x as integer! size/y
]
case [
sym = base [render-text ctx vals as NSSize! (as int-ptr! self) 8]
sym = rich-text [
pos/x: 0 pos/y: 0
pos/x: as float32! 0.0 pos/y: as float32! 0.0
draw-text-box null :pos get-face-obj self yes
]
true []
Expand Down
Loading