[Libreoffice-commits] core.git: external/skia vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 9 10:51:17 UTC 2020


 external/skia/inc/skia_opts.hxx             |    4 ++--
 external/skia/source/skia_opts.cxx          |    6 +++---
 external/skia/source/skia_opts_internal.hxx |   10 +++++-----
 external/skia/source/skia_opts_ssse3.cxx    |    2 +-
 vcl/skia/salbmp.cxx                         |    5 ++---
 5 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 991b4e032a4834779aac100607ffc13758328c4a
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Dec 8 12:46:40 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Dec 9 11:50:33 2020 +0100

    better name for a helper Skia function
    
    What it really does is converting RGBA to R, so name it after
    what it does. That the result happens to be kind-of-grey of the RGBA
    is just a result of VCL providing the data that way.
    
    Change-Id: Ic017e34d91879679e0a7dad4d6ab35650fc3a89b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107408
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/external/skia/inc/skia_opts.hxx b/external/skia/inc/skia_opts.hxx
index e292f0920fe8..33f82f9d2218 100644
--- a/external/skia/inc/skia_opts.hxx
+++ b/external/skia/inc/skia_opts.hxx
@@ -14,7 +14,7 @@ SK_API void SkConvertGrayToRGBA(uint32_t* dest, const uint8_t* src, int count);
 
 SK_API void SkConvertRGBAToRGB(uint8_t* dest, const uint32_t* src, int count);
 
-SK_API void SkConvertRGBAToGrayFast(uint8_t* dest, const uint32_t* src, int count);
+SK_API void SkConvertRGBAToR(uint8_t* dest, const uint32_t* src, int count);
 
 namespace SkLoOpts
 {
@@ -22,7 +22,7 @@ SK_API void Init();
 
 typedef void (*Swizzle_u8_8888)(uint8_t*, const uint32_t*, int);
 extern Swizzle_u8_8888 RGB1_to_RGB,     // i.e. remove an (opaque) alpha
-                       RGB1_to_gray_fast;    // i.e. copy one channel to the result
+                       RGB1_to_R;       // i.e. copy one channel to the result
 }
 
 #endif
diff --git a/external/skia/source/skia_opts.cxx b/external/skia/source/skia_opts.cxx
index 061e599e71ab..9bfe04e14459 100644
--- a/external/skia/source/skia_opts.cxx
+++ b/external/skia/source/skia_opts.cxx
@@ -30,9 +30,9 @@ void SkConvertRGBAToRGB(uint8_t* dest, const uint32_t* src, int count)
     SkLoOpts::RGB1_to_RGB(dest, src, count);
 }
 
-void SkConvertRGBAToGrayFast(uint8_t* dest, const uint32_t* src, int count)
+void SkConvertRGBAToR(uint8_t* dest, const uint32_t* src, int count)
 {
-    SkLoOpts::RGB1_to_gray_fast(dest, src, count);
+    SkLoOpts::RGB1_to_R(dest, src, count);
 }
 
 // The rest is mostly based on Skia's SkOpts.cpp, reduced to only SSSE3 so far.
@@ -52,7 +52,7 @@ namespace SkLoOpts {
     // They'll still get a chance to be replaced with even better ones, e.g. using SSE4.1.
 #define DEFINE_DEFAULT(name) decltype(name) name = SK_OPTS_NS::name
     DEFINE_DEFAULT(RGB1_to_RGB);
-    DEFINE_DEFAULT(RGB1_to_gray_fast);
+    DEFINE_DEFAULT(RGB1_to_R);
 #undef DEFINE_DEFAULT
 
     // Each Init_foo() is defined in its own file.
diff --git a/external/skia/source/skia_opts_internal.hxx b/external/skia/source/skia_opts_internal.hxx
index 7b81c20da271..1f46ee72eb4a 100644
--- a/external/skia/source/skia_opts_internal.hxx
+++ b/external/skia/source/skia_opts_internal.hxx
@@ -20,7 +20,7 @@ static void RGB1_to_RGB_portable(uint8_t dst[], const uint32_t* src, int count)
         dst += 3;
     }
 }
-static void RGB1_to_gray_fast_portable(uint8_t dst[], const uint32_t* src, int count) {
+static void RGB1_to_R_portable(uint8_t dst[], const uint32_t* src, int count) {
     for (int i = 0; i < count; i++) {
         dst[i] = src[i] & 0xFF;
     }
@@ -48,7 +48,7 @@ inline void RGB1_to_RGB(uint8_t dst[], const uint32_t* src, int count) {
         RGB1_to_RGB_portable(dst, src, count);
 }
 
-inline void RGB1_to_gray_fast(uint8_t dst[], const uint32_t* src, int count) {
+inline void RGB1_to_R(uint8_t dst[], const uint32_t* src, int count) {
         const uint8_t X = 0xFF; // Used a placeholder.  The value of X is irrelevant.
         __m128i pack = _mm_setr_epi8(0,4,8,12, X,X,X,X,X,X,X,X,X,X,X,X);
 
@@ -66,15 +66,15 @@ inline void RGB1_to_gray_fast(uint8_t dst[], const uint32_t* src, int count) {
             dst += 4;
             count -= 4;
         }
-        RGB1_to_gray_fast_portable(dst, src, count);
+        RGB1_to_R_portable(dst, src, count);
 }
 
 #else
 inline void RGB1_to_RGB(uint8_t dst[], const uint32_t* src, int count) {
     RGB1_to_RGB_portable(dst, src, count);
 }
-inline void RGB1_to_gray_fast(uint8_t dst[], const uint32_t* src, int count) {
-    RGB1_to_gray_fast_portable(dst, src, count);
+inline void RGB1_to_R(uint8_t dst[], const uint32_t* src, int count) {
+    RGB1_to_R_portable(dst, src, count);
 }
 #endif
 
diff --git a/external/skia/source/skia_opts_ssse3.cxx b/external/skia/source/skia_opts_ssse3.cxx
index 8d19b6eeabaf..31a446c99af5 100644
--- a/external/skia/source/skia_opts_ssse3.cxx
+++ b/external/skia/source/skia_opts_ssse3.cxx
@@ -12,6 +12,6 @@
 namespace SkLoOpts {
     void Init_ssse3() {
         RGB1_to_RGB           = ssse3::RGB1_to_RGB;
-        RGB1_to_gray_fast     = ssse3::RGB1_to_gray_fast;
+        RGB1_to_R             = ssse3::RGB1_to_R;
     }
 }
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index eeb528267b0f..0ce99d5778e4 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -1072,8 +1072,7 @@ void SkiaSalBitmap::EnsureBitmapData()
     { // no actual data conversion, use one color channel as the gray value
         if (int(bitmap.rowBytes()) == mSize.Width() * 4 && mSize.Width() * 1 == mScanlineSize)
         {
-            SkConvertRGBAToGrayFast(mBuffer.get(), bitmap.getAddr32(0, 0),
-                                    mSize.Height() * mSize.Width());
+            SkConvertRGBAToR(mBuffer.get(), bitmap.getAddr32(0, 0), mSize.Height() * mSize.Width());
         }
         else
         {
@@ -1081,7 +1080,7 @@ void SkiaSalBitmap::EnsureBitmapData()
             {
                 const uint32_t* src = bitmap.getAddr32(0, y);
                 sal_uInt8* dest = mBuffer.get() + mScanlineSize * y;
-                SkConvertRGBAToGrayFast(dest, src, mSize.Width());
+                SkConvertRGBAToR(dest, src, mSize.Width());
             }
         }
     }


More information about the Libreoffice-commits mailing list