vcl/skia/SkiaHelper.cxx  |    8 ++---
 vcl/skia/gdiimpl.cxx     |   75 +++++++++++++++++++++++------------------------
 vcl/skia/salbmp.cxx      |   44 ++++++++++++---------------
 vcl/skia/win/gdiimpl.cxx |   16 +++++-----
 vcl/skia/x11/gdiimpl.cxx |   19 ++++++-----
 vcl/skia/zone.cxx        |    6 +--
 6 files changed, 83 insertions(+), 85 deletions(-)

New commits:
commit 715fe00a5052b35310b2d1289ab6137d77767ddd
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Mon Mar 1 20:18:12 2021 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Mar 3 11:08:02 2021 +0100

    'using namespace SkiaHelper' in skia vcl sources
    
    Change-Id: I9a9f687242c788ca5e4594d7cb20d66403e0421a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111793
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index 0616c5060af0..b9b5b4fb2f20 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -389,9 +389,9 @@ sk_sp<SkSurface> createSkSurface(int width, int height, 
SkColorType type, SkAlph
     SkiaZone zone;
     assert(type == kN32_SkColorType || type == kAlpha_8_SkColorType);
     sk_sp<SkSurface> surface;
-    switch (SkiaHelper::renderMethodToUse())
+    switch (renderMethodToUse())
     {
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
         {
             if (GrDirectContext* grDirectContext = getSharedGrDirectContext())
             {
@@ -432,9 +432,9 @@ sk_sp<SkImage> createSkImage(const SkBitmap& bitmap)
 {
     SkiaZone zone;
     assert(bitmap.colorType() == kN32_SkColorType || bitmap.colorType() == 
kAlpha_8_SkColorType);
-    switch (SkiaHelper::renderMethodToUse())
+    switch (renderMethodToUse())
     {
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
         {
             if (GrDirectContext* grDirectContext = getSharedGrDirectContext())
             {
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 36e10068afb6..1a707f7d9476 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -319,20 +319,20 @@ void SkiaSalGraphicsImpl::createWindowSurface(bool 
forceRaster)
         mSurface = mWindowContext->getBackbufferSurface();
     if (!mSurface)
     {
-        switch (SkiaHelper::renderMethodToUse())
+        switch (renderMethodToUse())
         {
-            case SkiaHelper::RenderVulkan:
+            case RenderVulkan:
                 SAL_WARN("vcl.skia",
                          "cannot create Vulkan GPU window surface, falling 
back to Raster");
                 destroySurface(); // destroys also WindowContext
                 return createWindowSurface(true); // try again
-            case SkiaHelper::RenderRaster:
+            case RenderRaster:
                 abort(); // This should not really happen, do not even try to 
cope with it.
         }
     }
     mIsGPU = mSurface->getCanvas()->recordingContext() != nullptr;
 #ifdef DBG_UTIL
-    SkiaHelper::prefillSurface(mSurface);
+    prefillSurface(mSurface);
 #endif
 }
 
@@ -356,13 +356,13 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
     // HACK: See isOffscreen().
     int width = std::max(1, GetWidth());
     int height = std::max(1, GetHeight());
-    switch (SkiaHelper::renderMethodToUse())
+    switch (renderMethodToUse())
     {
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
         {
-            if (SkiaHelper::getSharedGrDirectContext())
+            if (getSharedGrDirectContext())
             {
-                mSurface = SkiaHelper::createSkSurface(width, height);
+                mSurface = createSkSurface(width, height);
                 if (mSurface)
                 {
                     mIsGPU = mSurface->getCanvas()->recordingContext() != 
nullptr;
@@ -375,7 +375,7 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
             break;
     }
     // Create raster surface as a fallback.
-    mSurface = SkiaHelper::createSkSurface(width, height);
+    mSurface = createSkSurface(width, height);
     assert(mSurface);
     assert(!mSurface->getCanvas()->recordingContext()); // is not GPU-backed
     mIsGPU = false;
@@ -485,7 +485,7 @@ void SkiaSalGraphicsImpl::checkSurface()
             if (!isOffscreen())
             {
                 flushDrawing();
-                snapshot = SkiaHelper::makeCheckedImageSnapshot(mSurface);
+                snapshot = makeCheckedImageSnapshot(mSurface);
             }
 
             destroySurface();
@@ -654,8 +654,8 @@ void SkiaSalGraphicsImpl::applyXor()
     paint.setBlendMode(SkBlendMode::kSrc); // copy as is
     SkCanvas canvas(surfaceBitmap);
     SkRect area = SkRect::Make(mXorRegion.getBounds());
-    canvas.drawImageRect(SkiaHelper::makeCheckedImageSnapshot(mSurface), area, 
area,
-                         SkSamplingOptions(), &paint, 
SkCanvas::kFast_SrcRectConstraint);
+    canvas.drawImageRect(makeCheckedImageSnapshot(mSurface), area, area, 
SkSamplingOptions(),
+                         &paint, SkCanvas::kFast_SrcRectConstraint);
     // xor to surfaceBitmap
     assert(surfaceBitmap.info().alphaType() == kUnpremul_SkAlphaType);
     assert(mXorBitmap.info().alphaType() == kUnpremul_SkAlphaType);
@@ -924,7 +924,7 @@ void SkiaSalGraphicsImpl::performDrawPolyPolygon(const 
basegfx::B2DPolyPolygon&
     // WORKAROUND: The logo in the about dialog has drawing errors. This seems 
to happen
     // only on Linux (not Windows on the same machine), with both AMDGPU and 
Mesa,
     // and only when antialiasing is enabled. Flushing seems to avoid the 
problem.
-    if (useAA && SkiaHelper::getVendor() == DriverBlocklist::VendorAMD)
+    if (useAA && getVendor() == DriverBlocklist::VendorAMD)
         mSurface->flushAndSubmit();
 #endif
 }
@@ -1192,7 +1192,7 @@ static void copyArea(SkCanvas* canvas, sk_sp<SkSurface> 
surface, tools::Long nDe
     {
         SkPaint paint;
         paint.setBlendMode(SkBlendMode::kSrc); // copy as is, including alpha
-        canvas->drawImageRect(SkiaHelper::makeCheckedImageSnapshot(surface),
+        canvas->drawImageRect(makeCheckedImageSnapshot(surface),
                               SkRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, 
nSrcHeight),
                               SkRect::MakeXYWH(nDestX, nDestY, nSrcWidth, 
nSrcHeight),
                               SkSamplingOptions(), &paint, 
SkCanvas::kFast_SrcRectConstraint);
@@ -1265,7 +1265,7 @@ void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& 
rPosAry, SalGraphics* pSrcG
     {
         SAL_INFO("vcl.skia.trace", "copybits(" << this << "): (" << src << "): 
" << rPosAry);
         // Do not use makeImageSnapshot(rect), as that one may make a needless 
data copy.
-        sk_sp<SkImage> image = 
SkiaHelper::makeCheckedImageSnapshot(src->mSurface);
+        sk_sp<SkImage> image = makeCheckedImageSnapshot(src->mSurface);
         SkPaint paint;
         paint.setBlendMode(SkBlendMode::kSrc); // copy as is, including alpha
         getDrawCanvas()->drawImageRect(image,
@@ -1389,8 +1389,8 @@ std::shared_ptr<SalBitmap> 
SkiaSalGraphicsImpl::getBitmap(tools::Long nX, tools:
     // TODO makeImageSnapshot(rect) may copy the data, which may be a waste if 
this is used
     // e.g. for VirtualDevice's lame alpha blending, in which case the image 
will eventually end up
     // in blendAlphaBitmap(), where we could simply use the proper rect of the 
image.
-    sk_sp<SkImage> image = SkiaHelper::makeCheckedImageSnapshot(
-        mSurface, SkIRect::MakeXYWH(nX, nY, nWidth, nHeight));
+    sk_sp<SkImage> image
+        = makeCheckedImageSnapshot(mSurface, SkIRect::MakeXYWH(nX, nY, nWidth, 
nHeight));
     return std::make_shared<SkiaSalBitmap>(image);
 }
 
@@ -1418,8 +1418,7 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
     // with SkBlendMode::kDifference(?) and surfaces wider than 1024 pixels, 
resulting
     // in drawing errors. Work that around by fetching the relevant part of 
the surface
     // and drawing using CPU.
-    bool intelHack
-        = (isGPU() && SkiaHelper::getVendor() == DriverBlocklist::VendorIntel 
&& !mXorMode);
+    bool intelHack = (isGPU() && getVendor() == DriverBlocklist::VendorIntel 
&& !mXorMode);
     SkPath aPath;
     addPolygonToPath(rPoly, aPath);
     aPath.setFillType(SkPathFillType::kEvenOdd);
@@ -1446,18 +1445,18 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
             SkRect area;
             aPath.getBounds().roundOut(&area);
             SkRect size = SkRect::MakeWH(area.width(), area.height());
-            sk_sp<SkSurface> surface = 
SkSurface::MakeRasterN32Premul(area.width(), area.height(),
-                                                                      
SkiaHelper::surfaceProps());
+            sk_sp<SkSurface> surface
+                = SkSurface::MakeRasterN32Premul(area.width(), area.height(), 
surfaceProps());
             SkPaint copy;
             copy.setBlendMode(SkBlendMode::kSrc);
             flushDrawing();
-            
surface->getCanvas()->drawImageRect(SkiaHelper::makeCheckedImageSnapshot(mSurface),
-                                                area, size, 
SkSamplingOptions(), &copy,
+            
surface->getCanvas()->drawImageRect(makeCheckedImageSnapshot(mSurface), area, 
size,
+                                                SkSamplingOptions(), &copy,
                                                 
SkCanvas::kFast_SrcRectConstraint);
             aPath.offset(-area.x(), -area.y());
             surface->getCanvas()->drawPath(aPath, aPaint);
-            
getDrawCanvas()->drawImageRect(SkiaHelper::makeCheckedImageSnapshot(surface), 
size,
-                                           area, SkSamplingOptions(), &copy,
+            getDrawCanvas()->drawImageRect(makeCheckedImageSnapshot(surface), 
size, area,
+                                           SkSamplingOptions(), &copy,
                                            SkCanvas::kFast_SrcRectConstraint);
         }
     }
@@ -1472,7 +1471,7 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
         if (eFlags == SalInvert::N50)
         {
             // This creates 2x2 checker pattern bitmap
-            // TODO Use SkiaHelper::createSkSurface() and cache the image
+            // TODO Use createSkSurface() and cache the image
             SkBitmap aBitmap;
             aBitmap.allocN32Pixels(2, 2);
             const SkPMColor white = SkPreMultiplyARGB(0xFF, 0xFF, 0xFF, 0xFF);
@@ -1497,18 +1496,18 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
             SkRect area;
             aPath.getBounds().roundOut(&area);
             SkRect size = SkRect::MakeWH(area.width(), area.height());
-            sk_sp<SkSurface> surface = 
SkSurface::MakeRasterN32Premul(area.width(), area.height(),
-                                                                      
SkiaHelper::surfaceProps());
+            sk_sp<SkSurface> surface
+                = SkSurface::MakeRasterN32Premul(area.width(), area.height(), 
surfaceProps());
             SkPaint copy;
             copy.setBlendMode(SkBlendMode::kSrc);
             flushDrawing();
-            
surface->getCanvas()->drawImageRect(SkiaHelper::makeCheckedImageSnapshot(mSurface),
-                                                area, size, 
SkSamplingOptions(), &copy,
+            
surface->getCanvas()->drawImageRect(makeCheckedImageSnapshot(mSurface), area, 
size,
+                                                SkSamplingOptions(), &copy,
                                                 
SkCanvas::kFast_SrcRectConstraint);
             aPath.offset(-area.x(), -area.y());
             surface->getCanvas()->drawPath(aPath, aPaint);
-            
getDrawCanvas()->drawImageRect(SkiaHelper::makeCheckedImageSnapshot(surface), 
size,
-                                           area, SkSamplingOptions(), &copy,
+            getDrawCanvas()->drawImageRect(makeCheckedImageSnapshot(surface), 
size, area,
+                                           SkSamplingOptions(), &copy,
                                            SkCanvas::kFast_SrcRectConstraint);
         }
     }
@@ -1590,7 +1589,7 @@ sk_sp<SkImage> 
SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma
         }
     }
     // Do not cache the result if it would take most of the cache and thus get 
evicted soon.
-    if (targetSize.Width() * targetSize.Height() * 4 > 
SkiaHelper::maxImageCacheSize() * 0.7)
+    if (targetSize.Width() * targetSize.Height() * 4 > maxImageCacheSize() * 
0.7)
         return image;
     OString key;
     OStringBuffer keyBuf;
@@ -1602,14 +1601,14 @@ sk_sp<SkImage> 
SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma
     if (alphaBitmap)
         keyBuf.append("_").append(alphaBitmap->GetAlphaImageKey());
     key = keyBuf.makeStringAndClear();
-    image = SkiaHelper::findCachedImage(key);
+    image = findCachedImage(key);
     if (image)
     {
         assert(image->width() == targetSize.Width() && image->height() == 
targetSize.Height());
         return image;
     }
-    sk_sp<SkSurface> tmpSurface = SkiaHelper::createSkSurface(
-        targetSize, alphaBitmap ? kPremul_SkAlphaType : bitmap.alphaType());
+    sk_sp<SkSurface> tmpSurface
+        = createSkSurface(targetSize, alphaBitmap ? kPremul_SkAlphaType : 
bitmap.alphaType());
     if (!tmpSurface)
         return nullptr;
     SkCanvas* canvas = tmpSurface->getCanvas();
@@ -1638,8 +1637,8 @@ sk_sp<SkImage> 
SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma
     }
     else
         canvas->drawImage(bitmap.GetSkImage(), 0, 0, samplingOptions, &paint);
-    image = SkiaHelper::makeCheckedImageSnapshot(tmpSurface);
-    SkiaHelper::addCachedImage(key, image);
+    image = makeCheckedImageSnapshot(tmpSurface);
+    addCachedImage(key, image);
     return image;
 }
 
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 1e15c04f8c76..c8d8f1a766b2 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -397,8 +397,7 @@ bool SkiaSalBitmap::ConvertToGreyscale()
     {
         if (mBitCount == 8 && mPalette.IsGreyPalette8Bit())
             return true;
-        sk_sp<SkSurface> surface
-            = SkiaHelper::createSkSurface(mPixelsSize, 
mImage->imageInfo().alphaType());
+        sk_sp<SkSurface> surface = createSkSurface(mPixelsSize, 
mImage->imageInfo().alphaType());
         SkPaint paint;
         paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
         // VCL uses different coefficients for conversion to gray than Skia, 
so use the VCL
@@ -414,7 +413,7 @@ bool SkiaSalBitmap::ConvertToGreyscale()
         mBitCount = 8;
         ComputeScanlineSize();
         mPalette = Bitmap::GetGreyPalette(256);
-        ResetToSkImage(SkiaHelper::makeCheckedImageSnapshot(surface));
+        ResetToSkImage(makeCheckedImageSnapshot(surface));
         SAL_INFO("vcl.skia.trace", "converttogreyscale(" << this << ")");
         return true;
     }
@@ -517,13 +516,13 @@ bool SkiaSalBitmap::AlphaBlendWith(const SalBitmap& 
rSalBmp)
             return false;
         otherBitmap = otherBitmapAllocated.get();
     }
-    sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(mSize);
+    sk_sp<SkSurface> surface = createSkSurface(mSize);
     SkPaint paint;
     paint.setBlendMode(SkBlendMode::kSrc); // set as is
     surface->getCanvas()->drawImage(GetSkImage(), 0, 0, SkSamplingOptions(), 
&paint);
     paint.setBlendMode(SkBlendMode::kScreen); // src+dest - src*dest/255 (in 
0..1)
     surface->getCanvas()->drawImage(otherBitmap->GetSkImage(), 0, 0, 
SkSamplingOptions(), &paint);
-    ResetToSkImage(SkiaHelper::makeCheckedImageSnapshot(surface));
+    ResetToSkImage(makeCheckedImageSnapshot(surface));
     SAL_INFO("vcl.skia.trace", "alphablendwith(" << this << ") : with image " 
<< otherBitmap);
     return true;
 }
@@ -656,8 +655,7 @@ bool SkiaSalBitmap::ConserveMemory() const
     constexpr bool is32Bit = sizeof(void*) == 4;
     // 16MiB bitmap data at least (set to 0 for easy testing).
     constexpr tools::Long maxBufferSize = 2000 * 2000 * 4;
-    return !keepBitmapBuffer
-           && (SkiaHelper::renderMethodToUse() == SkiaHelper::RenderRaster || 
is32Bit)
+    return !keepBitmapBuffer && (renderMethodToUse() == RenderRaster || 
is32Bit)
            && mPixelsSize.Height() * mScanlineSize > maxBufferSize
            && (mBitCount > 8 || (mBitCount == 8 && 
mPalette.IsGreyPalette8Bit()));
 }
@@ -670,17 +668,16 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetSkImage() const
     if (mEraseColorSet)
     {
         SkiaZone zone;
-        sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(
+        sk_sp<SkSurface> surface = createSkSurface(
             mSize, mEraseColor.IsTransparent() ? kPremul_SkAlphaType : 
kOpaque_SkAlphaType);
         assert(surface);
         surface->getCanvas()->clear(toSkColor(mEraseColor));
         SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-        thisPtr->mImage = SkiaHelper::makeCheckedImageSnapshot(surface);
+        thisPtr->mImage = makeCheckedImageSnapshot(surface);
         SAL_INFO("vcl.skia.trace", "getskimage(" << this << ") from erase 
color " << mEraseColor);
         return mImage;
     }
-    if (mPixelsSize != mSize && !mImage
-        && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster)
+    if (mPixelsSize != mSize && !mImage && renderMethodToUse() != RenderRaster)
     {
         // The bitmap has a pending scaling, but no image. This function would 
below call GetAsSkBitmap(),
         // which would do CPU-based pixel scaling, and then it would get 
converted to an image.
@@ -691,7 +688,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetSkImage() const
         Size savedSize = mSize;
         thisPtr->mSize = mPixelsSize; // block scaling
         SkiaZone zone;
-        sk_sp<SkImage> image = SkiaHelper::createSkImage(GetAsSkBitmap());
+        sk_sp<SkImage> image = createSkImage(GetAsSkBitmap());
         assert(image);
         thisPtr->mSize = savedSize;
         thisPtr->ResetToSkImage(image);
@@ -702,8 +699,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetSkImage() const
         {
             assert(!mBuffer); // This code should be only called if only 
mImage holds data.
             SkiaZone zone;
-            sk_sp<SkSurface> surface
-                = SkiaHelper::createSkSurface(mSize, 
mImage->imageInfo().alphaType());
+            sk_sp<SkSurface> surface = createSkSurface(mSize, 
mImage->imageInfo().alphaType());
             assert(surface);
             SkPaint paint;
             paint.setBlendMode(SkBlendMode::kSrc); // set as is, including 
alpha
@@ -715,12 +711,12 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetSkImage() const
                                                      << "->" << mSize << ":"
                                                      << 
static_cast<int>(mScaleQuality));
             SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-            thisPtr->mImage = SkiaHelper::makeCheckedImageSnapshot(surface);
+            thisPtr->mImage = makeCheckedImageSnapshot(surface);
         }
         return mImage;
     }
     SkiaZone zone;
-    sk_sp<SkImage> image = SkiaHelper::createSkImage(GetAsSkBitmap());
+    sk_sp<SkImage> image = createSkImage(GetAsSkBitmap());
     assert(image);
     SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
     thisPtr->mImage = image;
@@ -743,11 +739,11 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() 
const
     if (mEraseColorSet)
     {
         SkiaZone zone;
-        sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(mSize, 
kAlpha_8_SkColorType);
+        sk_sp<SkSurface> surface = createSkSurface(mSize, 
kAlpha_8_SkColorType);
         assert(surface);
         
surface->getCanvas()->clear(fromEraseColorToAlphaImageColor(mEraseColor));
         SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-        thisPtr->mAlphaImage = SkiaHelper::makeCheckedImageSnapshot(surface);
+        thisPtr->mAlphaImage = makeCheckedImageSnapshot(surface);
         SAL_INFO("vcl.skia.trace",
                  "getalphaskimage(" << this << ") from erase color " << 
mEraseColor);
         return mAlphaImage;
@@ -790,7 +786,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() const
                                      bitmap.width());
             }
             alphaBitmap.setImmutable();
-            sk_sp<SkImage> alphaImage = SkiaHelper::createSkImage(alphaBitmap);
+            sk_sp<SkImage> alphaImage = createSkImage(alphaBitmap);
             assert(alphaImage);
             SAL_INFO("vcl.skia.trace", "getalphaskimage(" << this << ") from 
raster image");
             // Don't bother here with ConserveMemory(), mImage -> mAlphaImage 
conversions should
@@ -811,7 +807,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() const
         paint.setColorFilter(SkColorFilters::Matrix(redToAlpha));
         if (scaling)
             assert(!mBuffer); // This code should be only called if only 
mImage holds data.
-        sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(mSize, 
kAlpha_8_SkColorType);
+        sk_sp<SkSurface> surface = createSkSurface(mSize, 
kAlpha_8_SkColorType);
         assert(surface);
         paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
         surface->getCanvas()->drawImageRect(
@@ -828,7 +824,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() const
         // generally only happen with the separate-alpha-outdev hack, and 
those bitmaps should
         // be temporary.
         SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-        thisPtr->mAlphaImage = SkiaHelper::makeCheckedImageSnapshot(surface);
+        thisPtr->mAlphaImage = makeCheckedImageSnapshot(surface);
         return mAlphaImage;
     }
     SkiaZone zone;
@@ -847,13 +843,13 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() 
const
                 [](void* addr, void*) { delete[] 
static_cast<sal_uInt8*>(addr); }, nullptr))
             abort();
         alphaBitmap.setImmutable();
-        sk_sp<SkImage> image = SkiaHelper::createSkImage(alphaBitmap);
+        sk_sp<SkImage> image = createSkImage(alphaBitmap);
         assert(image);
         const_cast<sk_sp<SkImage>&>(mAlphaImage) = image;
     }
     else
     {
-        sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(mSize, 
kAlpha_8_SkColorType);
+        sk_sp<SkSurface> surface = createSkSurface(mSize, 
kAlpha_8_SkColorType);
         assert(surface);
         SkPaint paint;
         paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
@@ -868,7 +864,7 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage() const
         surface->getCanvas()->drawImage(GetAsSkBitmap().asImage(), 0, 0, 
SkSamplingOptions(),
                                         &paint);
         SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-        thisPtr->mAlphaImage = SkiaHelper::makeCheckedImageSnapshot(surface);
+        thisPtr->mAlphaImage = makeCheckedImageSnapshot(surface);
     }
     // The data is now stored both in the SkImage and in our mBuffer, so drop 
the buffer
     // if conserving memory and the conversion back would be simple (it'll be 
converted back
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index 242ff5891393..9381693213b1 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -27,6 +27,8 @@
 
 #include <windows.h>
 
+using namespace SkiaHelper;
+
 WinSkiaSalGraphicsImpl::WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics,
                                                SalGeometryProvider* mpProvider)
     : SkiaSalGraphicsImpl(rGraphics, mpProvider)
@@ -39,14 +41,14 @@ void WinSkiaSalGraphicsImpl::createWindowContext(bool 
forceRaster)
     SkiaZone zone;
     sk_app::DisplayParams displayParams;
     assert(GetWidth() > 0 && GetHeight() > 0);
-    displayParams.fSurfaceProps = *SkiaHelper::surfaceProps();
-    switch (forceRaster ? SkiaHelper::RenderRaster : 
SkiaHelper::renderMethodToUse())
+    displayParams.fSurfaceProps = *surfaceProps();
+    switch (forceRaster ? RenderRaster : renderMethodToUse())
     {
-        case SkiaHelper::RenderRaster:
+        case RenderRaster:
             mWindowContext = 
sk_app::window_context_factory::MakeRasterForWin(mWinParent.gethWnd(),
                                                                               
displayParams);
             break;
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
             mWindowContext = 
sk_app::window_context_factory::MakeVulkanForWin(mWinParent.gethWnd(),
                                                                               
displayParams);
             break;
@@ -262,7 +264,7 @@ void WinSkiaSalGraphicsImpl::initFontInfo()
         else
             fontEdging = SkFont::Edging::kAntiAlias;
     }
-    SkiaHelper::setPixelGeometry(pixelGeometry);
+    setPixelGeometry(pixelGeometry);
 }
 
 void WinSkiaSalGraphicsImpl::ClearDevFontCache()
@@ -313,7 +315,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImageDiff(const 
SkiaCompatibleDC& white) c
     }
     tmpBitmap.notifyPixelsChanged();
     tmpBitmap.setImmutable();
-    sk_sp<SkSurface> surface = SkiaHelper::createSkSurface(tmpBitmap.width(), 
tmpBitmap.height());
+    sk_sp<SkSurface> surface = createSkSurface(tmpBitmap.width(), 
tmpBitmap.height());
     SkPaint paint;
     paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
     SkCanvas* canvas = surface->getCanvas();
@@ -325,7 +327,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImageDiff(const 
SkiaCompatibleDC& white) c
     canvas->concat(matrix);
     canvas->drawImage(tmpBitmap.asImage(), 0, 0, SkSamplingOptions(), &paint);
     canvas->restore();
-    return SkiaHelper::makeCheckedImageSnapshot(surface);
+    return makeCheckedImageSnapshot(surface);
 }
 
 SkiaControlsCache::SkiaControlsCache()
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index 2ef186ad78d0..54a1220bcd17 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -25,6 +25,8 @@
 
 #include <X11/Xutil.h>
 
+using namespace SkiaHelper;
+
 X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent)
     : SkiaSalGraphicsImpl(rParent, rParent.GetGeometryProvider())
     , mX11Parent(rParent)
@@ -43,16 +45,15 @@ void X11SkiaSalGraphicsImpl::Init()
 void X11SkiaSalGraphicsImpl::createWindowContext(bool forceRaster)
 {
     assert(mX11Parent.GetDrawable() != None);
-    mWindowContext = createWindowContext(
-        mX11Parent.GetXDisplay(), mX11Parent.GetDrawable(), 
&mX11Parent.GetVisual(), GetWidth(),
-        GetHeight(), forceRaster ? SkiaHelper::RenderRaster : 
SkiaHelper::renderMethodToUse(),
-        false);
+    mWindowContext = createWindowContext(mX11Parent.GetXDisplay(), 
mX11Parent.GetDrawable(),
+                                         &mX11Parent.GetVisual(), GetWidth(), 
GetHeight(),
+                                         forceRaster ? RenderRaster : 
renderMethodToUse(), false);
 }
 
 std::unique_ptr<sk_app::WindowContext>
 X11SkiaSalGraphicsImpl::createWindowContext(Display* display, Drawable 
drawable,
                                             const XVisualInfo* visual, int 
width, int height,
-                                            SkiaHelper::RenderMethod 
renderMethod, bool temporary)
+                                            RenderMethod renderMethod, bool 
temporary)
 {
     SkiaZone zone;
     sk_app::DisplayParams displayParams;
@@ -61,7 +62,7 @@ X11SkiaSalGraphicsImpl::createWindowContext(Display* display, 
Drawable drawable,
     // WORKAROUND: VSync causes freezes that can even temporarily freeze the 
entire desktop.
     // This happens even with the latest 450.66 drivers despite them claiming 
a fix for vsync.
     // 
https://forums.developer.nvidia.com/t/hangs-freezes-when-vulkan-v-sync-vk-present-mode-fifo-khr-is-enabled/67751
-    if (SkiaHelper::getVendor() == DriverBlocklist::VendorNVIDIA)
+    if (getVendor() == DriverBlocklist::VendorNVIDIA)
         displayParams.fDisableVsync = true;
 #endif
     sk_app::window_context_factory::XlibWindowInfo winInfo;
@@ -90,7 +91,7 @@ X11SkiaSalGraphicsImpl::createWindowContext(Display* display, 
Drawable drawable,
 #endif
     switch (renderMethod)
     {
-        case SkiaHelper::RenderRaster:
+        case RenderRaster:
             // Make sure we ask for color type that matches the X11 visual. If 
red mask
             // is larger value than blue mask, then on little endian this 
means blue is first.
             // This should also preferably match SK_R32_SHIFT set in 
config_skia.h, as that
@@ -100,7 +101,7 @@ X11SkiaSalGraphicsImpl::createWindowContext(Display* 
display, Drawable drawable,
                 = (visual->red_mask > visual->blue_mask ? 
kBGRA_8888_SkColorType
                                                         : 
kRGBA_8888_SkColorType);
             return sk_app::window_context_factory::MakeRasterForXlib(winInfo, 
displayParams);
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
             return sk_app::window_context_factory::MakeVulkanForXlib(winInfo, 
displayParams);
     }
     abort();
@@ -170,7 +171,7 @@ std::unique_ptr<sk_app::WindowContext> 
createVulkanWindowContext(bool temporary)
         visual = visuals;
     }
     std::unique_ptr<sk_app::WindowContext> ret = 
X11SkiaSalGraphicsImpl::createWindowContext(
-        salDisplay->GetDisplay(), None, visual, 1, 1, 
SkiaHelper::RenderVulkan, temporary);
+        salDisplay->GetDisplay(), None, visual, 1, 1, RenderVulkan, temporary);
     if (temporary)
         XFree(visuals);
     return ret;
diff --git a/vcl/skia/zone.cxx b/vcl/skia/zone.cxx
index 798e6de46d45..d9010b7a96b2 100644
--- a/vcl/skia/zone.cxx
+++ b/vcl/skia/zone.cxx
@@ -59,9 +59,9 @@ void SkiaZone::checkDebug(int nUnchanged, const 
CrashWatchdogTimingsValues& aTim
 
 const CrashWatchdogTimingsValues& SkiaZone::getCrashWatchdogTimingsValues()
 {
-    switch (SkiaHelper::renderMethodToUse())
+    switch (renderMethodToUse())
     {
-        case SkiaHelper::RenderVulkan:
+        case RenderVulkan:
         {
 #if defined(SK_RELEASE)
             static const CrashWatchdogTimingsValues vulkanValues = { 6, 20 }; 
/* 1.5s,  5s */
@@ -72,7 +72,7 @@ const CrashWatchdogTimingsValues& 
SkiaZone::getCrashWatchdogTimingsValues()
 #endif
             return vulkanValues;
         }
-        case SkiaHelper::RenderRaster:
+        case RenderRaster:
         {
             // CPU-based operations with large images may take a noticeably 
long time,
             // so use large values. CPU-based rendering shouldn't use any 
unstable drivers anyway.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to