Skip to content

Commit

Permalink
Add AeFFIUInt32Array and use it in asFormARGB32.
Browse files Browse the repository at this point in the history
See: #44
  • Loading branch information
tinchodias committed Nov 23, 2023
1 parent f57d449 commit 997fac0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/Alexandrie-Base/AeFFIDoubleArray.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Class {
#category : #'Alexandrie-Base'
}

{ #category : #finalization }
AeFFIDoubleArray class >> externallyFree: aHandle [

aHandle free
]

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

Expand Down
6 changes: 6 additions & 0 deletions src/Alexandrie-Base/AeFFIExternalArray.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Class {
#category : #'Alexandrie-Base'
}

{ #category : #finalization }
AeFFIExternalArray class >> externallyFree: aHandle [

aHandle free
]

{ #category : #'instance creation' }
AeFFIExternalArray class >> fromHandle: aHandle size: aNumber [

Expand Down
14 changes: 14 additions & 0 deletions src/Alexandrie-Base/AeFFIUInt32Array.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"
I'm an array of `FFIUInt32` (unsigned int).
"
Class {
#name : #AeFFIUInt32Array,
#superclass : #AeFFIExternalArray,
#category : #'Alexandrie-Base'
}

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

resolvedType := self resolveType: FFIUInt32
]
3 changes: 1 addition & 2 deletions src/Alexandrie-Cairo/AeCairoImageSurface.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,8 @@ AeCairoImageSurface >> asFormARGB32 [
streamContents: [ :stream |
| words |
self flush.
words := FFIExternalArray
words := AeFFIUInt32Array
fromHandle: self data
type: FFIUInt32
size: aSizeInWords.
words do: [ :pixel |
| alpha |
Expand Down

0 comments on commit 997fac0

Please sign in to comment.