Description: Use system-wide Skia.
Forwarded: not-needed
Author: Filip Strömbäck <filip@fprg.se>
--- a/Gui/.mymake
+++ b/Gui/.mymake
@@ -32,23 +32,25 @@
 [unix,!noskia]
 # Skia stuff:
 # Compile Skia if necessary.
-preBuild+=./build_skia.sh <path|buildDir>skia.a <maxThreads>
+# preBuild+=./build_skia.sh <path|buildDir>skia.a <maxThreads>
 # Link Skia.
-linkFlags+=<path|buildDir>skia.a
+# linkFlags+=<path|buildDir>skia.a
 # Include path.
-include+=../Linux/skia
+# include+=../Linux/skia
 # Defines
 define+=SK_GL=1
 
 # Need this as well.
+linkFlags+=-lskia
 linkFlags+=-lharfbuzz
+linkFlags+=-lfontconfig
 
 # Tell it to not complain about ABI incompatibilities due to missing CPU features. We build
 # Skia with the same flags, so it is OK.
-flags+=-Wno-psabi
+#flags+=-Wno-psabi
 
 # Skia now uses [[clang::reinitializes]], which GCC does not support.
-flags+=-Wno-attributes
+# flags+=-Wno-attributes
 
 define+=GUI_ENABLE_SKIA
 
@@ -61,5 +63,5 @@
 
 # Defaults
 flags+=`pkg-config --cflags gtk+-3.0 x11`
-linkFlags+=-lgtk-3 -lgdk-3 -lgdk_pixbuf-2.0 -lgio-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lX11 -lGL
+linkFlags+=-lgtk-3 -lgdk-3 -lgdk_pixbuf-2.0 -lgio-2.0 -lpangocairo-1.0 -lpangoft2-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lX11 -lGL -lEGL
 
--- a/Gui/Skia/Skia.h
+++ b/Gui/Skia/Skia.h
@@ -10,42 +10,42 @@
 #undef Status
 #undef None
 
-#include "include/gpu/ganesh/GrDirectContext.h"
-#include "include/gpu/ganesh/GrBackendSurface.h"
-#include "include/gpu/ganesh/gl/GrGLInterface.h"
-#include "include/gpu/ganesh/gl/GrGLAssembleInterface.h"
-#include "include/gpu/ganesh/gl/GrGLDirectContext.h"
-#include "include/gpu/ganesh/gl/GrGLBackendSurface.h"
-#include "include/gpu/ganesh/SkImageGanesh.h"
-#include "include/gpu/ganesh/SkSurfaceGanesh.h"
-#include "include/core/SkSurface.h"
-#include "include/core/SkCanvas.h"
-#include "include/core/SkColor.h"
-#include "include/core/SkPoint.h"
-#include "include/core/SkRect.h"
-#include "include/core/SkPath.h"
-#include "include/core/SkPathBuilder.h"
-#include "include/effects/SkGradientShader.h"
-#include "include/core/SkTextBlob.h"
-#include "include/core/SkRSXform.h"
+#include <skia/gpu/ganesh/GrDirectContext.h>
+#include <skia/gpu/ganesh/GrBackendSurface.h>
+#include <skia/gpu/ganesh/gl/GrGLInterface.h>
+#include <skia/gpu/ganesh/gl/GrGLAssembleInterface.h>
+#include <skia/gpu/ganesh/gl/GrGLDirectContext.h>
+#include <skia/gpu/ganesh/gl/GrGLBackendSurface.h>
+#include <skia/gpu/ganesh/SkImageGanesh.h>
+#include <skia/gpu/ganesh/SkSurfaceGanesh.h>
+#include <skia/core/SkSurface.h>
+#include <skia/core/SkCanvas.h>
+#include <skia/core/SkColor.h>
+#include <skia/core/SkPoint.h>
+#include <skia/core/SkRect.h>
+#include <skia/core/SkPath.h>
+#include <skia/core/SkPathBuilder.h>
+#include <skia/effects/SkGradient.h>
+#include <skia/core/SkTextBlob.h>
+#include <skia/core/SkRSXform.h>
 
 // This is technically not a part of the public API. We statically link to Skia, so we will make it work.
 // These are only used in LocalShader.h
