From 82996b82005d54195d832bf6eb8e472af41a615a Mon Sep 17 00:00:00 2001 From: brianosman Date: Wed, 20 Apr 2016 10:52:54 -0700 Subject: [PATCH] Get skiaserve working on Windows. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1903203003 Review URL: https://codereview.chromium.org/1903203003 --- gyp/microhttpd.gyp | 61 ++++++++++++++++++++++ gyp/most.gyp | 4 ++ tools/skiaserve/Request.cpp | 3 +- tools/skiaserve/skiaserve.cpp | 3 ++ tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp | 2 +- tools/skiaserve/urlhandlers/CmdHandler.cpp | 2 +- tools/skiaserve/urlhandlers/EnableGPUHandler.cpp | 2 +- tools/skiaserve/urlhandlers/SRGBModeHandler.cpp | 2 +- 8 files changed, 74 insertions(+), 5 deletions(-) diff --git a/gyp/microhttpd.gyp b/gyp/microhttpd.gyp index 4e990cd..378d9a0 100644 --- a/gyp/microhttpd.gyp +++ b/gyp/microhttpd.gyp @@ -180,6 +180,67 @@ '_MHD_EXTERN=__attribute__((visibility("default"))) extern', ], }], + ['skia_os == "win"', { + 'sources': [ + '../third_party/externals/microhttpd/src/platform/w32functions.c', + ], + 'msvs_disabled_warnings': [4244, 4996], + 'all_dependent_settings': { + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalDependencies': [ 'ws2_32.lib' ], + }, + }, + }, + 'defines=': [ # equals sign throws away most Skia defines (just noise) + "_GNU_SOURCE=1", + "BAUTH_SUPPORT=1", + "DAUTH_SUPPORT=1", + "EPOLL_SUPPORT=0", + "HAVE_DECL_SOCK_NONBLOCK=0", + "HAVE_DECL_TCP_CORK=0", + "HAVE_DECL_TCP_NOPUSH=0", + "HAVE_ERRNO_H=1", + "HAVE_FCNTL_H=1", + "HAVE_INET6=1", + "HAVE_INTTYPES_H=1", + "HAVE_LIMITS_H=1", + "HAVE_LOCALE_H=1", + "HAVE_MATH_H=1", + "HAVE_MEMORY_H=1", + "HAVE_MESSAGES=1", +# "HAVE_POLL=0", + "HAVE_POSTPROCESSOR=1", + "HAVE_PTHREAD_H=0", + "HAVE_STDINT_H=1", + "HAVE_STDIO_H=1", + "HAVE_STDLIB_H=1", + "HAVE_STRINGS_H=1", + "HAVE_STRING_H=1", + "HAVE_SYS_STAT_H=1", + "HAVE_SYS_TYPES_H=1", + "HAVE_TIME_H=1", + "HAVE_WINSOCK2_H=1", + "HAVE_WS2TCPIP_H=1", + "HTTPS_SUPPORT=0", + "MSVC=1", + "WINDOWS=1", + 'LT_OBJDIR=".libs/"', + "MHD_DONT_USE_PIPES=1", + "MHD_USE_W32_THREADS=1", + 'PACKAGE="libmicrohttpd"', + 'PACKAGE_BUGREPORT="libmicrohttpd@gnu.org"', + 'PACKAGE_NAME="libmicrohttp"', + 'PACKAGE_STRING="libmicrohttpd 0.9.42"', + 'PACKAGE_TARNAME="libmicrohttpd"', + 'PACKAGE_URL=""', + 'PACKAGE_VERSION="0.9.42"', + "SPDY_SUPPORT=0", + "STDC_HEADERS=1", + 'VERSION="0.9.42"', + '_MHD_EXTERN=extern', + ], + }], ] }] } diff --git a/gyp/most.gyp b/gyp/most.gyp index 6c7fc02..d4babe1 100644 --- a/gyp/most.gyp +++ b/gyp/most.gyp @@ -72,6 +72,10 @@ ['skia_os == "mac" or skia_os == "linux"', { 'dependencies': [ 'nanomsg.gyp:*' , + ], + }], + ['skia_os in ["linux", "mac", "win"]', { + 'dependencies': [ 'skiaserve.gyp:skiaserve', ], }], diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index 7cbc9ef..b16c5cf 100644 --- a/tools/skiaserve/Request.cpp +++ b/tools/skiaserve/Request.cpp @@ -98,7 +98,8 @@ SkData* Request::writeOutSkp() { // Playback into picture recorder SkIRect bounds = this->getBounds(); SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height()); + SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(bounds.width()), + SkIntToScalar(bounds.height())); fDebugCanvas->draw(canvas); diff --git a/tools/skiaserve/skiaserve.cpp b/tools/skiaserve/skiaserve.cpp index 77b2cc0..c2c5150 100644 --- a/tools/skiaserve/skiaserve.cpp +++ b/tools/skiaserve/skiaserve.cpp @@ -16,8 +16,11 @@ #include "urlhandlers/UrlHandler.h" #include + +#if !defined _WIN32 #include #include +#endif using namespace Response; diff --git a/tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp b/tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp index b14db19..3eb51d2 100644 --- a/tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp +++ b/tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp @@ -32,6 +32,6 @@ int BatchBoundsHandler::handle(Request* request, MHD_Connection* connection, int enabled; sscanf(commands[1].c_str(), "%d", &enabled); - request->fDebugCanvas->setDrawGpuBatchBounds(enabled); + request->fDebugCanvas->setDrawGpuBatchBounds(SkToBool(enabled)); return SendOK(connection); } diff --git a/tools/skiaserve/urlhandlers/CmdHandler.cpp b/tools/skiaserve/urlhandlers/CmdHandler.cpp index 09fdc17..22877e7 100644 --- a/tools/skiaserve/urlhandlers/CmdHandler.cpp +++ b/tools/skiaserve/urlhandlers/CmdHandler.cpp @@ -54,7 +54,7 @@ int CmdHandler::handle(Request* request, MHD_Connection* connection, int n, toggle; sscanf(commands[1].c_str(), "%d", &n); sscanf(commands[2].c_str(), "%d", &toggle); - request->fDebugCanvas->toggleCommand(n, toggle); + request->fDebugCanvas->toggleCommand(n, SkToBool(toggle)); return SendOK(connection); } diff --git a/tools/skiaserve/urlhandlers/EnableGPUHandler.cpp b/tools/skiaserve/urlhandlers/EnableGPUHandler.cpp index 68eb86f..7364ef0 100644 --- a/tools/skiaserve/urlhandlers/EnableGPUHandler.cpp +++ b/tools/skiaserve/urlhandlers/EnableGPUHandler.cpp @@ -32,7 +32,7 @@ int EnableGPUHandler::handle(Request* request, MHD_Connection* connection, int enable; sscanf(commands[1].c_str(), "%d", &enable); - bool success = request->enableGPU(enable); + bool success = request->enableGPU(SkToBool(enable)); if (!success) { return SendError(connection, "Unable to create GPU surface"); } diff --git a/tools/skiaserve/urlhandlers/SRGBModeHandler.cpp b/tools/skiaserve/urlhandlers/SRGBModeHandler.cpp index df06050..1dd9789 100644 --- a/tools/skiaserve/urlhandlers/SRGBModeHandler.cpp +++ b/tools/skiaserve/urlhandlers/SRGBModeHandler.cpp @@ -34,7 +34,7 @@ int SRGBModeHandler::handle(Request* request, MHD_Connection* connection, return MHD_NO; } - bool success = request->setSRGBMode(enable); + bool success = request->setSRGBMode(SkToBool(enable)); if (!success) { return SendError(connection, "Unable to set requested mode"); } -- 2.7.4