-
Content Count
2876 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Anders Melander
-
TBitmap.AlphaFormat is broken beyond repair - literally. See: https://quality.embarcadero.com/browse/RSP-26621 If you need to handle 32-bit RGBA bitmaps, use something that was designed for it.
-
...depending on your definition of "soon" 🙂
-
A Conditional Ternary Operator for the Delphi
Anders Melander replied to EugeneK's topic in RTL and Delphi Object Pascal
FPC seems to have accepted (or rather resigned to) the Delphi syntax: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1037 ...which is a present surprise, given their usual attitude towards all things Delphi (see the inline vars discussions, for example). -
A Conditional Ternary Operator for the Delphi
Anders Melander replied to EugeneK's topic in RTL and Delphi Object Pascal
Perhaps, but I seriously doubt that it's a representative metric with regard to the needs of the current Delphi users. In all of the Delphi shops that I've ever worked in, I think I was the only one who ever posted something there and even I gave up on that in the end. -
A Conditional Ternary Operator for the Delphi
Anders Melander replied to EugeneK's topic in RTL and Delphi Object Pascal
Yeah, right 🤦♂️ More syntactic sugar, the compiler codegen is still a joke, and we still haven't got SIMD intrinsics. The only time I've ever wished for a ternary operator was when porting C code and being in a rush. But I wouldn't mind all this fluff (since I don't have to use it) - if they would also throw an occasional bone to those of us that need low level performance. Yes, but you don't have to use it. -
if Obj <> nil then Obj.Free
Anders Melander replied to EugeneK's topic in ICS - Internet Component Suite
Delphi 1 ; procedure TObject.Free ObjectFree: MOV BX,SP LES DI,SS:[BX+4] MOV AX,ES OR AX,DI JE @@1 MOV AL,1 PUSH AX PUSH ES PUSH DI LES DI,ES:[DI] CALL ES:[DI].vtDestroy @@1: RETF 4 Delphi 2 procedure TObject.Free; asm TEST EAX,EAX JE @@exit MOV ECX,[EAX] MOV DL,1 CALL dword ptr [ECX].vtDestroy @@exit: end; -
Are TInterlocked.Exchange and CompareExchange implementation really Atomic with class types??
Anders Melander replied to @AT's topic in RTL and Delphi Object Pascal
Again: There is no type conversion. A hard type-cast is not a type conversion. It's just telling the compiler to treat a variable as a specific type even though it actually is another type. The compiler allows this because the types are of the same binary size. -
Are TInterlocked.Exchange and CompareExchange implementation really Atomic with class types??
Anders Melander replied to @AT's topic in RTL and Delphi Object Pascal
Why? What in that assembler makes you think that? TInterlocked.Exchange(pointer, pointer) and TInterlocked.Exchange(TObject, TObject) are both implemented with a call to AtomicExchange. That's the: call $003819a8 There's no type conversion as such. The compiler just doesn't inline the call as it should. -
"Png to pixel-perfect svg conversion" (I didn't make this)
Anders Melander replied to Tommi Prami's topic in I made this
Can you ask him what he did? I can't decipher it from the commit diff. The algorithm appears unchanged though. -
Limit TAction shortcut to a particular control
Anders Melander replied to Dmitry Onoshko's topic in VCL
My guess would be that you could just disable the TListView actions when the control isn't focused. -
"Png to pixel-perfect svg conversion" (I didn't make this)
Anders Melander replied to Tommi Prami's topic in I made this
Fair point. FWIW, I doubt that the method it uses can be improved much; Small color bitmaps often employ techniques such as unconscious inference, color psychology, and patterns to trick the brain into producing a better image than what would normally be possible given the available pixels. Larger bitmaps is another story. -
"Png to pixel-perfect svg conversion" (I didn't make this)
Anders Melander replied to Tommi Prami's topic in I made this
What's the use case for this? I mean what problem does it solve? Given that it just converts pixels to vector rectangles I don't really see the point. The blurriness you get when upscaling a bitmap is by design. You can just use another resampling method if the blur is a problem. (Just thinking out loud, so to speak; I understood that you aren't the author) -
Exactly.
-
That's a really stupid chart; It's displaying percentage of "marketshare". But what is the market here? It's the OS market - regardless of platform. So your server gets a vote, your fridge, your phone, your car, your nuclear submarine targeting control system, they all get a vote. Windows and the VCL primarily targets the Server or Desktop segment so those are the only that are relevant. It's pretty irrelevant that the majority of smartphones are running Android and the majority of embedded systems are running Linux, because those platforms are not targeted by Windows or the VCL. I believe Linux surpassed Windows in the server segment many years ago, but we can't see that from the chart.
-
Calling routines overhead
Anders Melander replied to PeaShooter_OMO's topic in RTL and Delphi Object Pascal
Profile it. The significance of the overhead really depends on what the routine is doing and how often it is called. For example if the call overhead is X but the routine itself takes 1000*X to execute then the overhead is insignificant. Apart from the overhead of the call itself there's the overhead of passing parameters. You need to learn how parameters are passed in order to optimize them. Not all parameter types can be passed in registers, Delphi doesn't use all available registers, 32-bit and 64-bit does things differently, etc. Also be aware that if you pass literal floating point numbers as parameters, the compiler might not consider the literal values to be the same type as the parameter which means that it will produce code to convert the values to the correct type. For example, if the parameter type is Single and you need to pass 0.5, then pass it as Single(0.5) - or declare a typed constant with the value and pass that. Set Code Inlining Control=Auto to have the compiler automatically inline small routines. With regard to writing stuff in assembler be aware that assembler routines can't be inlined so the call overhead becomes mandatory. For example, in my code one constant bottleneck is calls to Round and Trunc. I have assembler versions of these two functions which are much faster but unfortunately the call overhead completely eliminate the performance gain so they are basically useless. It's beyond me why Delphi doesn't implement these two as intrinsics. They are listed as such but they are implemented as regular functions. Not only that, but the Pascal version will provide a reference implementation to test and benchmark against and it will help documenting what the assembler versions does. -
LoadLibrary and FreeLibrary notification
Anders Melander replied to Pierre le Riche's topic in Windows API
LdrRegisterDllNotification (Vista+) LdrInitShimEngineDynamic (undocumented, XP+ AFAIK) -
Regression - Delphi 12 - Unable to debug dynamically loaded packages
Anders Melander replied to @AT's topic in Delphi IDE and APIs
They are probably too busy Getting Real Help For Free With Code Reviews, Pull Requests, And Git Commits. 🤡 -
AI and an HTTP caching bridge
Anders Melander replied to Yaron's topic in Algorithms, Data Structures and Class Design
No. You are wasting your time. -
Looking for CBuilder/VS help on C open source project
Anders Melander replied to Vincent Parrett's topic in Job Opportunities / Coder for Hire
QuickJS is a javascript engine while pas2js is a transpiler that emits javascript. Not even remotely the same thing. -
TeeBI free full sources released
Anders Melander replied to david berneda's topic in Delphi Third-Party
Needs more arrows! -
https://en.delphipraxis.net/search/?&q=profilers&search_and_or=or&sortby=relevancy https://www.google.com/search?q=delphi+profiling A few versions (around XE) had a limited version of AQTime bundled in. Apart from that it's hardly their area of expertise and it's been ages since they had resources to spare for anything but the core product. That will never happen. There's simply no benefit for them in open sourcing it, only expense, and it probably also contains code that can't be open sourced.
-
A window will only receive mouse messages if the mouse cursor is within its client area or it has captured the mouse. I don't think a hint window will satisfy either of those criteria. See also: https://learn.microsoft.com/en-us/windows/win32/inputdev/about-mouse-input
-
Is it possible to implement floating/fully custom Dropdown Menus?
Anders Melander replied to araujoarthur's topic in VCL
It took me a good while to spot the difference between the two screenshots but I get your meaning. AFAIK it's possible to control DevExpress' skinning of standard VCL controls to some degree. See TdxSkinController.OnSkinControl The dependencies though 😕 -
Is it possible to implement floating/fully custom Dropdown Menus?
Anders Melander replied to araujoarthur's topic in VCL
The easiest way is probably to just use a TForm as the poup. You need to: Display the form with ShowWindow(SW_SHOWNA). Handle WM_NCACTIVATE to avoid the form activating when clicked. In CreateParams: Set Params.WndParent to the parent form. Add WS_POPUP and WS_CLIPCHILDREN to Params.Style and exclude WS_CHILD. Add WS_EX_TOPMOST and WS_EX_TOOLWINDOW to Params.ExStyle. If you will be implementing the form shape with alpha blending then you also need to add WS_EX_LAYERED. Shape the form either with alpha blending (WS_EX_LAYERED and SetLayeredWindowAttributes) or with regions (I can't remember the APIs for that OTOH). I'm sure that if you search github for the above (with lang:pascal) that you can find some Delphi examples. See also: http://melander.dk/articles/alphasplash/ ...or you could just throw some $$$ at DevExpress and use their TdxCalloutPopup control: -
programmatically determine the edition of RAD Studio 12.3
Anders Melander replied to dmitrybv's topic in Delphi IDE and APIs
Oh - You meant what version of RAD Studio is installed on the local system. I think the InstalledUpdates registry key is the closest you can get. There's no guarantee that it's valid though since it's only informational.