Update SkiaSDLExample to latest Ganesh interfaces.

Also updates SDL to 2.0.5.

Change-Id: I3a3c8f69360fc20a3d543c19dcf82dd3f42f1309
Reviewed-on: https://skia-review.googlesource.com/22204
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index d0bfa57..dc8cca0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1598,6 +1598,21 @@
     }
   }
 
+  if (skia_enable_gpu && (is_linux || is_mac)) {
+    test_app("SkiaSDLExample") {
+      sources = [
+        "example/SkiaSDLExample.cpp",
+      ]
+      libs = []
+      include_dirs = []
+      deps = [
+        ":gpu_tool_utils",
+        ":skia",
+        "//third_party/libsdl",
+      ]
+    }
+  }
+
   if (is_android && defined(ndk) && ndk != "") {
     copy("gdbserver") {
       sources = [
diff --git a/DEPS b/DEPS
index 967d781..3437fcc 100644
--- a/DEPS
+++ b/DEPS
@@ -15,7 +15,7 @@
   "third_party/externals/libwebp"       : "https://chromium.googlesource.com/webm/libwebp.git@v0.6.0",
   "third_party/externals/microhttpd"    : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d",
   "third_party/externals/piex"          : "https://android.googlesource.com/platform/external/piex.git@8f540f64b6c170a16fb7e6e52d61819705c1522a",
-  "third_party/externals/sdl"           : "https://skia.googlesource.com/third_party/sdl@9b526d28cb2d7f0ccff0613c94bb52abc8f53b6f",
+  "third_party/externals/sdl"           : "https://skia.googlesource.com/third_party/sdl@5d7cfcca344034aff9327f77fc181ae3754e7a90",
   "third_party/externals/sfntly"        : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b18b09b6114b9b7fe6fc2f96d8b15e8a72f66916",
   "third_party/externals/spirv-headers" : "https://github.com/KhronosGroup/SPIRV-Headers.git@2d6ba39368a781edd82eff5df2b6bc614e892329",
   "third_party/externals/spirv-tools"   : "https://github.com/KhronosGroup/SPIRV-Tools.git@1fb8c37b5718118b49eec59dc383cfa3f98643c0",
diff --git a/example/SkiaSDLExample.cpp b/example/SkiaSDLExample.cpp
index f3be850..813485f 100644
--- a/example/SkiaSDLExample.cpp
+++ b/example/SkiaSDLExample.cpp
@@ -193,12 +193,12 @@
 
     // Wrap the frame buffer object attached to the screen in a Skia render target so Skia can
     // render to it
-    GrGLFrameBufferInfo fbInfo;
     GrGLint buffer;
-    GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
-    fbInfo.fFBOID = buffer;
-    GrBackendRenderTarget backendRT(dm.w, dm.h, kMsaaSampleCount, kStencilBits,
-                                    kSkia8888_GrPixelConfig, fbInfo);
+    GR_GL_GetIntegerv(interface.get(), GR_GL_FRAMEBUFFER_BINDING, &buffer);
+    GrGLFramebufferInfo info;
+    info.fFBOID = (GrGLuint) buffer;
+    GrBackendRenderTarget target(dm.w, dm.h, kMsaaSampleCount, kStencilBits,
+                                 kSkia8888_GrPixelConfig, info);
 
     // setup SkSurface
     // To use distance field text, use commented out SkSurfaceProps instead
@@ -206,10 +206,9 @@
     //                      SkSurfaceProps::kLegacyFontHost_InitType);
     SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
 
-    sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext,
-                                                                    backendRT,
+    sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext.get(), target,
                                                                     kBottomLeft_GrSurfaceOrigin,
-                                                                    &props));
+                                                                    nullptr, &props));
 
     SkCanvas* canvas = surface->getCanvas();
 
diff --git a/third_party/libsdl/BUILD.gn b/third_party/libsdl/BUILD.gn
index 7989372..2df9d22 100644
--- a/third_party/libsdl/BUILD.gn
+++ b/third_party/libsdl/BUILD.gn
@@ -129,6 +129,39 @@
     ]
   }
 
+  if (is_linux) {
+    sources += [
+      "../externals/sdl/src/filesystem/unix/SDL_sysfilesystem.c",
+      "../externals/sdl/src/video/x11/SDL_x11clipboard.c",
+      "../externals/sdl/src/video/x11/SDL_x11dyn.c",
+      "../externals/sdl/src/video/x11/SDL_x11events.c",
+      "../externals/sdl/src/video/x11/SDL_x11framebuffer.c",
+      "../externals/sdl/src/video/x11/SDL_x11keyboard.c",
+      "../externals/sdl/src/video/x11/SDL_x11messagebox.c",
+      "../externals/sdl/src/video/x11/SDL_x11modes.c",
+      "../externals/sdl/src/video/x11/SDL_x11mouse.c",
+      "../externals/sdl/src/video/x11/SDL_x11opengl.c",
+      "../externals/sdl/src/video/x11/SDL_x11opengles.c",
+      "../externals/sdl/src/video/x11/SDL_x11shape.c",
+      "../externals/sdl/src/video/x11/SDL_x11touch.c",
+      "../externals/sdl/src/video/x11/SDL_x11video.c",
+      "../externals/sdl/src/video/x11/SDL_x11window.c",
+      "../externals/sdl/src/video/x11/SDL_x11xinput2.c",
+      "../externals/sdl/src/video/x11/imKStoUCS.c",
+    ]
+    defines += [
+      "SDL_FILESYSTEM_UNIX=1",
+      "SDL_VIDEO_DRIVER_X11=1",
+      "SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1",
+      "SDL_VIDEO_OPENGL_GLX=1",
+    ]
+    libs += [
+      "GL",
+      "X11",
+      "Xext",
+    ]
+  }
+
   if (is_mac) {
     sources += [
       "../externals/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m",
@@ -152,7 +185,10 @@
     ]
     libs += [
       "Carbon.framework",
+      "Cocoa.framework",
+      "Foundation.framework",
       "IOKit.framework",
+      "QuartzCore.framework",
     ]
   }
 }