Skip to content

Commit

Permalink
Move our subclass of FFIExternalArray to Alexandrie-Base
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Nov 23, 2023
1 parent 486d067 commit f9193de
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 37 deletions.
20 changes: 20 additions & 0 deletions src/Alexandrie-Base/AeFFIDoubleArray.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"
I'm an array of `FFIFloat64` (double).
"
Class {
#name : #AeFFIDoubleArray,
#superclass : #AeFFIExternalArray,
#category : #'Alexandrie-Base'
}

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

aHandle free
]

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

resolvedType := self resolveType: FFIFloat64
]
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"
I'm an external array specialized for Cairo FFI bindings.
I'm an external array specialized for Alexandrie's FFI bindings.
"
Class {
#name : #AeCairoExternalArray,
#name : #AeFFIExternalArray,
#superclass : #FFIExternalArray,
#traits : 'AeTExternalFree',
#classTraits : 'AeTExternalFree classTrait',
#classInstVars : [
'resolvedType'
],
#category : #'Alexandrie-Cairo-Structures'
#category : #'Alexandrie-Base'
}

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

^ self
fromHandle: aHandle
Expand All @@ -22,13 +22,13 @@ AeCairoExternalArray class >> fromHandle: aHandle size: aNumber [
]

{ #category : #testing }
AeCairoExternalArray class >> isAbstract [
AeFFIExternalArray class >> isAbstract [

^ self == AeCairoExternalArray
^ self == AeFFIExternalArray
]

{ #category : #'instance creation' }
AeCairoExternalArray class >> newFrom: anArrayedCollection [
AeFFIExternalArray class >> newFrom: anArrayedCollection [

| newInstance |
newInstance := self newOf: anArrayedCollection size.
Expand All @@ -40,7 +40,7 @@ AeCairoExternalArray class >> newFrom: anArrayedCollection [
]

{ #category : #'instance creation' }
AeCairoExternalArray class >> newOf: aSize [
AeFFIExternalArray class >> newOf: aSize [
"Answer a new instance of the specified size, with autoRelease."

^ (self unownedNewOf: aSize)
Expand All @@ -49,7 +49,7 @@ AeCairoExternalArray class >> newOf: aSize [
]

{ #category : #'instance creation' }
AeCairoExternalArray class >> unownedNewOf: aSize [
AeFFIExternalArray class >> unownedNewOf: aSize [
"Answer a new instance of the specified size. Sender is responsible of freeing handle."

^ self basicNew
Expand Down
4 changes: 2 additions & 2 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ AeCairoExamplesRenderTest >> surfaceWithDottedCircle [
format: AeCairoSurfaceFormat argb32.

"set up dotted dashes"
dashByteArray := AeCairoDoubleArray
dashByteArray := AeFFIDoubleArray
newFrom: { 0.0. gapBetweenDots }.

aContext := aSurface newContext.
Expand Down Expand Up @@ -696,7 +696,7 @@ AeCairoExamplesRenderTest >> surfaceWithTextAsPath [
"Draw dashed stroke using the path"
aContext
sourceColor: Color blue;
dash: (AeCairoDoubleArray newFrom: { 7. 1 }) offset: 3;
dash: (AeFFIDoubleArray newFrom: { 7. 1 }) offset: 3;
lineWidth: 1.5;
stroke.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ AeCairoA8FastGaussianBlurFilter class >> example5DottedCircle [
translateBy: (shadowGap/2) asPoint;
lineWidth: 10;
lineCap: AeCairoCapStyle square;
dash: (AeCairoDoubleArray newFrom: #(0 20)) offset: 0;
dash: (AeFFIDoubleArray newFrom: #(0 20)) offset: 0;
circleRadius: circleRadius;
stroke.
aSurface flush.
Expand Down
2 changes: 1 addition & 1 deletion src/Alexandrie-Cairo/AeCairoContext.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ AeCairoContext >> dashes [
count := self dashCount.
count = 0 ifTrue: [ ^ Array empty ].

aDashArray := AeCairoDoubleArray newOf: count.
aDashArray := AeFFIDoubleArray newOf: count.

self
getDashesInto: aDashArray getHandle
Expand Down
20 changes: 0 additions & 20 deletions src/Alexandrie-Cairo/AeCairoDoubleArray.class.st

This file was deleted.

2 changes: 1 addition & 1 deletion src/Alexandrie-Cairo/AeCairoGlyphArray.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ I'm an array of `AeCairoGlyph`.
"
Class {
#name : #AeCairoGlyphArray,
#superclass : #AeCairoExternalArray,
#superclass : #AeFFIExternalArray,
#traits : 'AeTCairoLibrary',
#classTraits : 'AeTCairoLibrary classTrait',
#category : #'Alexandrie-Cairo-Text'
Expand Down
2 changes: 1 addition & 1 deletion src/Alexandrie-Cairo/AeCairoTextClusterArray.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ I'm an array of `AeCairoTextCluster`.
"
Class {
#name : #AeCairoTextClusterArray,
#superclass : #AeCairoExternalArray,
#superclass : #AeFFIExternalArray,
#traits : 'AeTCairoLibrary',
#classTraits : 'AeTCairoLibrary classTrait',
#category : #'Alexandrie-Cairo-Text'
Expand Down
2 changes: 1 addition & 1 deletion src/Alexandrie-Canvas/AeCanvas.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ AeCanvas >> initializeCaches [

dashesCache := LRUCache new
maximumWeight: 400;
factory: [ :anArray | AeCairoDoubleArray newFrom: anArray ];
factory: [ :anArray | AeFFIDoubleArray newFrom: anArray ];
yourself.

formToCairoSurfaceCache := LRUCache new
Expand Down
2 changes: 1 addition & 1 deletion src/Alexandrie-HarfbuzzCairo/AeHbCairoExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ AeHbCairoExample >> drawDottedHLineCenteredAt: centerY thickness: thickness left
cairoContext
lineWidth: thickness;
lineCap: AeCairoCapStyle round;
dash: (AeCairoDoubleArray newFrom: {0.0. 2*thickness}) offset: 0.
dash: (AeFFIDoubleArray newFrom: {0.0. 2*thickness}) offset: 0.

cairoContext
sourceColor: aColor;
Expand Down

0 comments on commit f9193de

Please sign in to comment.