OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL | 8 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL |
9 // DO NOT USE -- FOR INTERNAL TESTING ONLY | 9 // DO NOT USE -- FOR INTERNAL TESTING ONLY |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 sk_paint_delete(paint); | 47 sk_paint_delete(paint); |
48 } | 48 } |
49 | 49 |
50 void sk_test_c_api(sk_canvas_t* canvas) { | 50 void sk_test_c_api(sk_canvas_t* canvas) { |
51 do_draw(canvas); | 51 do_draw(canvas); |
52 | 52 |
53 sk_imageinfo_t info = { | 53 sk_imageinfo_t info = { |
54 W, H, sk_colortype_get_default_8888(), OPAQUE_SK_ALPHATYPE | 54 W, H, sk_colortype_get_default_8888(), OPAQUE_SK_ALPHATYPE |
55 }; | 55 }; |
56 sk_surface_t* surf = sk_surface_new_raster(&info); | 56 sk_surfaceprops_t surfaceProps = { UNKNOWN_SK_PIXELGEOMETRY }; |
| 57 sk_surface_t* surf = sk_surface_new_raster(&info, &surfaceProps); |
57 do_draw(sk_surface_get_canvas(surf)); | 58 do_draw(sk_surface_get_canvas(surf)); |
58 | 59 |
59 sk_image_t* img0 = sk_surface_new_image_snapshot(surf); | 60 sk_image_t* img0 = sk_surface_new_image_snapshot(surf); |
60 sk_surface_unref(surf); | 61 sk_surface_unref(surf); |
61 | 62 |
62 sk_canvas_draw_image(canvas, img0, W + 10, 10, NULL); | 63 sk_canvas_draw_image(canvas, img0, W + 10, 10, NULL); |
63 | 64 |
64 sk_data_t* data = sk_image_encode(img0); | 65 sk_data_t* data = sk_image_encode(img0); |
65 sk_image_unref(img0); | 66 sk_image_unref(img0); |
66 | 67 |
67 sk_image_t* img1 = sk_image_new_from_data(data); | 68 sk_image_t* img1 = sk_image_new_from_data(data); |
68 sk_data_unref(data); | 69 sk_data_unref(data); |
69 | 70 |
70 if (img1) { | 71 if (img1) { |
71 sk_canvas_draw_image(canvas, img1, W/2, H/2, NULL); | 72 sk_canvas_draw_image(canvas, img1, W/2, H/2, NULL); |
72 sk_image_unref(img1); | 73 sk_image_unref(img1); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 | 77 |
OLD | NEW |