Skip to content

Commit

Permalink
Applied changes of pull request pharo-graphics#465 (“Make #physicalSi…
Browse files Browse the repository at this point in the history
…ze on BlMorphicHostSpace apply the world renderer canvas scale factor”) to Pharo 12.
  • Loading branch information
Rinzwind committed Jun 17, 2024
1 parent f28efe5 commit 4edd704
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/BlocHost-Morphic/BlMorphicHostSpace.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ BlMorphicHostSpace >> physicalSize [
This size may differ from the logical size on high dpi (retina) screens.
In most cases physical size is x2 larger than logical size on retina screens."

^ (spaceHostMorph width @ spaceHostMorph height) asPhysicalSize
| canvasScaleFactor |

canvasScaleFactor := SystemVersion current major >= 12
ifTrue: [ (Smalltalk at: #OSWorldRenderer) canvasScaleFactor ]
ifFalse: [ 1 ].
^ ((spaceHostMorph width @ spaceHostMorph height) * canvasScaleFactor) asPhysicalSize
]

{ #category : #'window - properties' }
Expand Down
7 changes: 6 additions & 1 deletion src/BlocHost-Morphic/BlMorphicSpaceHostMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ BlMorphicSpaceHostMorph >> drawOn: aCanvas [
ifTrue: [ ^ self ].
hostSpace ifNotNil: [
aCanvas clipBy: self fullBounds during: [ :aClippedCanvas |
aClippedCanvas drawImage: spaceForm at: self position ] ]
SystemVersion current major >= 12 ifTrue: [
| formSet |
formSet := (Smalltalk at: #FormSet) extent: self extent depth: spaceForm depth forms: { spaceForm }.
aClippedCanvas drawFormSet: formSet at: self position
] ifFalse: [
aClippedCanvas drawImage: spaceForm at: self position ] ] ]
]

{ #category : #geometry }
Expand Down

0 comments on commit 4edd704

Please sign in to comment.