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

Unified Diff: sky/engine/core/painting/Canvas.cpp

Issue 1155193004: Canvas.concat takes a 16-element Float32List instead of an array. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: more fixes Created 5 years, 6 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 | « sky/engine/core/painting/Canvas.h ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Canvas.cpp
diff --git a/sky/engine/core/painting/Canvas.cpp b/sky/engine/core/painting/Canvas.cpp
index 1fa585569f7064fcb3a07ecd2a2d8101a3604345..ccd4fafaaab251d0ded2f7588551e66505796281 100644
--- a/sky/engine/core/painting/Canvas.cpp
+++ b/sky/engine/core/painting/Canvas.cpp
@@ -83,14 +83,27 @@ void Canvas::skew(float sx, float sy)
m_canvas->skew(sx, sy);
}
-void Canvas::concat(const Vector<float>& matrix)
+void Canvas::concat(const Float32List& matrix4)
{
if (!m_canvas)
return;
ASSERT(m_displayList->isRecording());
- ASSERT(matrix.size() == 9);
+ ASSERT(matrix4.data());
+
+ // TODO(mpcomplete): how can we raise an error in this case?
+ if (matrix4.num_elements() != 16)
+ return;
+
SkMatrix sk_matrix;
- sk_matrix.set9(matrix.data());
+ // Mappings from SkMatrix-index to input-index.
+ static const int kMappings[] = {
+ 0, 4, 12,
+ 1, 5, 13,
+ 3, 7, 15,
+ };
+ for (intptr_t i = 0; i < 9; ++i)
+ sk_matrix[i] = matrix4.data()[kMappings[i]];
+
m_canvas->concat(sk_matrix);
}
« no previous file with comments | « sky/engine/core/painting/Canvas.h ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698