Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: gm/cgm.c

Issue 736133006: more c (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/cgms.cpp » ('j') | include/c/sk_matrix.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/cgm.c
diff --git a/gm/cgm.c b/gm/cgm.c
new file mode 100644
index 0000000000000000000000000000000000000000..cddb2c14e28e755413683d3429770d3a5b524586
--- /dev/null
+++ b/gm/cgm.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#include "sk_canvas.h"
+#include "sk_paint.h"
+#include "sk_shader.h"
+#include "sk_surface.h"
+
+extern void sk_test_c_api(sk_canvas_t*);
+
+#define W 256
+#define H 256
+
+static sk_shader_t* make_shader() {
+ sk_point_t pts[] = { { 0, 0 }, { W, H } };
+ sk_color_t colors[] = { 0xFF00FF00, 0xFF0000FF };
+ return sk_shader_new_linear_gradient(pts, colors, NULL, 2, CLAMP_SK_SHADER_TILEMODE, NULL);
+}
+
+void sk_test_c_api(sk_canvas_t* canvas) {
+ sk_paint_t* paint = sk_paint_new();
+ sk_paint_set_antialias(paint, true);
+
+ sk_paint_set_color(paint, 0xFFFFFFFF);
+ sk_canvas_draw_paint(canvas, paint);
+
+ sk_rect_t r = { 10, 10, W - 10, H - 10 };
+
+ sk_paint_set_color(paint, 0xFFFF0000);
+ sk_canvas_draw_rect(canvas, &r, paint);
+
+ sk_shader_t* shader = make_shader();
+ sk_paint_set_shader(paint, shader);
+ sk_shader_unref(shader);
+
+ sk_canvas_draw_oval(canvas, &r, paint);
+
+ sk_paint_delete(paint);
+}
+
+
« no previous file with comments | « no previous file | gm/cgms.cpp » ('j') | include/c/sk_matrix.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698