summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Graphics.cxx
AgeCommit message (Collapse)Author
2021-08-16Drop tools::Rectangle::getX/getY, which are just duplicates of Left/TopMike Kaganski
The change allowed to simplify many places where previously this API was used, to avoid inefficient calculations (e.g., moving rectangle keeping its size, and then immediately changing the size). Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-07vcl: move graphic handling into Qt5GraphicsBackendTomaž Vajngerl
This is an effort to make SalGraphicsImpl mandatory for all backends. This introduces Qt5GraphicsBackend: a subclass of SalGraphicsImpl, which now handles graphic rendering. Change-Id: I42aece59d0c692ca1dd33e30f31c5bcceab02008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113734 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-11-03loplugin:unusedfieldsNoel
Change-Id: Ia8e2a7ce75bfded98e85fa583d1404710069d335 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105249 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-24GetSysFontData is newly unusedCaolán McNamara
and thus SystemFontData Change-Id: I563a6b7c251194cd73c6b0026d4ae8485a057b28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94740 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-03-09tdf#127687 Qt5 introduce basic HiDPI scalingLuca Carlon
For tdf#124292, Qt's own HiDPI scaling was explicitly disabled, but it turns out, you can't really scale QStyle painting then. This patch series had a 2nd approach also used by Gtk+ currently, which relied on the scaling of ths Cairo surface, which works surprisingly good, but has to lie about the real DPI value, so nothing is scaled twice. Also all icons are then scaled instead of rendered with the proper resolution. When HiDPI support in Qt is enabled, and the application is started using QT_SCALE_FACTOR=1.25, Qt simply lowers the reported resolution, keeps the logical DPI value of 96 and changes the devicePixelRatio to the specified value. But LO still expects the real DPI values and sizes, so we have to multiply a lot of rectangles, sizes and positions. The current result is far from perfect, which you can see with the various graphics glitches, but it at least doesn't crash anymore in the ControlType::Editbox sizing code. The main problem is all the up and downscaling in the getNativeControlRegion code, so LO knows the size of the widgets for the correct layouting, since there seem to be no API to get the scaled values from Qt / QStyle. Change-Id: I687b1df6ef27724ce68326d256e9addccd72e759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86239 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2020-03-02Qt5 some refactoring for HiDPI mergeJan-Marek Glogowski
This is a preparatory patch for merging the initial fix for tdf#127687, the Qt5 HiDPI scaling support, and generally to make the style handling code a little bit more readable. It includes: * Moving all lcl_ Qt5Graphics_Controls functions into the class as private functions without lcl_ prefix. * Add three additional helpers - pixelMetric, sizeFromContents and subControlRect - to cut down boilerplate QApplication::style()-> prefixes for the style calls everywhere. * Drop the superfluous Qt5Frame::TriggerPaintEvent functions. * Drop the single, broken maGeometry.nTopDecoration filling. * Split some very long lines of nested call code by using some intermediate variables. * Move a Qt5Data include from hxx into cpp Change-Id: Iae1bfafd14c4163447f3d55e2307f0f617e68a0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89751 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-19widget theme: add file definition theme support to qt5 backendTomaž Vajngerl
Change-Id: I603e75d056a75837353be25f901ab7df6e0cc71a Reviewed-on: https://gerrit.libreoffice.org/83135 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-11-19tdf#128434 correctly release fonts in destructorsJan-Marek Glogowski
This adds ReleaseFonts() calls to all destructors of SalGraphics and TextRenderImpl derivated classes, which implement SetFont. During destruction a base class can't call into derivated classes, as these are already destructed, so we have to spread these calls manually. Change-Id: Ia57db04f7df665e5205212ce512119e2f60e3379 Reviewed-on: https://gerrit.libreoffice.org/82967 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-06-18VCL cleanup WidgetDrawInterfaceJan-Marek Glogowski
I don't understand why WidgetDrawInterface, which is basically a copy of the SalGraphics native controls interface, duplicated it, instead of cleaning things up. The whole commit message of commit 8fcfa3853a81, which added this code, is just: "custom widgets: Custom Widget Themes". That's it. So this patch does, what the original one skipped: replacing the SalGraphics interface with the WidgetDrawInterface. One result is the addition of handleDamage to SalGraphics to correctly handle the damage done by a custom widget theme to the underlying SalGraphics implementation. Change-Id: I5fda1a64b28e6560fb3c62e02b6dcda827f698e2 Reviewed-on: https://gerrit.libreoffice.org/74118 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-08-10Qt5 fix nTransparency handlingJan-Marek Glogowski
So nTransparency is actually also in percent, i.e. max is 100, instead of the full byte range, like alpha colors in Qt and VCL. Fixes "SAL_USE_VCLPLUGIN=qt5 ./bin/run vcldemo --show poly" transparency. Change-Id: I723cbb2d6b5af4a37b18d3e6a5e0c5b81421221a Reviewed-on: https://gerrit.libreoffice.org/58789 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-08-07Qt5 move native control handing from kde5Jan-Marek Glogowski
The native painting code in the kde5 backend is Qt based only. To prevent multiple inheritance, it's moved into an extra class and just leaves the backend specific QImage blitting in the specific SalGraphics implementation. Change-Id: I3d5f58f42a37966794541fe1214c1b9557376a98 Reviewed-on: https://gerrit.libreoffice.org/58652 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-07-06various loplugin in qt5Noel Grandin
loplugin:includeform loplugin:staticaccess loplugin:loopvartoosmall loplugin:redundantcast Change-Id: Ibd4848f0c6076d5ae95fff2853e1f6e0ba1c083b
2018-06-10qt5: hold LogicalFontInstance with rtl::ReferenceKacper Kasper
Build fix after c4c56de1b0e62ec866b519b2b24c5e805f0a86d3. Change-Id: I49303528ccbe49894a0fbae3c24d3f3d08c016eb Reviewed-on: https://gerrit.libreoffice.org/55547 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-01Various trivial loplugin fixes in --enable-qt5Stephan Bergmann
Change-Id: I9539eb77f663e1174919ae801495801f81571710
2018-05-08Refactor CommonSalLayout font handlingJan-Marek Glogowski
Moves all platform specific code from CommonSalLayout into the platform specific plugins. This way the vcl library won't depend on the Qt5 libraries and the Qt5Font header can be moved into the qt5 VCL plugin. While at it, switch the CommonSalLayouts font reference from the FontSelectPattern to the LogicalFontInstance and also add the harfbuzz font handling to the instance. Change-Id: Ida910b8d88837ea949a2f84394ccc0cfae153060 Reviewed-on: https://gerrit.libreoffice.org/47408 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-05-07Move PhysicalFontFace member of FontSelectPatternJan-Marek Glogowski
A FontSelectPattern describes a general font request. It can be used to find the best matching LogicalFontInstance. The instance will be created based on a PhysicalFontFace, which is really a factory since commit 8b700794b2746070814e9ff416ecd7bbb1c902e7. Following this workflow, this moves the PhysicalFontFace pointer to the instance and makes it constant. Which leaves some special symbol font handling code in the hash and instance lookup code path. It used to query the font face directly from the instance. I'm not sure of the correct handling. The related commits where made to fix #i89002#, which has an attached test document. 1. commit 849f618270da313f9339dda29a9f35938434c91d 2. commit 8c9823d311fdf8092cc75873e4565325d204a658 The document is as broken as it was before the patch. The symbol substitution still works, but the 'Q's are missing when displaying a symbol font. I also don't understand all the reinterpret_casts for fake font ids. I guess this was used to prevent the crashes I see, where a PhysicalFontFace referenced in a valid LogicalFontInstance is freed and a later FontId check in the GlyphCache crashes. So this now checks for a valid cache instead. Change-Id: If8ee5a6288e66cfa4c419289fbdd5b5da128c6ea Reviewed-on: https://gerrit.libreoffice.org/47279 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-03-26replace SalColor with ColorNoel Grandin
Change-Id: I615640a378a61cf6e44e84a647ce06bdd8a52807 Reviewed-on: https://gerrit.libreoffice.org/51239 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-08loplugin:useuniqueptr in qt5Noel Grandin
Change-Id: Ic7135e6ca3be7848fa39cd442d6dd716ea090713
2018-01-08-Wunused-parameter in qt5 pluginNoel Grandin
Change-Id: I2d17ccdc9addb911fef8925d87b794075946c3ca
2018-01-03Qt5 fix alpha drawing of start center imageJan-Marek Glogowski
Drawing the bottom-left start center image had multiple errors. New images didn't set the default clip rect and weren't correctly resized. The damage handling was also missing for alpha bitmaps. Change-Id: Idabacbb8b507c990a24006152f064ae4f144b89e Reviewed-on: https://gerrit.libreoffice.org/47277 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2017-11-08Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-formatStephan Bergmann
...even if that can cause reformatting of already formatted code. The problem I came across is that without this something like > namespace { > > void f1(); > > void f2(); > > } (which is quite a common style in the current code base) would be changed to > namespace > { > > void f1(); > > void f2(); > } instead of > namespace > { > void f1(); > > void f2(); > } and I found no other clang-format style option that would result in the presence or absence of an empty line be identical at the start and end of the namespace block. vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the same time, so this commit includes that. Some of those new files had not been formatted at all, so this commit includes their full reformatting changes. Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c Reviewed-on: https://gerrit.libreoffice.org/44450 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-06QT5 implement Graphics damage trackingJan-Marek Glogowski
Since we implement SalGraphics handling like the gtk3 backend, we need damage tracking to queue updates. Since there is no native damage tracking in Qt5, we have to log the damage in our subclassed QPainter, which will queue an update on destruction. Change-Id: Ife17770750a5be9959c2fc2633b422908d196869
2017-11-06QT5 implement alpha based drawingJan-Marek Glogowski
Change-Id: Ide2ef42110798ed061f7e32e49e38b6428c22c01
2017-11-06QT5 port quarz Polgon and PolyPolygon handlingJan-Marek Glogowski
Change-Id: I53807bff3db9c9e4300f03e56857381cad7c9431
2017-11-06QT5 unify Graphics constructorsJan-Marek Glogowski
Change-Id: I85ce73e0e79927fa9233230bc4a9134db4c513dc
2017-11-06QT5 always generate a QPainterJan-Marek Glogowski
Change-Id: Ie8684cd4be56fb6d88d9643a6326307590115a80
2017-11-06QT5 first stab on implementing CommonSalLayoutJan-Marek Glogowski
CommonSalLayout doesn't rally have an interface. It's cluttered with #ifdefs. Currently we have to move the Qt5Font into the VCL library. Someone should refactor this... Doen't render any text yet, but reports some sizes. Eventually that would cut down the public interface again. Change-Id: I12f32affb05b37e070c6cbc80db01779f84590b6
2017-11-06QT5 rename from KF5Jan-Marek Glogowski
Move out of unx, as this will eventually compile on other OS platforms. At least currently it doesn't contain platform dependant code. Change-Id: Iea0bebf574201881ea158381fe7ba8af2a9a6488