Age | Commit message (Collapse) | Author |
|
The code already tries to hide the cost of the high-quality bicubic
scaling by caching, but there are still cases where there's too
much scaling done. Since this is only drawing to screen, use
only bilinear+mipmap scaling in raster mode, which should be good
enough (it's what the "super" scaling VCL algorithm for
BmpScaleFlag::Default does as well).
Change-Id: I75c86932e097411422dc1ef5e0534059dbf11ff8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126326
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
(cherry picked from commit 0a596fbd94e1750e9d1f5cdab624c719b33c3ab4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126296
|
|
All tests still pass, so the end result should be the same, but
this way it's done in one call.
Change-Id: If5da34837a45ad600ae30568e4ba7651ac5838bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125644
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
I'll want some common extra functionality there later.
Change-Id: I249f9ca4662fc8e8d52c58b1bd33293f363464d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125643
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I16d32d51266fc32e8ee37f9e1deed4c9577764b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
The scenario is that something scales a bitmap and then asks for it
to be drawn (possibly drawn scaled again). One example is
OutputDevice::DrawBitmap() subsampling the bitmap that according
to c0ce7ca4884f7f6d1 is supposed to improve quality with headless(?)
backend, but with Skia it's pointless and it breaks things like
caching during repeated drawing, because then GetSkImage() will need
to generate a new SkImage each time.
Since Skia backend uses delayed scaling, these cases can be sorted
out by checking the stored SkImage and using it if suitable, as
the original image is as good as the rescaled one, but often
it's better - it may be cached, sometimes the scaling operations
cancel each other out (often the case in HiDPI mode).
Change-Id: I0af32f7abdf057a3bdda75247d2dc374eaf1bc4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125311
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
They are just a set of small functions, and I sometimes need
to debug optimized builds too.
Change-Id: I6350476e8c7fef85460a88b9e3d56d02213764ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125310
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I09a1921e203e1088577abf75350c8b41e4c78381
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125265
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Since the image will be actually eventually drawn twice as big,
cache an image that is twice as big.
Change-Id: Iea0340cd92c102e453330723c797659c742feb63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125263
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
The basic idea is the same as the 'aqua' backend, simply set up
a scaling matrix for all drawing. That will take care of the basic
drawing everything twice as large, which is twice the resolution.
And then blit this data to the window, which expects data this way.
Converting back from backing surface needs explicit coordinate
conversions, and when converting to a bitmap the bitmap needs
to be scaled down in order to appear normally sized. Fortunately
I've already implemented delayed scaling, which means that if
the bitmap is drawn later again without any modifications, no
data would be lost (to be done in a follow-up commit).
Unittests occassionally need special handling, as such scaling
down to bitmap not being smoothed, because they expect exact
color values.
Change-Id: Ieadf2c3693f7c9676c31c7394d46299addf7880c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125060
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
It seems that manually writing a shader that does the same
as SkBlendMode::kDifference works fine even though the blend mode
crashes e.g. on Windows/AMD. So get rid of the memory<->GPU
conversions and use the shader as a workaround.
Change-Id: I971deeeb98f40e5ffa90f6a8dd7b0b21ec491c1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125101
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
The size of the alpha image does not really depend in mPixelsSize,
it's created on demand and it's just necessary to check if it
has the right size.
Change-Id: Ic16c7c2b202be31c22b21b0c5ee720bda955bbbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125059
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: Ib78c661ec82456386d79680f106b6d14b66f450f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125058
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I2f01a8e67c52ece9b434777203aa9fbc9ac8be02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122613
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
|
|
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>
|
|
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>
|
|
Change-Id: I31ee84be7ebee7f1644d7fd43bbc951abd2842d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121328
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
Change-Id: I29b9f54d24aece32949ac3ba916f1d6588cfd85f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120910
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
Change-Id: I7a9abde4101164af8c47433acfa35f4f9d3b3d04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120907
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Needed at least for 'recent documents' icons in the Mac menubar.
Change-Id: I5a22cf64ff5c5aba2c70ca2556fd0b66c425bafd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120811
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
There may be still small problems (CJK needs checking), but this is
already usable.
Change-Id: Ic9381c22ca55d9e6320152ffebeae740fd90f796
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120810
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: Ie91e48cb315d8e11508f064a6dcd9fafebb39abd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120809
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I01fdb57815dc3dff6d2c5757b55445f16825ed20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120807
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
This is needed for the Skia backend to know the geometry.
The Mac Skia code now passes most VCL unittests.
Change-Id: I6e35764d95ce821d8e11ed9979e5be75bcf6ff49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120806
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
It doesn't yet blit to screen, but the basics should be there.
Change-Id: I0f77b66756f578d84d0cee16cda00e7a2fea714f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120805
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I0bad93927248e5d8d19a69661a1b243e55791fd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117889
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
This is quite some trial and error, but now it seems all CJK text
rendering works properly. I tested tdf#136081, tdf#137907, tdf#103785,
tdf#106295, tdf#114209 and tdf#141715.
Change-Id: I40e893f66281b0a1a0e814feec3f782ceeb0c535
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115620
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
We get width+height, for vertical text width is the font "height".
This means we need to use two different fonts, one for "normal"
glyphs and one for vertical glyphs.
Change-Id: I9d190fc28286055a18c3d5c3ec75515c7c1d4373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115618
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I0701b15a28ab3583586c0c8018c511e100b41a93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114948
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
This is what https://bugs.chromium.org/p/skia/issues/detail?id=11810#c1
suggests (although I consider it to be an annoyance having to do this
explicitly).
Change-Id: I3df80374492c7b208ebaf819c0b4794ba535aa53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113979
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
This changes all backends to use PixelFormat as the input to
the SalBitmap::Create method (and all the backends). This is the
first part as we need to make sure to also limit the use of
GetBitCount method and also use of it in SalGraphics.
Change-Id: I8d2b6adfcb8fe3dd78010538411f338c9a1c3996
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113603
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
|
|
The original idea for delayed scaling was that if a bitmap is to be
scaled, only the parameters will be saved and the pixel buffer
mBuffer will be resized only on-demand. But this gets complicated
by mImage sometimes not being just a cache of mBuffer, but sometimes
it is the only data. This is needed so that e.g.
OutputDevice::GetBitmap() can operate only on SkImage without
possibly ever needing a conversion to the pixel buffer, thus even
keeping the data only on the GPU in the Vulkan case.
Together with delayed scaling this means that the size of mImage
can be either the original size (if Scale() is called with mImage
already valid) or the final size (if mImage is created in
GetSkImage()). Thus relying on 'mPixelsSize != mSize' as
a detection of pending scaling does not always work for mImage.
Handle this by using mImage dimensions in cases where relevant.
Change-Id: Id9fad67b8936d2266c1f270d08023d15efee3987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112545
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: Iac42ead2bfd5a2b7f245cc44634f675a559d86ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112543
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I0a58f7dda3406509344d791a5e24df22a69b2478
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112179
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
E.g. the document in tdf#140753 has a PNG which technically has
an alpha channel, but it's actually completely opaque. Doing this
avoids having the pixel data for the separate alpha bitmap, and
it also avoids the pointless (somewhat costly in the raster case)
alpha blending.
Change-Id: I0916962e5894a111002c667a2f98782765aacb1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111893
Tested-by: Luboš Luňák <l.lunak@collabora.com>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Including chrome/m89, which wasn't included before because of
tdf#140023.
Change-Id: I64f1de8e10eab2d92a9383ce8104be5afca40101
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111792
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Flipping or rotating are simple operations in this regard. This saves
some CPU time in raster mode, and for the upcoming chrome/m90 release
this also prevents a failure in
BackendTest::testDrawTransformedBitmapExAlpha() when rotating.
Change-Id: I51890ac19b0bd5312fcf9c7bb8fe519dc10dc007
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111771
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
Change-Id: I5dd29178e1a1ec1081820912f49fd387eb3f822b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111521
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
There have already been commits to handle this, but the case
of getting the wrong size the first was still broken (or was
fixed in the past and got broken again). Try to be generic
by forcing these to be always considered to be offscreen
and force non-zero size there.
Change-Id: Ie366a296f7f6645333630fa31e9fe18d54c7fba8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111528
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
This allows the VCL backends the apply the extra alpha transformation
as it sees fit, rather than it being done manually elsewhere (and
even if the backend doesn't implement it, at least do it in one
place in the function).
With the document from tdf#136223, going from slide 2 to slide 3,
this easily saves 10-30% of CPU cycles. As an additional bonus,
using AlphaMask::BlendWith() rather than AlphaMask::Replace()
makes edges of shapes noticeably more smooth.
Change-Id: I036dc9b887d6def0c7cdad3982becabdc7cd5206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111247
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
At least with Skia this is faster than GraphicObject trying
to handle it manually, even in raster mode.
Change-Id: If77d108751f5621878d4ea87a996c2ea0253d111
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111246
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
When conserving memory in raster mode, SkiaSalBitmap may decide
to drop the pixel buffer if SkImage is created from it, since
having both wastes memory and converting between them is cheap.
But if there is still a Bitmap::ScopedReadAccess existing
for the bitmap (e.g. VclCanvasBitmap keeps it as a member),
then dropping the pixel buffer would make the data pointed to
by the read access invalid.
Technically this patch should distinguish between info and read
accesses, as info accesses do not point to pixels, but this is
simpler and hopefully doesn't make a difference in practice.
Change-Id: I307170ad4651b849feda0cf224976ca5a87e5207
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107752
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
As asked for in tdf#136244 comment #11. The default fits 4x 2000px
32bpp images, which is 64MiB, which is not that little, but then
4x 2000px is not that much either. So, yes, configurable ...
A good further improvement would be to make the cache grow more
if the memory is available and reduce the size on memory pressure
(https://lists.freedesktop.org/archives/libreoffice/2020-December/086404.html).
Change-Id: Ifa05025ab34630e456465ac8a96950463fd18b60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107468
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
Skia can't create empty surfaces, so the recreation will hit the
std::abort() in SkiaSalGraphicsImpl::createWindowSurface. Origin
of the backtrace is some queued Resize event, which will hit
this a few times via SkiaSalGraphicsImpl::checkSurface.
This feels a bit like tdf#130831, where VCL tried to track damange
for an empty Qt image...
Change-Id: I75e22c987ba633e7a403541db8d580df33c68964
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105963
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
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>
|
|
Change-Id: I74c19597b07e9d07ee90e4191b75787241fdd845
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105829
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|