Skip to content

Commit

Permalink
Optimize AeHbBuffer using new subclasses of AeFFIExternalArray for in…
Browse files Browse the repository at this point in the history
…fo and position
  • Loading branch information
tinchodias committed Nov 23, 2023
1 parent ebd4db4 commit 2f1c6d5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Alexandrie-Harfbuzz/AeHbBuffer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,16 @@ AeHbBuffer >> cairoGlyphArray [
length := self length.
length = 0 ifTrue: [ ^ AeCairoGlyphArray newOf: 0 ].

infos := FFIExternalArray
infos := AeHbGlyphInfoArray
fromHandle: (self getGlyphInfosInto: ExternalAddress null)
type: AeHbGlyphInfo
size: length.
positions := FFIExternalArray
positions := AeHbGlyphPositionArray
fromHandle: (self getGlyphPositionsInto: ExternalAddress null)
type: AeHbGlyphPosition
size: length.

cairoGlyphsArray := AeCairoGlyphArray newOf: length.
currentX := 0.
currentY := 0.
currentX := 0.0.
currentY := 0.0.
cairoGlyphsArray doWithIndex: [ :each :index |
| position |
position := positions at: index.
Expand Down
14 changes: 14 additions & 0 deletions src/Alexandrie-Harfbuzz/AeHbGlyphInfoArray.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"
I'm an array of `AeHbGlyphInfo`.
"
Class {
#name : #AeHbGlyphInfoArray,
#superclass : #AeFFIExternalArray,
#category : #'Alexandrie-Harfbuzz-Structures'
}

{ #category : #'class initialization' }
AeHbGlyphInfoArray class >> initialize [

resolvedType := self resolveType: AeHbGlyphInfo
]
14 changes: 14 additions & 0 deletions src/Alexandrie-Harfbuzz/AeHbGlyphPositionArray.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"
I'm an array of `AeHbGlyphPosition`.
"
Class {
#name : #AeHbGlyphPositionArray,
#superclass : #AeFFIExternalArray,
#category : #'Alexandrie-Harfbuzz-Structures'
}

{ #category : #'class initialization' }
AeHbGlyphPositionArray class >> initialize [

resolvedType := self resolveType: AeHbGlyphPosition
]

0 comments on commit 2f1c6d5

Please sign in to comment.