Make Cairo::GraphicsContext to inherit from DeviceGraphicsContext
This allows using Cairo's GraphicsContext in views as *the* graphics context
so the whole view is then rendered by Cairo.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Fri Feb 12 16:36:39 2016 +0000
@@ -0,0 +1,16 @@
+
+syntax: glob
+*Init.c
+makefile
+*.so
+*.H
+*.o
+*.STH
+*.sc
+objbc
+objvc
+*.class
+java/libs/*.jar
+java/libs-src/*.jar
+*-Test.xml
+st.chg
--- a/Cairo__CPrimitives.st Fri Jan 09 16:15:59 2015 +0000
+++ b/Cairo__CPrimitives.st Fri Feb 12 16:36:39 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Primitives'
!
+
!CPrimitives class methodsFor:'accessing'!
dllPath
@@ -2144,3 +2145,10 @@
self primitiveFailed
! !
+!CPrimitives class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Cairo__ClockView.st Fri Jan 09 16:15:59 2015 +0000
+++ b/Cairo__ClockView.st Fri Feb 12 16:36:39 2016 +0000
@@ -38,6 +38,7 @@
super mapped.
"Created: / 17-06-2012 / 22:40:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
unmapped
@@ -46,6 +47,27 @@
super unmapped.
"Created: / 17-06-2012 / 22:42:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ClockView methodsFor:'initialization & release'!
+
+initializeForDevice:aDevice
+ "allocate a GraphicsContext for a device"
+
+ aDevice notNil ifTrue:[
+ gc := Cairo::GraphicsContext onDevice: aDevice
+ ] ifFalse:[
+ "should not be reached"
+ GraphicsMedium superclass == DeviceGraphicsContext ifTrue:[
+ gc := self.
+ super device:aDevice.
+ ].
+ ].
+
+ self initialize.
+
+ "Created: / 12-02-2016 / 16:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ClockView methodsFor:'redrawing'!
@@ -159,7 +181,7 @@
cr restore.
"Created: / 27-12-2014 / 00:00:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 01-01-2015 / 12:11:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ClockView class methodsFor:'documentation'!
--- a/Cairo__Content.st Fri Jan 09 16:15:59 2015 +0000
+++ b/Cairo__Content.st Fri Feb 12 16:36:39 2016 +0000
@@ -9,6 +9,7 @@
category:'Cairo-Constants'
!
+
!Content class methodsFor:'initialization'!
initialize
@@ -35,5 +36,12 @@
^CAIRO_CONTENT_COLOR_ALPHA
! !
+!Content class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
Content initialize!
--- a/Cairo__GraphicsContext.st Fri Jan 09 16:15:59 2015 +0000
+++ b/Cairo__GraphicsContext.st Fri Feb 12 16:36:39 2016 +0000
@@ -2,8 +2,8 @@
"{ NameSpace: Cairo }"
-Smalltalk::GraphicsContext subclass:#GraphicsContext
- instanceVariableNames:'handle surface'
+DeviceGraphicsContext subclass:#GraphicsContext
+ instanceVariableNames:'surface crId saved savedPos'
classVariableNames:'Lobby'
poolDictionaries:'Cairo::FontSlant Cairo::FontWeight Cairo::Format'
category:'Cairo-Objects'
@@ -25,7 +25,6 @@
!GraphicsContext class methodsFor:'instance creation'!
onSurface: surface
-
| handle |
self
@@ -36,6 +35,7 @@
^ self new initializeWithHandle: handle surface: surface
"Created: / 28-12-2014 / 23:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 12-02-2016 / 16:19:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GraphicsContext class methodsFor:'accessing'!
@@ -118,6 +118,23 @@
!GraphicsContext methodsFor:'accessing'!
+cairo
+ gcId isNil ifTrue:[
+ self initGC.
+ self assert: crId notNil
+ ] ifFalse:[
+ crId notNil ifTrue:[
+"/ CPrimitives cairo_destroy: crId.
+"/ crId := CPrimitives cairo_create: surface.
+ ].
+ ].
+
+ ^ self
+
+ "Created: / 12-02-2016 / 16:03:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 17:10:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
device
^ device
@@ -130,12 +147,6 @@
"Created: / 02-01-2015 / 12:36:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawableId
- ^ surface drawable
-
- "Created: / 02-01-2015 / 12:37:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
font:aFont
| dfont family slant psize weight |
@@ -154,7 +165,7 @@
self fontSize: psize .
font := ScaledFont family: dfont family face: dfont face style: dfont style size: dfont size.
- font handle: (CPrimitives cairo_get_scaled_font: handle).
+ font handle: (CPrimitives cairo_get_scaled_font: crId).
"Modified: / 09-01-2015 / 15:43:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -168,7 +179,7 @@
lineWidth: w
lineWidth ~~ w ifTrue:[
super lineWidth: w.
- CPrimitives cairo_set_line_width: handle _:w asFloat
+ CPrimitives cairo_set_line_width: crId _:w asFloat
].
"Created: / 17-06-2012 / 21:55:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -185,7 +196,7 @@
"/ paint ~= aColor ifTrue:[
paint := aColor ? Black.
- CPrimitives cairo_set_source_rgba: handle _: (paint red / 100) asDouble _: (paint green / 100) asDouble _: (paint blue / 100) asDouble _: paint alpha asDouble
+ CPrimitives cairo_set_source_rgba: crId _: (paint red / 100) asDouble _: (paint green / 100) asDouble _: (paint blue / 100) asDouble _: paint alpha asDouble
"/ ].
"Created: / 10-07-2008 / 11:18:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
@@ -196,7 +207,7 @@
referenceCount
"Return value or reference counter"
- ^ CPrimitives cairo_get_reference_count: handle
+ ^ CPrimitives cairo_get_reference_count: crId
"Created: / 28-12-2014 / 22:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -213,7 +224,7 @@
lineCap: lc
- ^ CPrimitives cairo_set_line_cap: handle _: lc
+ ^ CPrimitives cairo_set_line_cap: crId _: lc
"Created: / 17-06-2012 / 22:09:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 21:58:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -225,13 +236,13 @@
"set the transformation"
super transformation: aTransformation.
- CPrimitives cairo_identity_matrix: handle.
+ CPrimitives cairo_identity_matrix: crId.
transformation notNil ifTrue:[
- CPrimitives cairo_translate: handle _: transformation translationX asFloat _: transformation translationY asFloat.
- CPrimitives cairo_scale: handle _: transformation scaleX asFloat _: transformation scaleY asFloat.
+ CPrimitives cairo_translate: crId _: transformation translationX asFloat _: transformation translationY asFloat.
+ CPrimitives cairo_scale: crId _: transformation scaleX asFloat _: transformation scaleY asFloat.
] ifFalse:[
- CPrimitives cairo_translate: handle _: 0.0 _: 0.0.
- CPrimitives cairo_scale: handle _: 1.0 _: 1.0.
+ CPrimitives cairo_translate: crId _: 0.0 _: 0.0.
+ CPrimitives cairo_scale: crId _: 1.0 _: 1.0.
].
"Created: / 01-01-2015 / 12:07:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -393,28 +404,28 @@
arcNegativeX: x y: y radius: r from: startAngle to: stopAngle
- ^CPrimitives cairo_arc_negative: handle _: x asDouble _: y asDouble _: r asDouble _: startAngle asDouble _: stopAngle asDouble
+ ^CPrimitives cairo_arc_negative: crId _: x asDouble _: y asDouble _: r asDouble _: startAngle asDouble _: stopAngle asDouble
"Created: / 07-01-2015 / 02:35:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
arcX: x y: y radius: r from: startAngle to: stopAngle
- ^CPrimitives cairo_arc: handle _: x asDouble _: y asDouble _: r asDouble _: startAngle asDouble _: stopAngle asDouble
+ ^CPrimitives cairo_arc: crId _: x asDouble _: y asDouble _: r asDouble _: startAngle asDouble _: stopAngle asDouble
"Created: / 17-06-2012 / 21:50:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:00:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
closePath
- ^CPrimitives cairo_close_path: handle.
+ ^CPrimitives cairo_close_path: crId.
"Created: / 01-01-2015 / 22:42:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
lineToX: x y: y
- ^CPrimitives cairo_line_to: handle _: x asDouble _: y asDouble
+ ^CPrimitives cairo_line_to: crId _: x asDouble _: y asDouble
"Created: / 17-06-2012 / 22:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:00:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -422,7 +433,7 @@
moveToX: x y: y
- ^CPrimitives cairo_move_to: handle _: x asDouble _: y asDouble
+ ^CPrimitives cairo_move_to: crId _: x asDouble _: y asDouble
"Created: / 23-04-2009 / 17:21:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 22:00:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -444,7 +455,7 @@
rh := rh abs.
].
- ^CPrimitives cairo_rectangle: handle
+ ^CPrimitives cairo_rectangle: crId
_: rx asDouble
_: ry asDouble
_: rw asDouble
@@ -465,7 +476,7 @@
setSourceSurface: aSyrface x:x y:y
"raise an error: this method should be implemented (TODO)"
- ^ CPrimitives cairo_set_source_surface: handle _: aSyrface _: x _: y
+ ^ CPrimitives cairo_set_source_surface: crId _: aSyrface _: x _: y
"Created: / 24-12-2014 / 23:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 21:59:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -474,17 +485,44 @@
!GraphicsContext methodsFor:'cairo api - save & restore'!
restore
- ^CPrimitives cairo_restore: handle
+ | savedData |
+ (saved isNil or:[ savedPos == 0 ]) ifTrue:[
+ self error: 'Cannot restore, no save called!!'.
+ ].
+ savedData := saved at: savedPos.
+ saved at: savedPos put: nil.
+ savedPos := savedPos - 1.
+
+ transformation := savedData at: 1.
+
+ ^CPrimitives cairo_restore: crId
"Created: / 17-06-2012 / 21:51:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-12-2014 / 22:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 21:16:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
save
- ^CPrimitives cairo_save: handle
+ | savedData |
+ saved isNil ifTrue:[
+ saved := Array new: 10.
+ savedPos := 0.
+ ].
+ savedPos == saved size ifTrue:[
+ | newSaved |
+
+ newSaved := Array new: savedPos + 10.
+ newSaved replaceFrom: 1 to: savedPos with: saved startingAt: 1.
+ saved := newSaved.
+ ].
+ savedPos := savedPos + 1.
+ savedData := Array new: 1.
+ saved at: savedPos put: savedData.
+ savedData at: 1 put: transformation.
+
+ ^CPrimitives cairo_save: crId
"Created: / 17-06-2012 / 21:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-12-2014 / 22:01:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 12-02-2016 / 21:14:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GraphicsContext methodsFor:'cairo api - stroke & fill'!
@@ -495,14 +533,14 @@
This method calls cairo_paint(), however, #paint is defined in
GraphicsContext as method returning current foreground color/pattern."
- ^ CPrimitives cairo_paint:handle.
+ ^ CPrimitives cairo_paint:crId.
"Created: / 29-12-2014 / 11:28:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fill
- ^CPrimitives cairo_fill: handle
+ ^CPrimitives cairo_fill: crId
"Created: / 10-07-2008 / 09:42:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 22:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -510,7 +548,7 @@
fillAndPreserve
- ^CPrimitives cairo_fill_preserve: handle
+ ^CPrimitives cairo_fill_preserve: crId
"Created: / 17-06-2012 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -519,7 +557,7 @@
showPage
"Makes sense only for PDF surfaces"
- ^CPrimitives cairo_show_page: handle.
+ ^CPrimitives cairo_show_page: crId.
"Created: / 17-06-2012 / 08:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -527,7 +565,7 @@
stroke
- ^CPrimitives cairo_stroke: handle
+ ^CPrimitives cairo_stroke: crId
"Created: / 10-07-2008 / 09:42:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 22:02:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -535,7 +573,7 @@
strokeAndPreserve
- ^CPrimitives cairo_stroke_preserve: handle
+ ^CPrimitives cairo_stroke_preserve: crId
"Created: / 17-06-2012 / 21:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:15:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -545,7 +583,7 @@
font: family slant: slant weight: weight
- ^CPrimitives cairo_select_font_face: handle
+ ^CPrimitives cairo_select_font_face: crId
_: family asString
_: slant asInteger
_: weight asInteger
@@ -555,7 +593,7 @@
fontSize: sz
- ^CPrimitives cairo_set_font_size: handle _: sz asFloat
+ ^CPrimitives cairo_set_font_size: crId _: sz asFloat
"Created: / 23-04-2009 / 17:24:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 02-01-2015 / 01:39:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -563,7 +601,7 @@
showText: aString
- ^CPrimitives cairo_show_text: handle _: aString utf8Encoded
+ ^CPrimitives cairo_show_text: crId _: aString utf8Encoded
"Created: / 23-04-2009 / 17:25:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 22:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -573,7 +611,7 @@
clip
- ^CPrimitives cairo_clip: handle.
+ ^CPrimitives cairo_clip: crId.
"Created: / 17-06-2012 / 21:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-12-2014 / 22:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -597,8 +635,8 @@
[
image bitsARGB32Into: data stride: stride fg: self paint bg: self backgroundPaint.
image_surface := CPrimitives cairo_image_surface_create_for_data: data _: CAIRO_FORMAT_ARGB32 _: width _: height _: stride.
- CPrimitives cairo_set_source_surface: handle _: image_surface _: x asFloat _: y asFloat.
- CPrimitives cairo_paint: handle.
+ CPrimitives cairo_set_source_surface: crId _: image_surface _: x asFloat _: y asFloat.
+ CPrimitives cairo_paint: crId.
] ensure:[
data finalize.
image_surface release.
@@ -676,6 +714,13 @@
!GraphicsContext methodsFor:'finalization'!
+executor
+ ^ super executor
+ "/^ self shallowCopy
+
+ "Created: / 12-02-2016 / 17:04:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
finalization
self destroy
@@ -692,21 +737,53 @@
"Created: / 09-01-2015 / 10:20:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!GraphicsContext methodsFor:'initialize & release'!
+!GraphicsContext methodsFor:'initialization & release'!
+
+createCR
+ "Physically create a Cairo graphics context"
+
+ surface := device cairoSurfaceFor: (device viewFromId: drawableId).
+ crId := CPrimitives cairo_create: surface.
+
+ "Created: / 12-02-2016 / 16:59:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
-destroy
+createGC
+ "physically create a device GC.
+ Since we do not need a gc-object for the drawable until something is
+ really drawn, none is created up to the first draw.
+ This method is sent, when the first drawing happens"
+ super createGC.
+ self createCR
+
+ "Created: / 12-02-2016 / 16:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+destroyCR
"Tell Cairo library to destroy the corresponding C object.
Remember that object is physically destroyed only if internal
refcounter goes to zero. However, after calling destroy,
this instance should be treated as invalid."
- ^ CPrimitives cairo_destroy: handle
+ crId notNil ifTrue:[
+ CPrimitives cairo_destroy: crId.
+ crId := nil.
+ surface destroy.
+ surface := nil.
+ ].
- "Created: / 28-12-2014 / 22:10:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 12-02-2016 / 16:59:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+destroyGC
+ self destroyCR.
+ super destroyGC
+
+ "Created: / 12-02-2016 / 17:01:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeWithHandle:anExternalAddress surface: aSurface
- handle := anExternalAddress.
+ crId := anExternalAddress.
surface := aSurface.
device := aSurface device.
self lineWidth: 1.
@@ -718,12 +795,20 @@
"Modified: / 09-01-2015 / 10:20:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-release
- self unregisterForFinalization.
- ^self destroy
+releaseCR
+ self destroyCR
+
+ "Created: / 12-02-2016 / 17:02:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- "Created: / 28-12-2014 / 23:49:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 09-01-2015 / 10:23:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+releaseGC
+ "destroy the associated device GC resource - can be done to be nice to the
+ display if you know that you are done with a drawable."
+
+ self releaseCR.
+ super releaseGC.
+
+ "Created: / 12-02-2016 / 17:03:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GraphicsContext class methodsFor:'documentation'!
--- a/Cairo__PatternType.st Fri Jan 09 16:15:59 2015 +0000
+++ b/Cairo__PatternType.st Fri Feb 12 16:36:39 2016 +0000
@@ -11,6 +11,7 @@
category:'Cairo-Constants'
!
+
!PatternType class methodsFor:'initialization'!
initialize
@@ -55,5 +56,12 @@
^CAIRO_PATTERN_TYPE_SURFACE
! !
+!PatternType class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
PatternType initialize!
--- a/Make.proto Fri Jan 09 16:15:59 2015 +0000
+++ b/Make.proto Fri Feb 12 16:36:39 2016 +0000
@@ -85,7 +85,7 @@
sed -e "s/\"\$$SVN\-Revision:\".*\"\$$\"/\"\$$SVN-Revision:\"\'$$rev2\'\"\$$\"/g" $< > .stx_goodies_libcairo.svn.st; \
fi
$(MAKE) CC="$(CLASSLIB_CC)" OPT="$(OPT)" SEPINITCODE="$(SEPINITCODE)" STC="$(STC)" STFILE=.stx_goodies_libcairo.svn $(C_RULE);
- sed -i -e "s/\".stx_goodies_libcairo.svn.st\");/\"\stx_goodies_libcairo.st\");/g" .stx_goodies_libcairo.svn.c
+ sed -i -e "s/\".stx_goodies_libcairo.svn.st\");/\"stx_goodies_libcairo.st\");/g" .stx_goodies_libcairo.svn.c
$(MAKE) .stx_goodies_libcairo.svn.$(O)
@mv .stx_goodies_libcairo.svn.$(O) stx_goodies_libcairo.$(O)
endif
@@ -190,7 +190,7 @@
$(OUTDIR)Cairo__UserDataKey.$(O) Cairo__UserDataKey.$(H): Cairo__UserDataKey.st $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_libcairo.$(O) stx_goodies_libcairo.$(H): stx_goodies_libcairo.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontFace.$(O) Cairo__FontFace.$(H): Cairo__FontFace.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/Image.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/XGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/XWorkstation.$(H) $(STCHDR)
--- a/abbrev.stc Fri Jan 09 16:15:59 2015 +0000
+++ b/abbrev.stc Fri Feb 12 16:36:39 2016 +0000
@@ -35,6 +35,7 @@
Cairo::RectangleList Cairo__RectangleList stx:goodies/libcairo 'Cairo-Objects' 1
Cairo::Region Cairo__Region stx:goodies/libcairo 'Cairo-Constants' 0
Cairo::RegionOverlap Cairo__RegionOverlap stx:goodies/libcairo 'Cairo-Constants' 0
+Cairo::ScaledFont Cairo__ScaledFont stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::Status Cairo__Status stx:goodies/libcairo 'Cairo-Constants' 0
Cairo::SubpixelOrder Cairo__SubpixelOrder stx:goodies/libcairo 'Cairo-Constants' 0
Cairo::SurfaceObserverMode Cairo__SurfaceObserverMode stx:goodies/libcairo 'Cairo-Constants' 0
@@ -48,5 +49,4 @@
Cairo::FontFace Cairo__FontFace stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::GraphicsContext Cairo__GraphicsContext stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::Pattern Cairo__Pattern stx:goodies/libcairo 'Cairo-Objects' 0
-Cairo::ScaledFont Cairo__ScaledFont stx:goodies/libcairo 'Cairo-Objects' 0
Cairo::Surface Cairo__Surface stx:goodies/libcairo 'Cairo-Objects' 0
--- a/bc.mak Fri Jan 09 16:15:59 2015 +0000
+++ b/bc.mak Fri Feb 12 16:36:39 2016 +0000
@@ -115,7 +115,7 @@
$(OUTDIR)Cairo__UserDataKey.$(O) Cairo__UserDataKey.$(H): Cairo__UserDataKey.st $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_libcairo.$(O) stx_goodies_libcairo.$(H): stx_goodies_libcairo.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
$(OUTDIR)Cairo__FontFace.$(O) Cairo__FontFace.$(H): Cairo__FontFace.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
$(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DeviceWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\HostGraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\Image.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\XGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\XWorkstation.$(H) $(STCHDR)
--- a/bmake.bat Fri Jan 09 16:15:59 2015 +0000
+++ b/bmake.bat Fri Feb 12 16:36:39 2016 +0000
@@ -7,6 +7,7 @@
@REM Kludge got Mercurial, cannot be implemented in Borland make
@FOR /F "tokens=*" %%i in ('hg root') do SET HGROOT=%%i
@IF "%HGROOT%" NEQ "" SET DEFINES=%DEFINES% "-DHGROOT=%HGROOT%"
+
make.exe -N -f bc.mak %DEFINES% %*
--- a/extensions.st Fri Jan 09 16:15:59 2015 +0000
+++ b/extensions.st Fri Feb 12 16:36:39 2016 +0000
@@ -160,11 +160,12 @@
cr := self cairo.
[
self redrawWithCairo: cr
- ] ensure:[
- cr release
+ ] ensure:[
+ cr ~~ gc ifTrue:[ cr release ].
].
"Created: / 27-12-2014 / 00:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SimpleView methodsFor:'redrawing - cairo'!
@@ -186,10 +187,11 @@
[
self redrawWithCairoBuffered: cr
] ensure:[
- cr release
+ cr ~~ gc ifTrue:[ cr release ].
].
"Created: / 27-12-2014 / 00:30:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:38:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SimpleView methodsFor:'redrawing - cairo'!
@@ -249,10 +251,11 @@
[
self redrawWithCairoBuffered: cr x: x y: y width: w height: h
] ensure:[
- cr release
+ cr ~~ gc ifTrue:[ cr release ].
].
"Created: / 27-12-2014 / 00:31:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SimpleView methodsFor:'redrawing - cairo'!
@@ -264,10 +267,11 @@
[
self redrawWithCairo: cr x: x y: y width: w height: h
] ensure:[
- cr release
+ cr ~~ gc ifTrue:[ cr release ].
].
"Created: / 27-12-2014 / 00:31:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 16:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!XGraphicsContext methodsFor:'accessing'!
--- a/stx_goodies_libcairo.st Fri Jan 09 16:15:59 2015 +0000
+++ b/stx_goodies_libcairo.st Fri Feb 12 16:36:39 2016 +0000
@@ -1,5 +1,7 @@
"{ Package: 'stx:goodies/libcairo' }"
+"{ NameSpace: Smalltalk }"
+
LibraryDefinition subclass:#stx_goodies_libcairo
instanceVariableNames:''
classVariableNames:''
@@ -82,7 +84,10 @@
referencedPreRequisites
"list packages which are a prerequisite, because they contain
classes which are referenced by my classes.
- We do not need these packages as a prerequisite for loading or compiling.
+ We do not need these packages as a prerequisite for compiling or loading,
+ however, a class from it may be referenced during execution and having it
+ unloaded then may lead to a runtime doesNotUnderstand error, unless the caller
+ includes explicit checks for the package being present.
This method is generated automatically,
by searching all classes (and their packages) which are referenced by my classes."
@@ -146,6 +151,7 @@
#'Cairo::RectangleList'
#'Cairo::Region'
#'Cairo::RegionOverlap'
+ #'Cairo::ScaledFont'
#'Cairo::Status'
#'Cairo::SubpixelOrder'
#'Cairo::SurfaceObserverMode'
@@ -159,7 +165,6 @@
#'Cairo::FontFace'
#'Cairo::GraphicsContext'
#'Cairo::Pattern'
- #'Cairo::ScaledFont'
#'Cairo::Surface'
)
!
--- a/vcmake.bat Fri Jan 09 16:15:59 2015 +0000
+++ b/vcmake.bat Fri Feb 12 16:36:39 2016 +0000
@@ -13,8 +13,9 @@
@REM Kludge got Mercurial, cannot be implemented in Borland make
@FOR /F "tokens=*" %%i in ('hg root') do SET HGROOT=%%i
@IF "%HGROOT%" NEQ "" SET DEFINES=%DEFINES% "-DHGROOT=%HGROOT%"
+
+
make.exe -N -f bc.mak -DUSEVC=1 %DEFINES% %*
-