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

Unified Diff: src/c/sk_surface.cpp

Issue 769123002: Add matrix operations to C canvas API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review comments Created 6 years 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 | « include/c/sk_canvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/c/sk_surface.cpp
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index c75ab23d55728f67ee0b348ba70bac82a3d24c65..94e925ada4e558b0b608187daf0bc0a5bbd663fd 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -91,6 +91,12 @@ static bool from_c_info(const sk_imageinfo_t& cinfo, SkImageInfo* info) {
return true;
}
+static void from_c_matrix(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
+ matrix->setAll(cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
+ cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
+ cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
+}
+
const struct {
sk_path_direction_t fC;
SkPath::Direction fSk;
@@ -320,6 +326,13 @@ void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy) {
AsCanvas(ccanvas)->skew(sx, sy);
}
+void sk_canvas_concat_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix) {
+ SkASSERT(cmatrix);
+ SkMatrix matrix;
+ from_c_matrix(cmatrix, &matrix);
+ AsCanvas(ccanvas)->concat(matrix);
+}
+
void sk_canvas_draw_paint(sk_canvas_t* ccanvas, const sk_paint_t* cpaint) {
AsCanvas(ccanvas)->drawPaint(AsPaint(*cpaint));
}
@@ -420,9 +433,7 @@ sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2],
}
SkMatrix matrix;
if (cmatrix) {
- matrix.setAll(cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
- cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
- cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
+ from_c_matrix(cmatrix, &matrix);
} else {
matrix.setIdentity();
}
« no previous file with comments | « include/c/sk_canvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698