OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GLFW/glfw3.h" | 8 #include "GLFW/glfw3.h" |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 init_skia(kWidth, kHeight); | 77 init_skia(kWidth, kHeight); |
78 | 78 |
79 SkAutoTUnref<SkImage> atlas; | 79 SkAutoTUnref<SkImage> atlas; |
80 SkRSXform xform[kGrid*kGrid+1]; | 80 SkRSXform xform[kGrid*kGrid+1]; |
81 SkRect tex[kGrid*kGrid+1]; | 81 SkRect tex[kGrid*kGrid+1]; |
82 WallTimer timer; | 82 WallTimer timer; |
83 float times[32]; | 83 float times[32]; |
84 int currentTime; | 84 int currentTime; |
85 | 85 |
86 SkAutoTUnref<SkData> imageData(SkData::NewFromFileName("ship.png")); | 86 sk_sp<SkData> imageData(SkData::MakeFromFileName("ship.png")); |
87 atlas.reset(SkImage::NewFromEncoded(imageData)); | 87 atlas.reset(SkImage::NewFromEncoded(imageData.get())); |
88 if (!atlas) { | 88 if (!atlas) { |
89 SkDebugf("\nCould not decode file ship.png\n"); | 89 SkDebugf("\nCould not decode file ship.png\n"); |
90 | 90 |
91 cleanup_skia(); | 91 cleanup_skia(); |
92 glfwDestroyWindow(window); | 92 glfwDestroyWindow(window); |
93 glfwTerminate(); | 93 glfwTerminate(); |
94 exit(EXIT_FAILURE); | 94 exit(EXIT_FAILURE); |
95 } | 95 } |
96 | 96 |
97 SkScalar anchorX = atlas->width()*0.5f; | 97 SkScalar anchorX = atlas->width()*0.5f; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 glfwSwapBuffers(window); | 171 glfwSwapBuffers(window); |
172 } | 172 } |
173 | 173 |
174 cleanup_skia(); | 174 cleanup_skia(); |
175 | 175 |
176 glfwDestroyWindow(window); | 176 glfwDestroyWindow(window); |
177 glfwTerminate(); | 177 glfwTerminate(); |
178 exit(EXIT_SUCCESS); | 178 exit(EXIT_SUCCESS); |
179 } | 179 } |
OLD | NEW |