summaryrefslogtreecommitdiff
path: root/vcl/skia
AgeCommit message (Collapse)Author
2024-06-19Fix typoAndrea Gelmini
Change-Id: I91c9d457aa7b0675df59415416121d2e21c78c63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169153 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-06-17tdf#148569 set extra drawing constraints when scalingPatrick Luby
Previously, setting stroke width and cap was only done when running unit tests. But the same drawing contraints are necessary when running with a Retina display on macOS. Change-Id: I74f7347d30a410f7d3485388ffec61b32730b948 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168973 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-05-10loplugin:ostr in vclNoel Grandin
Change-Id: I5b6ee5bda0c5ff69d297f7f8e87d4c3f3d21791c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167470 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-04-27tdf#153306 prevent subpixel shifting of X coordinatePatrick Luby
HACK: for some unknown reason, if the X coordinate of the path's bounds is more than 1024, SkBlendMode::kExclusion will shift by about a half a pixel to the right with Skia/Metal on a Retina display. Weirdly, if the same polygon is repeatedly drawn, the total shift is cumulative so if the drawn polygon is more than a few pixels wide, the blinking cursor in Writer will exhibit this bug but only for one thin vertical slice at a time. Apparently, shifting drawing a very tiny amount to the left seems to be enough to quell this runaway cumulative X coordinate shift. Change-Id: Ic1ac8a390df51c4aa1cc3183590dce72059af6b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166766 Reviewed-by: Patrick Luby <guibomacdev@gmail.com> Tested-by: Jenkins
2024-04-19tdf#160622: Let SalLayout::GetBoundRect return basegfx::B2DRectangleMike Kaganski
This avoids premature rounding in TextLayouterDevice::getTextBoundRect. The box in D2DWriteTextOutRenderer::performRender needs to be expanded to allow room for the line width (which now will be guaranteed on all sides; previously, the rounding could happen to give no room on some side, even prior to commit 8962141a12c966b2d891829925e6203bf8d51852). Fixes some lines partially cut off in smaller text (or zoomed out). Change-Id: I07335136021f894cf045363b4d736bfab06c64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166236 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-17Drop FRound, and use generalized basegfx::froundMike Kaganski
Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-11Use COMReference in D2DWriteTextOutRendererMike Kaganski
... and simplify the related code. Change-Id: Idaef7c9d725273e202948158e45ded7e7a2f85a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165985 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-31Simplify a bitMike Kaganski
And make font size calculations consistent between SkiaTextRender (x11) and WinSkiaSalGraphicsImpl (win). They already did ~the same, the win case just used an intermediate 'getHScale' coefficient. Change-Id: I90ad4d9c49427465ef3263843b34bd9bc0d762eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165488 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-31Optimize trigonometry a bitMike Kaganski
Change-Id: I2b06c29f6090233325c7ca24fac6d76190d502ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165486 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-29Drop a const_castMike Kaganski
Change-Id: I3eb4547c71768d81bc351f9cb8d0ed1e07c9ebc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165504 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-02Related tdf#158945: Calc: crash when entering text in a cellJulien Nabet
Fixed from driver version 0.405.1237 Change-Id: Ib09bb7a3cb39f5774282b48512bfc6d7954dd4e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164186 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-02-29vcl: separate scanline direction from ScanlineFormatTomaž Vajngerl
ScanlineFormat enum is used to indicate 2 things - scanline format type and scanline direction (TopDown or BottomUp). This makes it complex to manipulate with (using bit arithmetics) and hard to use in general for no benefit, so this commit separates direction out from the ScanlineFormat into ScanlineDirection enum. ScanlineFormat is now just a simple enum class (not a bit field). Change-Id: Iad55d0a4c8c07b71221c2facf7cf6a2d518fec0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163943 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-02-24Related: tdf#159529 eliminate possible memory leakPatrick Luby
Despite confirming that the release function passed to SkBitmap.bitmap.installPixels() does get called for every data array that has been allocated, Apple's Instruments indicates that the data is leaking. While it is likely a false positive, it makes leak analysis difficult so leave the bitmap mutable. That causes SkBitmap.asImage() to make a copy of the data and the data can be safely deleted here. Change-Id: Ib28d70bd5f51e6d3be7a7d7c0d5923d71a6e5390 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163774 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-01-08Related tdf#158945: blacklist Intel Iris XE for Skia hardware renderingJulien Nabet
Change-Id: Ia6a919192316e27e64b2bf9f43eab87671ba8936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161503 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-01-02tdf#158945: blind fix (try to decrease pending operations limit)Mike Kaganski
*If* the crash in the bug was caused by OOM in Vulkan, then *maybe* it was exactly the case mentioned in the comment above: > queueing many tiny bitmaps ... may make [Skia] even run out of memory Let's try to reduce the threshold dynamically, from 1000 down, in the hope that this would avoid the OOM in the specific HW. If it doesn't, it will eventually still abort(). Change-Id: If6151d4f273a5f938030121d13c268bc9906fa23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161516 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-01Revert "Related tdf#158739: blacklist Nvidia RTX 4050 for Skia hardware"Julien Nabet
This reverts commit bc00fb6de3ffd3949a3cdb524f49dac7e32258a9. Reason: the real pb has been fixed thanks to Mike with: https://git.libreoffice.org/core/+/025a49a40a3c0c1be5bf4383e87a1cc60014b7f4%5E%21 tdf#158942: renderMethodToUseForSize may force raster surface Change-Id: I66602d607d3ea933b4035d616ebed7fedebfb9a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161515 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2024-01-01Missing includesMike Kaganski
Obviously included indirectly, but were confusing VS IDE Change-Id: I68e0d9ca96a6fcef1bf8c8f12bfecb543690a75a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161514 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-31Use DBG_TESTSOLARMUTEX instead of SolarMutex::IsCurrentThread in assertionMike Kaganski
It is consistent with all other places where this precondition is tested. Change-Id: I0f99447fea8bb0b5d869f2205a06f954b75b8e0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161505 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-31Replace "size() != 0 with !empty()" (vcl)Julien Nabet
Change-Id: I33fae6ec7d73cf126d49d384a26b19c68cc68b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161490 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-31Avoid unwanted creation of mSurfaceMike Kaganski
Commit 2d1a0d86d2d0c00fcfee61c39f2221e786e4245b (Related: tdf#152703 Prevent possible hang when live resizing a window, 2023-01-06) had added a call to checkSurface in SkiaSalGraphicsImpl::performFlush, to detect resize. This created a regression, seen e.g. in JunitTest_framework_complex, where 'assert(!mSurface)' in SkiaSalGraphicsImpl dtor fails now on Windows with Skia/Vulkan: vcllo.dll!SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() Line 296 C++ vclplug_winlo.dll!WinSkiaSalGraphicsImpl::~WinSkiaSalGraphicsImpl() C++ vclplug_winlo.dll!WinSkiaSalGraphicsImpl::`scalar deleting destructor'(unsigned int) C++ vclplug_winlo.dll!std::default_delete<SalGraphicsImpl>::operator()(SalGraphicsImpl * _Ptr) Line 3170 C++ vclplug_winlo.dll!std::unique_ptr<SalGraphicsImpl,std::default_delete<SalGraphicsImpl>>::~unique_ptr<SalGraphicsImpl,std::default_delete<SalGraphicsImpl>>() Line 3282 C++ vclplug_winlo.dll!WinSalGraphics::~WinSalGraphics() Line 668 C++ vclplug_winlo.dll!WinSalGraphics::`scalar deleting destructor'(unsigned int) C++ vclplug_winlo.dll!WinSalFrame::~WinSalFrame() Line 977 C++ vclplug_winlo.dll!WinSalFrame::`scalar deleting destructor'(unsigned int) C++ vclplug_winlo.dll!SalComWndProc(HWND__ * __formal, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam, bool & rDef) Line 667 C++ vclplug_winlo.dll!SalComWndProcW(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 724 C++ user32.dll!00007ffaab908241() Unknown user32.dll!00007ffaab907efc() Unknown user32.dll!00007ffaab91302d() Unknown ntdll.dll!00007ffaac2d33b4() Unknown win32u.dll!00007ffaa97814d4() Unknown user32.dll!00007ffaab911b4f() Unknown user32.dll!00007ffaab911a1c() Unknown sal3.dll!osl_waitCondition(void * Condition, const TimeValue * pTimeout) Line 93 C++ vclplug_winlo.dll!osl::Condition::wait(const TimeValue * pTimeout) Line 124 C++ vclplug_winlo.dll!SalYieldMutex::doAcquire(unsigned long nLockCount) Line 140 C++ comphelper.dll!comphelper::SolarMutex::acquire(unsigned long nLockCount) Line 87 C++ vcllo.dll!SalInstance::AcquireYieldMutex(unsigned long nCount) Line 147 C++ vcllo.dll!Application::AcquireSolarMutex(unsigned long nCount) Line 510 C++ vclplug_winlo.dll!SolarMutexReleaser::~SolarMutexReleaser() Line 1420 C++ vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 586 C++ vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 390 C++ vcllo.dll!Application::Yield() Line 475 C++ vcllo.dll!Application::Execute() Line 368 C++ sofficeapp.dll!desktop::Desktop::Main() Line 1605 C++ vcllo.dll!ImplSVMain() Line 229 C++ vcllo.dll!SVMain() Line 262 C++ sofficeapp.dll!soffice_main() Line 94 C++ soffice.bin!sal_main() Line 51 C soffice.bin!main(int argc, char * * argv) Line 49 C soffice.bin!invoke_main() Line 79 C++ soffice.bin!__scrt_common_main_seh() Line 288 C++ soffice.bin!__scrt_common_main() Line 331 C++ soffice.bin!mainCRTStartup(void * __formal) Line 17 C++ kernel32.dll!00007ffaab01257d() Unknown ntdll.dll!00007ffaac28aa58() Unknown This is caused by unwanted creation of mSurface in checkSurface, outside of the Init/DeInit pair, called from WinSalGraphics' InitGraphics/DeInitGraphics. Thus an invariant is broken, that only when WinSalFrame initializes its mhLocalDC, its mpImpl is initialized. Deinitialization of mpImpl is thus only called if mhLocalDC is not null. Since flush makes no sense without mSurface, just move the call to checkSurface inside the mSurface check. Hope it doesn't break the fix made in commit 2d1a0d86d2d0c00fcfee61c39f2221e786e4245b. Change-Id: I54442e604ef7c28659b908a7fb1404c9da41b006 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161484 Reviewed-by: Patrick Luby <plubius@libreoffice.org> Tested-by: Jenkins
2023-12-31tdf#158942: renderMethodToUseForSize may force raster surfaceMike Kaganski
Maybe there is a way to avoid this path for the situation of creating small raster surfaces like tooltips, but I have no clue how to do it. Change-Id: I5ab6ccad572e0efd682bf3ef850b68b6b1941537 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161460 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20Related tdf#158739: blacklist Nvidia RTX 4050 for Skia hardware renderingJulien Nabet
Change-Id: I0a6795fafed04e3061cb660736234d6f04eb8872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161032 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-17Fix Skia unit test failure when using a HiDPI displayPatrick Luby
When running on macOS with a Retina display, one BackendTest unit test will fail if the position is adjusted. Change-Id: Iaf8678dd6bcb842bae7a9f45ae632114795e7a1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160878 Reviewed-by: Patrick Luby <plubius@libreoffice.org> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-15Fix Skia unit test failures when using a Retina displayPatrick Luby
When running on macOS with a Retina display, several BackendTest unit tests also need a lower quality scaling level. Change-Id: Ied7141af886357a846f5c4633703114c18dfabf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-13Enable Skia in unit testsMike Kaganski
CreateSalInstance will set aUsePlugin to "svp" in case it is in SAL_USE_VCLPLUGIN environment variable (can be controlled using gb_CppunitTest_use_vcl_non_headless in makefiles); when true is returned from Application::IsBitmapRendering(); or when true is returned from IsHeadlessModeRequested() (e.g., when '--headless' is used in the command line). The latter is true for most of the CppunitTests, including CppunitTest_vcl_skia (it may be controlled by gb_CppunitTest_use_vcl_non_headless_with_windows in makefiles). Then this would ensure that Application::EnableBitmapRendering is called. isVCLSkiaEnabled gave false, when Application::IsBitmapRendering was true, which meant that all tests in CppunitTest_vcl_skia effectively didn't run at all. With this change, on platforms where there's no 'svp' plugin, Skia will be enabled in unit tests in software mode: Windows and macOS. Fix bug in a couple of places, where the SkAutoCanvasRestore needs to be destructed before we call other code, otherwise we hit an assert in destroySurface(). Disable the vcl XOR test and CppunitTest_sd_png_export_tests, in skia mode, just so we can just this commit in, that will need further investigation. Tweak assert in addPolygonToPath to account for case where polygon has zero points. Change-Id: Idc0a66d27deb3cf09f631a42bbe037714ebcdc0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155952 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-24enable using medium/full font hinting even with subpixel positioningFrank Steiner
Change-Id: I1be0670d59163070dccf035ec9c7b0cd4f818c69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159766 Tested-by: Jenkins Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-03tdf#158014 make image immutable after using Skia to invertPatrick Luby
I can't explain why inverting using Skia causes this bug on macOS but not other platforms. My guess is that Skia on macOS is sharing some data when different SkiaSalBitmap instances are created from the same OutputDevice. So, mark this SkiaSalBitmap instance's image as immutable so that successive inversions are done with buffered bitmap data instead of Skia. Change-Id: I8acf90561c48edba14a5f43d16f375f15f25820c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158880 Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2023-10-29simplify calculation in AlphaMask::BlendWithNoel Grandin
spotted by mkaganski Change-Id: If009be48a10ee5c7066a19b969212d10b9f6a83c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158607 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-28Fix testDelayedScaleAlphaImage unit testPatrick Luby
Do not return the alpha mask if it is awaiting pending scaling. Pending scaling has not yet been done at this point since the scaling is done in the code following this block. Change-Id: I995d7f7eca4190f0a8b2094928bd92f718f1d5bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158599 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-10-28Simplify calculationMike Kaganski
... after commit 9b5a00d2281bebaac5fccfde17de6ca5134fc229. It passes a sanity check: for (sal_uInt16 nGrey1 = 0; nGrey1 < 256; ++nGrey1) { for (sal_uInt16 nGrey2 = 0; nGrey2 < 256; ++nGrey2) { const sal_uInt8 n1 = static_cast<sal_uInt8>( 255 - ((255 - nGrey1) + (255 - nGrey2) - (255 - nGrey1) * (255 - nGrey2) / 255)); const sal_uInt8 n2 = static_cast<sal_uInt8>(nGrey1 * nGrey2 / 255); CPPUNIT_ASSERT_EQUAL(n1, n2); } } Change-Id: Ib4b4e700a50027fb502767d72843b271f993f9c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158582 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-27fix erase logic in SkiaSalBmp::BlendWithNoel Grandin
regression from commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 Author: Noel Grandin <noelgrandin@gmail.com> Date: Fri Apr 16 20:33:10 2021 +0200 Convert internal vcl bitmap formats transparency->alpha (II) Change-Id: I5cefa51c96d412f43f73277b590fd861397eb1a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-11tdf#157613 make sure surface is not a null pointerPatrick Luby
Change-Id: I8e3c1be3f05f7ccc1f3ba00093cd71a564e5ae9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157848 Reviewed-by: Patrick Luby <plubius@neooffice.org> Tested-by: Patrick Luby <plubius@neooffice.org>
2023-10-09loplugin:casttovoidStephan Bergmann
Change-Id: Ifa6c18651b2e3faa4500f19217bf11dba10f02fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157709 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-01tdf#156881 Disable Metal with AMD Radeon Pro 5XXX GPUs on macOS CatalinaPatrick Luby
When running macOS Catalina on a 2019 MacBook Pro, unexpected drawing artifacts are drawn so disable Metal for the AMD Radeon Pro GPUs listed for that model in https://support.apple.com/kb/SP809. Change-Id: Iffe44da1f07af2f3bbc367051b5ea4d522216eb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157443 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-09-27Let SkBitmap determine when it is safe to delete the pixel bufferPatrick Luby
Also, make bitmap immutable to avoid making a copy in bitmap.asImage() and, just to be safe, flush the canvas after drawing the pixel buffer. Change-Id: I3ac99cf4acf0bf4c8b274dc73295ca7b9f386c70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157333 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-09-22tdf#157312 Don't change priorityPatrick Luby
Instances of this class are constructed with TaskPriority::POST_PAINT, but then it was set to TaskPriority::HIGHEST when reused. Flushing seems to be expensive (at least with Skia/Metal) so keep the existing priority when reused. Change-Id: Ieb40cd6122f543f76e66456cc92a8643e2320d73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157162 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-31Related tdf#156986: blacklist Nvidia RTX 4070 for Skia hardware renderingJulien Nabet
Change-Id: I3f59be1f5501684238a5ccd2736509afe7ac8d57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156334 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-08-24tdf#156866 use mSize instead of mPixelSize for inverted surfacePatrick Luby
Commit 5baac4e53128d3c0fc73b9918dc9a9c2777ace08 switched to setting the surface size to mPixelsSize in an attempt to avoid downscaling mImage but since it causes tdf#156866, revert back to setting the surface size to mSize. Also, in release builds, tdf#156629 and tdf#156630 reappear in many cases because a BitmapInfoAccess is in a debug block. So, instead of relying on other code to a create a BitmapInfoAccess instance, create one here to force the alpha mask to handle any pending scaling and make the alpha mask immutable. Change-Id: If9f0dfb7b9a82cf7a3e402965ceffd42eace4c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156022 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-23tdf#156854 invert alpha mask for macOS native menu item imagesPatrick Luby
At the time of this change, only the AquaSalMenu class calls this function so it should be safe to invert the alpha mask here. Change-Id: Id67ad0f453bbf88b43d37087eef36a27ced3ad37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155977 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-19Reimplement fix for tdf#156629 and tdf#156630Patrick Luby
Reimplement fix in commit 926c5246b6694d469a6caed5d7ea4c3a68648468 in an attempt to reduce the fix's performance hit. Instead of invoking EnsureBitmapData() and converting the SkImage to a memory buffer, any pending scaling on alpha masks is handled by creating a new, scaled SkImage. Note that in commit 926c5246b6694d469a6caed5d7ea4c3a68648468, EnsureBitmapData() was invoked which converted the SkImage to a memory buffer. That in turn would make Invert() a noop which fixed the related bug where an image has been opened and, before it has been printed or run in a slideshow, the alpha mask would unexpectedly be inverted. So keep this immutable behavior without calling EnsureBitmapData() by adding a new mutability flag. Change-Id: I99dc272b40c53664ea49333402a6a637b1548a5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155850 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-17Skia: Avoid assertion failure inside ProcessAndBlurAlphaMaskMike Kaganski
As seen opening https://bugs.documentfoundation.org/attachment.cgi?id=182024 from tdf#150610. The upscale is pending, and SkiaSalBitmap::mImage is empty here; EnsureBitmapData call works correctly in this case. Change-Id: I71575b09b3b4513b06b55271f6440688785cfb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155792 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-13Related tdf#156630 and tdf#156629 force snapshot of alpha maskPatrick Luby
On macOS, with Skia/Metal or Skia/Raster with a Retina display (i.e. 2.0 window scale), the alpha mask gets upscaled in certain cases. This bug appears to be caused by pending scaling of an existing SkImage in the bitmap parameter. So, force the SkiaSalBitmap to handle its pending scaling. This change consolidates the three duplicate fixes added in the following commits into the AlphaMask(const Bitmap&) constructor. commit 12fd870113a663dde5ceb38c61f1986a34095d0e commit ce2d9f5dd4b6a26847c4779bce4866d969ff4400 From my light testing, the bitmap's SkImage is not scaled except when running macOS with a Retina display. The only exception is that this fix will be triggered on all platforms when exporting to PDF images with an alpha mask. Change-Id: Iea5afd55aac984ca606b2b4b44e457d81d76fac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155568 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-10tdf#156630 eliminate opaque parts when drawing animated PNG imagesPatrick Luby
Due to the switch from transparency to alpha in commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, flip the background colors for the VirtualDevices and invert an alpha mask. On macOS, with Skia/Raster with a Retina display (i.e. 2.0 window scale), the alpha mask gets upscaled. Also, when Skia is enabled, the alpha mask gets inverted in the first export to PDF after launching the application. These two bugs appear to be caused by asynchronous rendering of the returned bitmap. So, we force a copy of the alpha mask in case it changes before the bitmap is actually drawn. Lastly, respect system animation settings when determining if the image should be animated. Change-Id: I8144691a6c99bf8361b301b88d22172991463f26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155429 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-08-09vcl: Organize CoreText font code a bitKhaled Hosny
The code was all over the place with classes split between files or grouped in some files and I couldn’t make a head or tail of it. Move each class to a dedicated source/header file. Change-Id: I35daa05b4684c13339c637819dc30fa47a60cf65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155503 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-31all drawPolyPolygon variants return true nowCaolán McNamara
since: commit 4998de76ed1da4039e30718941d50d6f1dfe4f82 Date: Sun Jul 30 07:40:48 2023 +0000 tdf#156230: Drop freshly unused GenPspGfxBackend Change-Id: I7fc2a068f807777ed392c5d58772d130bf7f51c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155076 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-31supportsOperation OutDevSupportType::B2DDraw is always true nowCaolán McNamara
since: commit 4998de76ed1da4039e30718941d50d6f1dfe4f82 Date: Sun Jul 30 07:40:48 2023 +0000 tdf#156230: Drop freshly unused GenPspGfxBackend Change-Id: I1adc30a60aec0c5aab9289e9c0505d1dbad10631 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155074 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-25loplugin:redundantcastNoel Grandin
after commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 Author: Noel Grandin <noelgrandin@gmail.com> Date: Fri Apr 16 20:33:10 2021 +0200 Convert internal vcl bitmap formats transparency->alpha (II) Change-Id: Ia0b29e87696b99459c62275898e1ec47283072b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154883 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-25Convert internal vcl bitmap formats transparency->alpha (II)Noel Grandin
(Second attempt at landing this) Image formats and graphics APIs use alpha, not transparency, so change our internal formats and data structures to work directly with alpha, so we don't need to modify data before we push it to graphics APIs. Add a couple of new Color constants to make the intention of the vcl code clearer. Notes (*) On macOS, tweaking the logic in CreateWithSalBitmapAndMask to more accurately reflect the requirements of the CGImageCreateWithMask function seems to fix some tests. (*) The vcl code does not properly support gradients with transparency. So the previous code was wrong, and this change is going to result in slightly different wrongness. Change-Id: I9e21c2e98d88ecfdc5f75db13bd1ffff7c38db98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114168 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-23vcl: Drop now unneeded DevicePoint typedefKhaled Hosny
It has been always typedef'd to basegfx::B2DPoint since: commit 5e218b5c51f7d9cd10bd9db832879efca41b9c75 Date: Wed Jan 12 21:19:32 2022 +0000 always use B2DPoint for DevicePoint Change-Id: I9f5202d5a71c77dd79f1759923917c26bf68a9af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154632 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-23vcl: TextRenderModeForResolutionIndependentLayout → SubpixelPositioningKhaled Hosny
Change-Id: I8698d0f74889ac8a7de64a97e8cf0e8878ef7fc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154517 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>