Fix SampleApp busted images with --picture on windows.
Review URL: https://codereview.appspot.com/6942060

git-svn-id: http://skia.googlecode.com/svn/trunk@6842 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/views/win/skia_win.cpp b/src/views/win/skia_win.cpp
index 2643cc8..327b0cd 100644
--- a/src/views/win/skia_win.cpp
+++ b/src/views/win/skia_win.cpp
@@ -7,6 +7,9 @@
  */
 #include <Windows.h>
 #include <tchar.h>
+
+#include "SkApplication.h"
+
 #define MAX_LOADSTRING 100
 
 // Global Variables:
@@ -48,6 +51,8 @@
         }
     }
 
+    application_term();
+
     return (int) msg.wParam;
 }
 
@@ -118,12 +123,12 @@
 
 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPTSTR lpCmdLine)
 {
-   HWND hWnd;
+   application_init();
 
    hInst = hInstance; // Store instance handle in our global variable
 
-   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
-      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
+   HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
+                            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
 
    if (!hWnd)
    {
@@ -145,7 +150,6 @@
    for (int i = 0; i < argc; ++i) {
       free(argv[i]);
    }
-
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);