summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-01-18 19:38:03 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-03-03 11:07:37 +0100
commitad8bff9d2625524999871ace65cfe0382f991f24 (patch)
tree0a25e06eb0fbc81467c8f7b1f36ca324b9313e9b /vcl/inc
parentd4159496056741302718ac1e85f450985fd11580 (diff)
update Skia to chrome/m90
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>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/skia/salbmp.hxx8
-rw-r--r--vcl/inc/skia/utils.hxx25
2 files changed, 30 insertions, 3 deletions
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index ec8d4f3c7b82..2a1d309a7fec 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -26,6 +26,8 @@
#include <boost/shared_ptr.hpp>
+#include <vcl/bitmap.hxx>
+
class VCL_PLUGIN_PUBLIC SkiaSalBitmap final : public SalBitmap
{
public:
@@ -69,11 +71,11 @@ public:
// Returns the contents as SkImage (possibly GPU-backed).
const sk_sp<SkImage>& GetSkImage() const;
- sk_sp<SkShader> GetSkShader() const;
+ sk_sp<SkShader> GetSkShader(const SkSamplingOptions& samplingOptions) const;
// Returns the contents as alpha SkImage (possibly GPU-backed)
const sk_sp<SkImage>& GetAlphaSkImage() const;
- sk_sp<SkShader> GetAlphaSkShader() const;
+ sk_sp<SkShader> GetAlphaSkShader(const SkSamplingOptions& samplingOptions) const;
// Key for caching/hashing.
OString GetImageKey() const;
@@ -173,7 +175,7 @@ private:
// Actual scaling triggered by scale() is done on-demand. This is the size of the pixel
// data in mBuffer, if it differs from mSize, then there is a scaling operation pending.
Size mPixelsSize;
- SkFilterQuality mScaleQuality = kHigh_SkFilterQuality; // quality for on-demand scaling
+ BmpScaleFlag mScaleQuality = BmpScaleFlag::BestQuality; // quality for on-demand scaling
// Erase() is delayed, just sets these two instead of filling the buffer.
bool mEraseColorSet = false;
Color mEraseColor;
diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx
index b5412e9f9479..3baa749adb8b 100644
--- a/vcl/inc/skia/utils.hxx
+++ b/vcl/inc/skia/utils.hxx
@@ -24,6 +24,8 @@
#include <tools/gen.hxx>
#include <driverblocklist.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/salgtype.hxx>
#include <SkRegion.h>
#include <SkSurface.h>
@@ -81,6 +83,29 @@ VCL_DLLPUBLIC const SkSurfaceProps* surfaceProps();
// Set pixel geometry to be used by SkSurfaceProps.
VCL_DLLPUBLIC void setPixelGeometry(SkPixelGeometry pixelGeometry);
+inline SkSamplingOptions makeSamplingOptions(BmpScaleFlag scaling)
+{
+ switch (scaling)
+ {
+ case BmpScaleFlag::BestQuality:
+ return SkSamplingOptions(SkCubicResampler::Mitchell());
+ case BmpScaleFlag::Default:
+ return SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNone);
+ case BmpScaleFlag::Fast:
+ return SkSamplingOptions(SkFilterMode::kNearest, SkMipmapMode::kNone);
+ default:
+ assert(false);
+ return SkSamplingOptions();
+ }
+}
+
+inline SkSamplingOptions makeSamplingOptions(const SalTwoRect& rPosAry)
+{
+ if (rPosAry.mnSrcWidth != rPosAry.mnDestWidth || rPosAry.mnSrcHeight != rPosAry.mnDestHeight)
+ return SkSamplingOptions(SkCubicResampler::Mitchell()); // best
+ return SkSamplingOptions(); // none
+}
+
#ifdef DBG_UTIL
void prefillSurface(const sk_sp<SkSurface>& surface);
VCL_DLLPUBLIC void dump(const SkBitmap& bitmap, const char* file);