From dad57c8c48066a2e4b270b9f6992257f7090664c Mon Sep 17 00:00:00 2001 From: joshualitt Date: Wed, 11 Nov 2015 13:17:06 -0800 Subject: [PATCH] bring up SDL on windows BUG=skia: patch from issue 1432353002 at patchset 1 (http://crrev.com/1432353002#ps1) Review URL: https://codereview.chromium.org/1438003004 --- gyp/views.gyp | 4 + src/views/sdl/SkOSWindow_SDL.cpp | 2 +- third_party/libsdl/sdl.gypi | 5 + third_party/libsdl/win/README | 4 + third_party/libsdl/win/sdl_win.gypi | 159 ++++++++++++++++++++++++++++ 5 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 third_party/libsdl/win/README create mode 100644 third_party/libsdl/win/sdl_win.gypi diff --git a/gyp/views.gyp b/gyp/views.gyp index 1130e669d3..af0b9010c2 100644 --- a/gyp/views.gyp +++ b/gyp/views.gyp @@ -156,6 +156,10 @@ '../src/views/mac/SkNSView.mm', '../src/views/mac/SkOSWindow_Mac.mm', '../src/views/mac/skia_mac.mm', + + # win sources + '../src/views/win/SkOSWindow_win.cpp', + '../src/views/win/skia_win.cpp', ], 'sources': [ '../src/views/sdl/SkOSWindow_SDL.cpp', diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp index bc07745a26..8ee1e9dc65 100644 --- a/src/views/sdl/SkOSWindow_SDL.cpp +++ b/src/views/sdl/SkOSWindow_SDL.cpp @@ -68,7 +68,7 @@ SkOSWindow::SkOSWindow(void* screen) : fQuit(false) , fGLContext(nullptr) { handle_error(); return; } - this->resize(SkIntToScalar(dm.w), SkIntToScalar(dm.h)); + this->resize(dm.w, dm.h); } SkOSWindow::~SkOSWindow() { diff --git a/third_party/libsdl/sdl.gypi b/third_party/libsdl/sdl.gypi index 6b5df3f97b..4b3009b0d9 100644 --- a/third_party/libsdl/sdl.gypi +++ b/third_party/libsdl/sdl.gypi @@ -39,6 +39,11 @@ 'mac/sdl_mac.gypi', ] }], + ['skia_os == "win"', { + 'includes': [ + 'win/sdl_win.gypi', + ] + }], ], }, ], diff --git a/third_party/libsdl/win/README b/third_party/libsdl/win/README new file mode 100644 index 0000000000..605876e1df --- /dev/null +++ b/third_party/libsdl/win/README @@ -0,0 +1,4 @@ +There is no autogenerated SDL_config.h on windows. Build using visual +studio to get the list of files, then use the following command from +the sdl folder: +find . -type f -print | fgrep -f diff --git a/third_party/libsdl/win/sdl_win.gypi b/third_party/libsdl/win/sdl_win.gypi new file mode 100644 index 0000000000..ad3373190d --- /dev/null +++ b/third_party/libsdl/win/sdl_win.gypi @@ -0,0 +1,159 @@ +# Copyright 2015 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# Linux specific files and settings for SDL + +{ + #TODO what is really necessary here + 'link_settings': { + 'libraries': [ + "-lwinmm", + "-limm32", + "-lversion", + ], + }, + 'sources': [ + '<(src_dir)/src/joystick/windows/SDL_mmjoystick.c', + '<(src_dir)/src/joystick/windows/SDL_xinputjoystick.c', + '<(src_dir)/src/joystick/windows/SDL_dinputjoystick.c', + '<(src_dir)/src/joystick/windows/SDL_windowsjoystick.c', + '<(src_dir)/src/joystick/SDL_joystick.c', + '<(src_dir)/src/joystick/SDL_gamecontroller.c', + '<(src_dir)/src/SDL_log.c', + '<(src_dir)/src/core/windows/SDL_xinput.c', + '<(src_dir)/src/core/windows/SDL_windows.c', + '<(src_dir)/src/libm/s_fabs.c', + '<(src_dir)/src/libm/k_tan.c', + '<(src_dir)/src/libm/k_rem_pio2.c', + '<(src_dir)/src/libm/s_cos.c', + '<(src_dir)/src/libm/s_atan.c', + '<(src_dir)/src/libm/s_floor.c', + '<(src_dir)/src/libm/e_log.c', + '<(src_dir)/src/libm/s_tan.c', + '<(src_dir)/src/libm/s_sin.c', + '<(src_dir)/src/libm/e_atan2.c', + '<(src_dir)/src/libm/e_pow.c', + '<(src_dir)/src/libm/s_copysign.c', + '<(src_dir)/src/libm/e_rem_pio2.c', + '<(src_dir)/src/libm/k_sin.c', + '<(src_dir)/src/libm/k_cos.c', + '<(src_dir)/src/libm/e_sqrt.c', + '<(src_dir)/src/libm/s_scalbn.c', + '<(src_dir)/src/events/SDL_dropevents.c', + '<(src_dir)/src/events/SDL_touch.c', + '<(src_dir)/src/events/SDL_quit.c', + '<(src_dir)/src/events/SDL_gesture.c', + '<(src_dir)/src/events/SDL_events.c', + '<(src_dir)/src/events/SDL_windowevents.c', + '<(src_dir)/src/events/SDL_keyboard.c', + '<(src_dir)/src/events/SDL_clipboardevents.c', + '<(src_dir)/src/events/SDL_mouse.c', + '<(src_dir)/src/power/windows/SDL_syspower.c', + '<(src_dir)/src/power/SDL_power.c', + '<(src_dir)/src/timer/SDL_timer.c', + '<(src_dir)/src/timer/windows/SDL_systimer.c', + '<(src_dir)/src/dynapi/SDL_dynapi.c', + '<(src_dir)/src/SDL_hints.c', + '<(src_dir)/src/thread/generic/SDL_syscond.c', + '<(src_dir)/src/thread/windows/SDL_systhread.c', + '<(src_dir)/src/thread/windows/SDL_syssem.c', + '<(src_dir)/src/thread/windows/SDL_sysmutex.c', + '<(src_dir)/src/thread/windows/SDL_systls.c', + '<(src_dir)/src/thread/SDL_thread.c', + '<(src_dir)/src/haptic/windows/SDL_windowshaptic.c', + '<(src_dir)/src/haptic/windows/SDL_xinputhaptic.c', + '<(src_dir)/src/haptic/windows/SDL_dinputhaptic.c', + '<(src_dir)/src/haptic/SDL_haptic.c', + '<(src_dir)/src/render/SDL_yuv_mmx.c', + '<(src_dir)/src/render/SDL_d3dmath.c', + '<(src_dir)/src/render/direct3d/SDL_render_d3d.c', + '<(src_dir)/src/render/direct3d11/SDL_render_d3d11.c', + '<(src_dir)/src/render/SDL_render.c', + '<(src_dir)/src/render/opengl/SDL_render_gl.c', + '<(src_dir)/src/render/opengl/SDL_shaders_gl.c', + '<(src_dir)/src/render/software/SDL_render_sw.c', + '<(src_dir)/src/render/software/SDL_drawline.c', + '<(src_dir)/src/render/software/SDL_rotate.c', + '<(src_dir)/src/render/software/SDL_blendpoint.c', + '<(src_dir)/src/render/software/SDL_drawpoint.c', + '<(src_dir)/src/render/software/SDL_blendfillrect.c', + '<(src_dir)/src/render/software/SDL_blendline.c', + '<(src_dir)/src/render/opengles2/SDL_render_gles2.c', + '<(src_dir)/src/render/opengles2/SDL_shaders_gles2.c', + '<(src_dir)/src/render/SDL_yuv_sw.c', + '<(src_dir)/src/filesystem/windows/SDL_sysfilesystem.c', + '<(src_dir)/src/file/SDL_rwops.c', + '<(src_dir)/src/stdlib/SDL_getenv.c', + '<(src_dir)/src/stdlib/SDL_iconv.c', + '<(src_dir)/src/stdlib/SDL_stdlib.c', + '<(src_dir)/src/stdlib/SDL_string.c', + '<(src_dir)/src/stdlib/SDL_malloc.c', + '<(src_dir)/src/stdlib/SDL_qsort.c', + '<(src_dir)/src/SDL_assert.c', + '<(src_dir)/src/SDL.c', + '<(src_dir)/src/atomic/SDL_atomic.c', + '<(src_dir)/src/atomic/SDL_spinlock.c', + '<(src_dir)/src/loadso/windows/SDL_sysloadso.c', + '<(src_dir)/src/audio/dummy/SDL_dummyaudio.c', + '<(src_dir)/src/audio/SDL_audiocvt.c', + '<(src_dir)/src/audio/SDL_audio.c', + '<(src_dir)/src/audio/xaudio2/SDL_xaudio2.c', + '<(src_dir)/src/audio/SDL_audiodev.c', + '<(src_dir)/src/audio/SDL_audiotypecvt.c', + '<(src_dir)/src/audio/disk/SDL_diskaudio.c', + '<(src_dir)/src/audio/SDL_wave.c', + '<(src_dir)/src/audio/winmm/SDL_winmm.c', + '<(src_dir)/src/audio/SDL_mixer.c', + '<(src_dir)/src/audio/directsound/SDL_directsound.c', + '<(src_dir)/src/cpuinfo/SDL_cpuinfo.c', + '<(src_dir)/src/SDL_error.c', + '<(src_dir)/src/video/SDL_bmp.c', + '<(src_dir)/src/video/dummy/SDL_nullevents.c', + '<(src_dir)/src/video/dummy/SDL_nullvideo.c', + '<(src_dir)/src/video/dummy/SDL_nullframebuffer.c', + '<(src_dir)/src/video/SDL_blit_auto.c', + '<(src_dir)/src/video/SDL_shape.c', + '<(src_dir)/src/video/SDL_blit_N.c', + '<(src_dir)/src/video/windows/SDL_windowsframebuffer.c', + '<(src_dir)/src/video/windows/SDL_windowskeyboard.c', + '<(src_dir)/src/video/windows/SDL_windowsshape.c', + '<(src_dir)/src/video/windows/SDL_windowswindow.c', + '<(src_dir)/src/video/windows/SDL_windowsopengl.c', + '<(src_dir)/src/video/windows/SDL_windowsvideo.c', + '<(src_dir)/src/video/windows/SDL_windowsmessagebox.c', + '<(src_dir)/src/video/windows/SDL_windowsopengles.c', + '<(src_dir)/src/video/windows/SDL_windowsevents.c', + '<(src_dir)/src/video/windows/SDL_windowsmodes.c', + '<(src_dir)/src/video/windows/SDL_windowsmouse.c', + '<(src_dir)/src/video/windows/SDL_windowsclipboard.c', + '<(src_dir)/src/video/SDL_blit_A.c', + '<(src_dir)/src/video/SDL_pixels.c', + '<(src_dir)/src/video/SDL_rect.c', + '<(src_dir)/src/video/SDL_video.c', + '<(src_dir)/src/video/SDL_stretch.c', + '<(src_dir)/src/video/SDL_surface.c', + '<(src_dir)/src/video/SDL_fillrect.c', + '<(src_dir)/src/video/SDL_blit_copy.c', + '<(src_dir)/src/video/SDL_blit_1.c', + '<(src_dir)/src/video/SDL_egl.c', + '<(src_dir)/src/video/SDL_RLEaccel.c', + '<(src_dir)/src/video/SDL_blit_slow.c', + '<(src_dir)/src/video/SDL_blit.c', + '<(src_dir)/src/video/SDL_clipboard.c', + '<(src_dir)/src/video/SDL_blit_0.c', + '<(src_dir)/src/main/windows/SDL_windows_main.c', + ], + 'defines': [ + '_REENTRANT' + ], + 'cflags': [ + '-fPIC', + '-O3', + '-mmmx', + '-m3dnow', + '-msse', + '-msse2', + '-fvisibility=hidden', + ], +}