-#include "src/shaders/SkShaderBase.h"
+#include <skia/private/shaders/SkShaderBase.h>
 // #include "src/gpu/GrFragmentProcessor.h"
 // #include "src/core/SkVM.h"
-#include "src/core/SkReadBuffer.h"
-#include "src/core/SkWriteBuffer.h"
+#include <skia/private/core/SkReadBuffer.h>
+#include <skia/private/core/SkWriteBuffer.h>
 // #include "src/gpu/effects/GrMatrixEffect.h"
 // #include "src/core/SkMatrixProvider.h"
 // #include "src/core/SkTLazy.h"
 // #include "src/shaders/SkShaderBase.h"
 
 // For font rendering.
-#include "src/ports/SkFontHost_FreeType_common.h"
-#include "src/ports/SkTypeface_FreeType.h"
-#include "include/ports/SkFontScanner_FreeType.h"
-#include "src/core/SkFontDescriptor.h"
+#include <skia/private/ports/SkFontHost_FreeType_common.h>
+#include <skia/private/ports/SkTypeface_FreeType.h>
+#include <skia/ports/SkFontScanner_FreeType.h>
+#include <skia/private/core/SkFontDescriptor.h>
 
 // Skia re-defines the assert macro. Get our original definition back!
 #undef assert
--- a/Gui/Skia/Manager.cpp
+++ b/Gui/Skia/Manager.cpp
@@ -86,13 +86,17 @@
 			{ 0, 0 },
 			{ 0, -1 },
 		};
-		SkColor *colors = (SkColor *)alloca(stops->count() * sizeof(SkColor));
+		SkColor4f *colors = (SkColor4f *)alloca(stops->count() * sizeof(SkColor4f));
 		SkScalar *pos = (SkScalar *)alloca(stops->count() * sizeof(SkScalar));
 		for (Nat i = 0; i < stops->count(); i++) {
-			colors[i] = skia(stops->at(i).color).toSkColor();
+			colors[i] = skia(stops->at(i).color);
 			pos[i] = stops->at(i).pos;
 		}
-		sk_sp<SkShader> shader = SkGradientShader::MakeLinear(points, colors, pos, stops->count(), SkTileMode::kClamp);
+		SkGradient gradient(SkGradient::Colors(SkSpan<const SkColor4f>(colors, stops->count()),
+											   SkSpan<const float>(pos, stops->count()),
+											   SkTileMode::kClamp),
+							SkGradient::Interpolation());
+		sk_sp<SkShader> shader = SkShaders::LinearGradient(points, gradient);
 		shader = sk_make_sp<LocalShader>(shader, linearMatrix(brush->start(), brush->end()));
 		paint->setShader(shader);
 
@@ -124,15 +128,19 @@
 		paint->setAntiAlias(true);
 
 		Array<GradientStop> *stops = brush->peekStops();
-		SkColor *colors = (SkColor *)alloca(stops->count() * sizeof(SkColor));
+		SkColor4f *colors = (SkColor4f *)alloca(stops->count() * sizeof(SkColor4f));
 		SkScalar *pos = (SkScalar *)alloca(stops->count() * sizeof(SkScalar));
 		for (Nat i = 0; i < stops->count(); i++) {
-			colors[i] = skia(stops->at(i).color).toSkColor();
+			colors[i] = skia(stops->at(i).color);
 			pos[i] = stops->at(i).pos;
 		}
 
 		// We create a radial gradient with a center of 0, 0 and a radius of 1.0 and then use the matrix to scale and move it.
-		sk_sp<SkShader> shader = SkGradientShader::MakeRadial(SkPoint::Make(0, 0), 1.0, colors, pos, stops->count(), SkTileMode::kClamp);
+		SkGradient gradient(SkGradient::Colors(SkSpan<const SkColor4f>(colors, stops->count()),
+											   SkSpan<const float>(pos, stops->count()),
+											   SkTileMode::kClamp),
+							SkGradient::Interpolation());
+		sk_sp<SkShader> shader = SkShaders::RadialGradient(SkPoint::Make(0, 0), 1.0, gradient);
 		shader = sk_make_sp<LocalShader>(shader, radialMatrix(brush));
 		paint->setShader(shader);
 
