| 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 #include "sk_canvas.h" |
| 9 #include "sk_paint.h" |
| 8 #include "sk_surface.h" | 10 #include "sk_surface.h" |
| 11 |
| 9 #include "Test.h" | 12 #include "Test.h" |
| 10 | 13 |
| 11 static void test_c(skiatest::Reporter* reporter) { | 14 static void test_c(skiatest::Reporter* reporter) { |
| 12 sk_colortype_t ct = sk_colortype_get_default_8888(); | 15 sk_colortype_t ct = sk_colortype_get_default_8888(); |
| 13 | 16 |
| 14 sk_imageinfo_t info = { | 17 sk_imageinfo_t info = { |
| 15 1, 1, ct, PREMUL_SK_ALPHATYPE | 18 1, 1, ct, PREMUL_SK_ALPHATYPE |
| 16 }; | 19 }; |
| 17 uint32_t pixel[1] = { 0 }; | 20 uint32_t pixel[1] = { 0 }; |
| 18 | 21 |
| 19 sk_surface_t* surface = sk_surface_new_raster_direct(&info, pixel, sizeof(ui
nt32_t)); | 22 sk_surface_t* surface = sk_surface_new_raster_direct(&info, pixel, sizeof(ui
nt32_t)); |
| 20 sk_paint_t* paint = sk_paint_new(); | 23 sk_paint_t* paint = sk_paint_new(); |
| 21 | 24 |
| 22 sk_canvas_t* canvas = sk_surface_get_canvas(surface); | 25 sk_canvas_t* canvas = sk_surface_get_canvas(surface); |
| 23 sk_canvas_draw_paint(canvas, paint); | 26 sk_canvas_draw_paint(canvas, paint); |
| 24 REPORTER_ASSERT(reporter, 0xFF000000 == pixel[0]); | 27 REPORTER_ASSERT(reporter, 0xFF000000 == pixel[0]); |
| 25 | 28 |
| 26 sk_paint_set_color(paint, sk_color_set_argb(0xFF, 0xFF, 0xFF, 0xFF)); | 29 sk_paint_set_color(paint, sk_color_set_argb(0xFF, 0xFF, 0xFF, 0xFF)); |
| 27 sk_canvas_draw_paint(canvas, paint); | 30 sk_canvas_draw_paint(canvas, paint); |
| 28 REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]); | 31 REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]); |
| 29 | 32 |
| 30 sk_paint_delete(paint); | 33 sk_paint_delete(paint); |
| 31 sk_surface_delete(surface); | 34 sk_surface_delete(surface); |
| 32 } | 35 } |
| 33 | 36 |
| 34 DEF_TEST(C_API, reporter) { | 37 DEF_TEST(C_API, reporter) { |
| 35 test_c(reporter); | 38 test_c(reporter); |
| 36 } | 39 } |
| OLD | NEW |