summaryrefslogtreecommitdiff
path: root/vcl/inc/skia/win
AgeCommit message (Collapse)Author
2024-11-18SalGraphics does not need virtual freeResources()Noel Grandin
it is only called to do one thing, in X11SalGraphics, so make it private to that class, and rename it to better fit its purpose. Change-Id: I16ea2f86f8b596351354faa80bb2bab4d2ac6e7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-08-20Implement Custom Font Collections on pre-Windows 10 systemsMike Kaganski
Commit 68818db0ec0e9c308c8a0772d46af551f439b32c (build a IDWriteFontCollection1 of our FR_PRIVATE fonts, 2022-01-11) used dwrite_3.h, which has API available only starting from Windows 10. For pre-Windows 10 versions, there is a different way to implement this, as explained at https://learn.microsoft.com/en-us/windows/win32/directwrite/custom-font-collections This change implements that more complex way as a fallback, until we bump the baseline. Allows to not fall back to gdi in Skia, like with the original commit, just on older Windows versions. Change-Id: Ieca13e4a04bc72ce877ab9b512c7821d5466cb70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172090 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-19vcl: move creating DWFontFace to WinFontFaceKhaled Hosny
Change-Id: Ie0e94787d962eaec7753ae50d548ad8655dbc209 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142957 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-11-19vcl: move creating DWriteFactory to a centeral placeKhaled Hosny
We already have code in two places to create it, and I will need it in yet another place. Change-Id: I12dee85347a3894045c345b0ec9d5e02c493c218 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142956 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-03-16throw away skia control cache on theme changeCaolán McNamara
Change-Id: Idd21e966cf2c9b246c7484ba6c118c872a3dbac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131568 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-11build a IDWriteFontCollection1 of our FR_PRIVATE fontsCaolán McNamara
so we don't need to fallback to gdi in skia for those we build it incrementally as GetFontFromFontFace fails in the system font set Change-Id: I2ac6d151657b9b720eed46dd7bcee0e9682e462a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127877 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27vcl: move FontSelectPattern to own file and into vcl::font namespaceChris Sherlock
Change-Id: I2f01a8e67c52ece9b434777203aa9fbc9ac8be02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122613 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-09-21vcl: add sal/config.h in preparation for patchChris Sherlock
The convention is that we need to add sal/config.h to the start of files. This patch is created in preparation of a patch I have queued to test and move PhysicalFontFace to vcl::font namespace. Change-Id: I15dd24d7f01e077d407ac192a0413d796517eb72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122228 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-20tdf#124176 - Use pragma once instead of include guardsChris Sherlock
This patch is created in preparation of a patch I have queued to test and move PhysicalFontFace to vcl::font namespace. Change-Id: I805a8bd1fa881fc4bc6d2f26f1051b9247587701 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122226 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-31reduce code duplicationLuboš Luňák
Change-Id: I31ee84be7ebee7f1644d7fd43bbc951abd2842d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121328 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-08-25use our own Skia surface when using GPU screen drawingLuboš Luňák
Previously the code called window context's getBackbufferSurface() once, and the repeatedly used it for drawing and then did swapBuffers(). This worked until version chrome/m91, now Skia requires that a screen drawing pass is calling getBackbufferSurface(), drawing to it and calling swapBuffers(). Since we do not always draw full window content and instead keep previous content, use a separate offscreen surface for that and for actual screen drawing just blit that to the screen surface. Change-Id: I36a5b3bb23a085936f4473a0e00d8e04c6b40dab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120966 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-08-24initial Metal support for Mac/SkiaLuboš Luňák
This also required changing SkiaSalGraphicsImpl to have sk_app::WindowContext as an internal detail inaccessible to the base class, since the Mac implementations cannot use it as is. Change-Id: I2424f0b887c79ee91c3bd0f1477b0745f9540247 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120909 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-04-07cache Skia fontLuboš Luňák
The conversion costs a little bit and it was done for each drawing. Change-Id: Ifaad42308213f15839d9277beb837d21535bfc25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113735 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-03-09loplugin:staticmethods (clang-cl)Stephan Bergmann
Change-Id: I0a58f7dda3406509344d791a5e24df22a69b2478 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112179 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-03-01make sure Skia DWrite matches the given HFONT exactly (tdf#137122)Luboš Luňák
The problem appears to be that we use our private copy of the Dejavu Sans fonts, installed using AddFontResourceExW( FR_PRIVATE ), but that's not for whatever reason available for DirectWrite, which made CreateFontFromLOGFONT() find the system-installed Dejavu Sans, and if there was a difference between the two, then incorrect glyph ids were used. Use CreateFontFaceFromHdc(), which seems to match exactly. For private fonts this later fails the check with GetSystemFontCollection(), which would be nice to handle somehow, but I don't know how to get a font collection containing those fonts other than modifying SalFont to use DirectWrite API to install the fonts. Change-Id: I10d8fcb618f3b4decbb0198274331d7beaf843d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111522 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-03-01it's enough to have one Skia font managerLuboš Luňák
Change-Id: I5dd29178e1a1ec1081820912f49fd387eb3f822b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111521 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-12-07remove WinGlyphCache and related codeLuboš Luňák
The code for separately rendering glyphs was used only by OpenGL code (and temporarily by Skia code). Change-Id: I8eee764045273705c108f3734b330a2237de15f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107291 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-11-17set Skia pixel geometry for every surfaceLuboš Luňák
Skia update chrome/m88 removed the possibility to call SkFontLCDConfig::SetSubpixelOrder() to set subpixel setup for all surfaces. So I guess now we have to explicitly pass SkSurfaceProps to every single SkSurface we create. Change-Id: I15be37ba9301c92d0cb109e88f3d1396a7223208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105922 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-11-17update Skia to chrome/m88Luboš Luňák
Change-Id: I74c19597b07e9d07ee90e4191b75787241fdd845 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105829 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-09-30make OutputDevice::Flush() also flush SkiaLuboš Luňák
Skia uses an idle timer to flush buffered Skia drawing. This has the problem that if there's a lot to do, the actual drawing to the screen may become starved and not update. Fortunately there's OutputDevice::Flush() that is called e.g. during Impress animations, so make that also work for Skia, which should make things somewhat smoother. Change-Id: Ia8629e63dc7d7a2d7200c033bc2dc2c51f6caf0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103675 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-09-23if allocating Vulkan surface fails, fall back to Skia raster surfaceLuboš Luňák
Occassionally there may be very large surfaces, such as in tdf#135952. Try to fall back to raster, which is more likely to succeed, given that it uses system RAM instead of video RAM. Change-Id: I81994b174e5e52066eacc5f8778e9469b042f9c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103170 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-04remove old Skia text render methods that do not use Skia directlyLuboš Luňák
The cairo-based method on Unix and manual glyph handling way taken from GL on Windows should be longer be needed, now that using Skia itself for text rendering seems to work fine. This reverts more or less reverts the following commits: b1d3ef798a89d11b853c467fa9ce0fe6ed235735 5ac9a62f3a354db80837bdd1c95b763989b303bb 619959827003814053a5e9ec81acfd07b3aa270a 6f5c85daa0e5073d87d1d7699bfa59af159686ca ad3580df085b3a3d66eb73cae997ea5ca178ccc1 f109a1ac6fdf0c878d53dfea6fceffd93248608f 59205c742c43b4c456b69c3fd94e7fa35ff3eec0 Change-Id: Ib28b2469c7d6471c227bb2aa08d5485bb24c2fe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93428 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-10prefer DirectWrite for Skia's Windows text renderingLuboš Luňák
Change-Id: Ibfb6206751126def10905bb22effbe1a947cd6d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91968 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-18implement text rendering using directly Skia (Windows)Luboš Luňák
The Windows code needed for Skia text rendering. Like with the X11 code, the font is slightly lighter than with Skia disabled, but otherwise it seems to work. And like the X11 code this also requires patching Skia to use the font we want. Change-Id: Ib5ba52e4ba51b6523617072b77ed5446e7343f46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90582 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-12rework Skia setupLuboš Luňák
Calls to SkiaHelper::isVCLSkiaEnabled() may be done from many places, even if LO uses a VCL plugin that doesn't use Skia, which leads to the Skia code not being prepared properly (and crashing/asserting). So make the SalInstance of those relevant VCL plugins call a setup function that is required for Skia actually getting enabled. Avoids crashes/asserts in the About dialog if the Skia UI checkbox is enabled but e.g. the KF5 VCL plugin is actually used. Change-Id: Ib56a5f32e88bd130a4c564031313f85e99898ba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90376 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-30again finally(?) fix Skia Windows widget drawing (tdf#130051)Luboš Luňák
I was correct to see in 202146901b6fbab92 that the black bitmap was in premultiplied alpha, but what I missed what that some controls keep the alpha set at zero (and only some work properly). So go back to the algorithm of synthetizing alpha from the red channel, compute it properly (before it was using alpha channel by mistake), and treat the data properly as premultiplied. This hopefully finally makes all Windows control widgets work. Change-Id: If2716eb8ecf623fcc57ee1db5904edfaee679aa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87734 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-20remove outdated Skia TODO commentsLuboš Luňák
Change-Id: Ia9925a703a4adca41e056916d285c21e5de4898f
2020-01-16use surface atlas for Skia text drawing on WindowsLuboš Luňák
Just like with the OpenGL case the idea is that rather than caching many tiny surfaces for each glyph it should be more efficient to have large surfaces with the glyphs packed inside. Change-Id: I4bc6ece40d4bc85d373340bd03f959fde3a45abf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86777 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-12finally fix Skia Windows widget drawing (tdf#129416)Luboš Luňák
So much time wasted just because c6b66646870cb2bf couldn't be bothered spending a minute or two explaining the weird black/white alpha hack that it turns out is not even necessary as the resulting image is incidentally in the premultiplied alpha format. Change-Id: I810458a670b2c0c8047118f55f58bf588a37f9f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86569 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-12make Skia Windows widget drawing use correct alpha (tdf#129074)Luboš Luňák
The OpenGL code made the widget drawing use two variants drawn on black and on white, for reasons not explained in 3149cc341b1866d215110f0783227549a99b5920 (probably the Windows API doesn't handle alpha completely correctly or whatever). This means that getting the actual alpha requires a custom algorithm that needs to be implemented manually for Skia use. Change-Id: I1438f3829a1bdeda9e55700c4a397c60d5663446 Reviewed-on: https://gerrit.libreoffice.org/84948 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-06make Skia Windows text rendering use SkImage instead of SkBitmapLuboš Luňák
This will allow making it GPU-backed, as SkImage can be GPU-backed, SkBitmap cannot. Change-Id: I047eefe83741a036d372d39e5fc6a4fa400e6504 Reviewed-on: https://gerrit.libreoffice.org/84559 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-05Silence loplugin:unnecessaryoverride (clang-cl)Stephan Bergmann
("public virtual function just calls public parent") Change-Id: Ifd8d6c794ae32af1fe5d2a97389ec87394fdffbc Reviewed-on: https://gerrit.libreoffice.org/84512 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-27make Skia GPU offscreen surfaces work with unittestsLuboš Luňák
Skia is now patched to be able to create also invalid sk_app::WindowContext that will just initialize the shared GrContext. And always use that GrContext, even for tests, because some tests first create a offscreen surfaces and only later create windows, which before this patch led to mixing GrContext instances. Change-Id: Ic79c0719f98f6ac48527c2ea2a9a9a69412adeff
2019-11-27implement Skia native controls drawing/caching for WindowsLuboš Luňák
This actually fixes a number of drawing problems (e.g. highlight in popup menus), it seems the other code path is buggy. Change-Id: Iea697f577d08d20e338224d5ff5b3bf7b653f8d1
2019-11-27fix Skia Windows text renderingLuboš Luňák
There are two cases in WinSalGraphics::DrawTextLayout(), with and without cached glyphs: - Cached case DeferredTextDraw() gets data as BGRA with the glyph drawn in white, it just needs to be modulated to the proper color and drawn. - Uncached case DrawTextMask() gets data as BGRA with A invalid, it must be used as mask for the color to drawn, but without the inverse alpha VCL idiosyncracy that DrawMask() handles. Change-Id: I05dcec994df68d5986cd85cffa42a8f9f23c42c4
2019-11-27implement pruning in SkiaGlobalWinGlyphCacheLuboš Luňák
Currently based on identifying the SkBitmap's by their getPixels(), but this may need changed later since it's probably going to be more performant to use SkSurface. Also move the cache pruning out of AllocateTexture(), as that may possibly remove elements that would be used by DrawCachedGlyphs(). Change-Id: Ide2de752f634593b97573667af49b7aa9ec1f47f
2019-11-27remove some obsolete Skia TODO'sLuboš Luňák
Change-Id: I11ec226a627e98552bd35753aa5a8fbcfca66186
2019-11-27basic implementation of Skia text drawing on WindowsLuboš Luňák
Change-Id: If66e92aef04cd5bbeb22b8c5da65b7b9c77fed23
2019-11-27refactor Windows OpenGLGlyphCache stuff to be reusable for SkiaLuboš Luňák
Basically just remove 'OpenGL' from names of most of the classes, turn them into base classes that have OpenGL subclasses that actually implement the functionality. Change-Id: Idf1f347cebc2a417bda37d6955201c775ecb0890
2019-11-27initial implementation of Skia drawing on screen in WindowsLuboš Luňák
Change-Id: I1562bd2cfd1862947042bef3343aefd851a65002