Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2000-03

Device Contexts

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Dyson

I just noticed what could be a problem with the
current device context implementation.

As I see it when a TWinControl or descendent
is created a TDeviceContext is added to the
DeviceContexts list. This is the windows equivalent of a private DC defined in the window flags, the DC value allocated is just index in this list.

However in GetDC there is no checking of the window flags for private DC and it just creates a new DC with default values. I can't see this is a limitation of gtk as we are already are storing the pointers to the GC in the the TDeviceContext.

Ther are many times when you need to call GetDC
just to get a mapping of the hWnd to the DC.

Does GetDC need fixing? or am I missing something
here.

Peter

Reply by email

Marc Weustink
to Peter Dyson
you wrote 6 lines
I just noticed what could be a problem with the current device context implementation. As I see it when a TWinControl or descendent is created a TDeviceContext is added to the DeviceContexts list.

No, a devicecontext is added the moment you ask for it (GetDC)

This is the windows equivalent of a private DC defined in the window flags, the DC value allocated is just index in this list.

This list is only a way to keep track of devicecontext's, a DC is only a pointer to the TDeviceContect.

Show quoted text 5 lines
However in GetDC there is no checking of the window flags for private DC and it just creates a new DC with default values. I can't see this is a limitation of gtk as we are already are storing the pointers to the GC in the the TDeviceContext.

The moment the DeviceContext was implemented, there were no flags. Even now it is not fully implemented. So I created a DC for every call to GetDC.

Ther are many times when you need to call GetDC just to get a mapping of the hWnd to the DC.

I looked at the Delphi/Windows implementation a bit, but every time you do a GetDC, you get a different DC (of the same window). I have to admit that I should have looked at the meaning of a privete DC

Does GetDC need fixing? or am I missing something here.

For now... don't think so. There are more important things. (or have you found something not working because of this)

Marc

Reply by email