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

Unified Diff: experimental/sk_surface.h

Issue 629903004: implement some so we can test it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months 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 | experimental/sk_surface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/sk_surface.h
diff --git a/experimental/sk_surface.h b/experimental/sk_surface.h
index 8a479c26e74e13d6768dda5a4b0985dfd65f4a8e..4c597ce49a7ad10ce3aa45f8ff65b54b625d8db5 100644
--- a/experimental/sk_surface.h
+++ b/experimental/sk_surface.h
@@ -1,9 +1,27 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef sk_types_DEFINED
+#define sk_types_DEFINED
+
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef uint32_t sk_color_t;
-sk_color_t sk_color_set_argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b);
-uint8_t sk_color_get_a(sk_color_t);
+#define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
+#define sk_color_get_a(c) (((c) >> 24) & 0xFF)
+#define sk_color_get_r(c) (((c) >> 16) & 0xFF)
+#define sk_color_get_g(c) (((c) >> 8) & 0xFF)
+#define sk_color_get_b(c) (((c) >> 0) & 0xFF)
typedef enum {
UNKNOWN_SK_COLORTYPE,
@@ -12,51 +30,51 @@ typedef enum {
ALPHA_8_SK_COLORTYPE,
} sk_colortype_t;
-typedef struct sk_imageinfo_t {
+typedef enum {
+ PREMUL_SK_ALPHATYPE,
+ UNPREMUL_SK_ALPHATYPE,
+} sk_alphatype_t;
+
+typedef struct {
int32_t width;
int32_t height;
sk_colortype_t colorType;
- sk_alphatype_t colorType;
-};
+ sk_alphatype_t alphaType;
+} sk_imageinfo_t;
-typedef struct sk_rect_t {
+typedef struct {
float left;
float top;
float right;
float bottom;
-};
-
-typedef struct sk_matrix_t {
- float mat[9];
-};
+} sk_rect_t;
-void sk_matrix_set_identity(sk_matrix_t*);
-
-typedef struct sk_path_t;
+typedef struct sk_path_t sk_path_t;
sk_path_t* sk_path_new();
-void sk_path_move_to(sk_path*, float x, float y);
-void sk_path_line_to(sk_path*, float x, float y);
-void sk_path_quad_to(sk_path*, float x0, float y1, float x1, float y1);
+void sk_path_move_to(sk_path_t*, float x, float y);
+void sk_path_line_to(sk_path_t*, float x, float y);
+void sk_path_quad_to(sk_path_t*, float x0, float y0, float x1, float y1);
void sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
-typedef struct sk_paint_t;
+typedef struct sk_paint_t sk_paint_t;
sk_paint_t* sk_paint_new();
+void sk_paint_delete(sk_paint_t*);
bool sk_paint_is_antialias(sk_paint_t*);
void sk_paint_set_antialias(sk_paint_t*, bool);
sk_color_t sk_paint_get_color(const sk_paint_t*);
void sk_paint_set_color(sk_paint_t*, sk_color_t);
-typedef struct sk_canvas_t;
+typedef struct sk_canvas_t sk_canvas_t;
+typedef struct sk_image_t sk_image_t;
void sk_canvas_save(sk_canvas_t*);
void sk_canvas_save_layer(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
void sk_canvas_restore(sk_canvas_t*);
-void sk_canvas_translate(sk_canvas_t*, sk_scalar_t dx, sk_scalar_t dy);
-void sk_canvas_scale(sk_canvas_t*, sk_scalar_t sx, sk_scalar_t sy);
-void sk_canvas_concat(sk_canvas_t*, const sk_matrix_t*);
+void sk_canvas_translate(sk_canvas_t*, float dx, float dy);
+void sk_canvas_scale(sk_canvas_t*, float sx, float sy);
void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*);
void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
@@ -64,20 +82,25 @@ void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*);
void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y, const sk_paint_t*);
-typedef struct sk_image_t;
-
-sk_image_t* sk_image_new_raster_copy(const sk_image_info_t*, const void* pixels, size_t rowBytes);
-
+sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels, size_t rowBytes);
+void sk_image_ref(const sk_image_t*);
+void sk_image_unref(const sk_image_t*);
int sk_image_get_width(const sk_image_t*);
int sk_image_get_height(const sk_image_t*);
uint32_t sk_image_get_unique_id(const sk_image_t*);
-typedef struct sk_surface_t;
+typedef struct sk_surface_t sk_surface_t;
-sk_surface_t* sk_surface_new_raster(const sk_image_info_t*)
-sk_surface_t* sk_surface_new_raster_direct(const sk_image_info_t*, void* pixels, size_t rowBytes);
+sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*);
+sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels, size_t rowBytes);
void sk_surface_delete(sk_surface_t*);
-
sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
+#ifdef __cplusplus
+ class SkCanvas;
+ void sk_test_capi(SkCanvas*);
+}
+#endif
+
+#endif
« no previous file with comments | « no previous file | experimental/sk_surface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698