TRCanvas canvas/surface

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

TRCanvas canvas/surface

Nicolai Hess-3-2
During debugging the Athens-Crash I found something strange about TRCanvas
(not responsible for the crash)

1. TRCanvas canvas instance variable is not a AthensCairoCanvas at all but an AthensCairoSurface
2. the canvas resp. surface is initialized with TRCanvas initial extent but a change on TRCanvas extent does not change the surfaces extent
3. Is this canvas resp. surface actually used ? Do we only need it to manage some external resources (path/ image forms) ?

Can it be removed or at least renamed to something different.


regards
nicolai

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: TRCanvas canvas/surface

Peter Uhnak
On Mon, Sep 12, 2016 at 11:56:05AM +0200, Nicolai Hess wrote:
> During debugging the Athens-Crash I found something strange about TRCanvas
> (not responsible for the crash)
>
> 1. TRCanvas canvas instance variable is not a AthensCairoCanvas at all but
> an AthensCairoSurface
> 2. the canvas resp. surface is initialized with TRCanvas initial extent but
> a change on TRCanvas extent does not change the surfaces extent
> 3. Is this canvas resp. surface actually used ? Do we only need it to
> manage some external resources (path/ image forms) ?

the surface is recreated when the extent has changed (in TRMorph), plus for some reason it is always initialized twice (presumably by accident),
so I think some fixes are needed there.

Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: TRCanvas canvas/surface

Nicolai Hess


2016-09-12 14:14 GMT+02:00 Peter Uhnak <[hidden email]>:
On Mon, Sep 12, 2016 at 11:56:05AM +0200, Nicolai Hess wrote:
> During debugging the Athens-Crash I found something strange about TRCanvas
> (not responsible for the crash)
>
> 1. TRCanvas canvas instance variable is not a AthensCairoCanvas at all but
> an AthensCairoSurface
> 2. the canvas resp. surface is initialized with TRCanvas initial extent but
> a change on TRCanvas extent does not change the surfaces extent
> 3. Is this canvas resp. surface actually used ? Do we only need it to
> manage some external resources (path/ image forms) ?

the surface is recreated when the extent has changed (in TRMorph), plus for some reason it is always initialized twice (presumably by accident),
so I think some fixes are needed there.

The extent of the surface of TRMorph, yes, but not the extent of the surface in TRCanvas, and  I am not sure why the surface is needed in TRCanvas anyway,
The drawing happens on the surface from TRMorph, no ?

TRMorph allInstances collect:[:s | s extent].
 "{(452.0@430.0)}"
TRCanvas allInstances collect:[:s | s extent].
 "{(500@500). (452.0@430.0)}"
TRCanvas allInstances collect:[:s | s canvas extent] .
 "{(500@500). (500@500)}"

We have on TRCanvas with extent 500@500 and one with 452@430, but both "canvas" inst vars of the TRCanvas
have an extent of 500@500


 

Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: TRCanvas canvas/surface

abergel
In reply to this post by Nicolai Hess-3-2
Hi Nicolai,

This is old code. Maybe at that time we did not have a great understanding of Athens. We use it to create path. For example:

TRBoxShape>>computePath
        canvas ifNil: [ ^ self ].
        path := self athensCanvas
                createPath: [ :builder |
                        builder
                                absolute;
                                moveTo: rectangle topLeft;
                                lineTo: rectangle topRight;
                                lineTo: rectangle bottomRight;
                                lineTo: rectangle bottomLeft;
                                lineTo: rectangle topLeft;
                                closePath ]

We can easily rename the variable. But I am wondering whether we can remove that variable

Cheers,
Alexandre

> On Sep 12, 2016, at 6:56 AM, Nicolai Hess <[hidden email]> wrote:
>
> During debugging the Athens-Crash I found something strange about TRCanvas
> (not responsible for the crash)
>
> 1. TRCanvas canvas instance variable is not a AthensCairoCanvas at all but an AthensCairoSurface
> 2. the canvas resp. surface is initialized with TRCanvas initial extent but a change on TRCanvas extent does not change the surfaces extent
> 3. Is this canvas resp. surface actually used ? Do we only need it to manage some external resources (path/ image forms) ?
>
> Can it be removed or at least renamed to something different.
>
>
> regards
> nicolai
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: TRCanvas canvas/surface

Nicolai Hess


2016-09-13 23:18 GMT+02:00 Alexandre Bergel <[hidden email]>:
Hi Nicolai,

This is old code. Maybe at that time we did not have a great understanding of Athens. We use it to create path. For example:

TRBoxShape>>computePath
        canvas ifNil: [ ^ self ].
        path := self athensCanvas
                createPath: [ :builder |
                        builder
                                absolute;
                                moveTo: rectangle topLeft;
                                lineTo: rectangle topRight;
                                lineTo: rectangle bottomRight;
                                lineTo: rectangle bottomLeft;
                                lineTo: rectangle topLeft;
                                closePath ]

We can easily rename the variable. But I am wondering whether we can remove that variable

Yes I see, it is still needed for creating paths. But it is overall confusing :)

In this piece of code:
TRBoxShape>>computePath
        canvas ifNil: [ ^ self ].
        path := self athensCanvas

canvas is a TRCanvas
self athensCanvas is
self canvas athensCanvas

TRCanvas>>athensCanvas is "self canvas"
and  TRCanvas>>canvas is "check session and create a Surface if needed".

: )




 

Cheers,
Alexandre

> On Sep 12, 2016, at 6:56 AM, Nicolai Hess <[hidden email]> wrote:
>
> During debugging the Athens-Crash I found something strange about TRCanvas
> (not responsible for the crash)
>
> 1. TRCanvas canvas instance variable is not a AthensCairoCanvas at all but an AthensCairoSurface
> 2. the canvas resp. surface is initialized with TRCanvas initial extent but a change on TRCanvas extent does not change the surfaces extent
> 3. Is this canvas resp. surface actually used ? Do we only need it to manage some external resources (path/ image forms) ?
>
> Can it be removed or at least renamed to something different.
>
>
> regards
> nicolai
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev