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

Unified Diff: sky/engine/core/painting/Matrix4.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: . Created 5 years, 7 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/Matrix4.h ('k') | sky/engine/core/painting/Matrix4.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Matrix4.cpp
diff --git a/sky/engine/core/painting/Rect.cpp b/sky/engine/core/painting/Matrix4.cpp
similarity index 51%
copy from sky/engine/core/painting/Rect.cpp
copy to sky/engine/core/painting/Matrix4.cpp
index ee0bb3cd26634b7f61298540aaafdca93e0079ce..220ac6d927006675958413f38760689ec45dee10 100644
--- a/sky/engine/core/painting/Rect.cpp
+++ b/sky/engine/core/painting/Matrix4.cpp
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "sky/engine/config.h"
-#include "sky/engine/core/painting/Rect.h"
+#include "sky/engine/core/painting/Matrix4.h"
#include "sky/engine/core/script/dom_dart_state.h"
#include "sky/engine/tonic/dart_error.h"
@@ -12,18 +12,19 @@
namespace blink {
-// Convert dart_rect._value[0...3] ==> SkRect.
-Rect DartConverter<Rect>::FromArgumentsWithNullCheck(Dart_NativeArguments args,
- int index,
- Dart_Handle& exception) {
- Rect result;
+// Convert dart_matrix._value[0...16] ==> SkMatrix.
+Matrix4 DartConverter<Matrix4>::FromArgumentsWithNullCheck(
+ Dart_NativeArguments args,
+ int index,
+ Dart_Handle& exception) {
+ Matrix4 result;
result.is_null = true;
- Dart_Handle dart_rect = Dart_GetNativeArgument(args, index);
- DCHECK(!LogIfError(dart_rect));
+ Dart_Handle dart_matrix = Dart_GetNativeArgument(args, index);
+ DCHECK(!LogIfError(dart_matrix));
Dart_Handle value =
- Dart_GetField(dart_rect, DOMDartState::Current()->value_handle());
+ Dart_GetField(dart_matrix, DOMDartState::Current()->value_handle());
if (Dart_IsNull(value))
return result;
@@ -33,16 +34,16 @@ Rect DartConverter<Rect>::FromArgumentsWithNullCheck(Dart_NativeArguments args,
Dart_TypedDataAcquireData(
value, &type, reinterpret_cast<void**>(&data), &num_elements);
DCHECK(!LogIfError(value));
- ASSERT(type == Dart_TypedData_kFloat32 && num_elements == 4);
+ ASSERT(type == Dart_TypedData_kFloat32 && num_elements == 16);
- SkScalar* dest[] = {
- &result.sk_rect.fLeft,
- &result.sk_rect.fTop,
- &result.sk_rect.fRight,
- &result.sk_rect.fBottom
+ // 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 < 4; ++i)
- *dest[i] = data[i];
+ for (intptr_t i = 0; i < 9; ++i)
+ result.sk_matrix[i] = data[kMappings[i]];
Dart_TypedDataReleaseData(value);
« no previous file with comments | « sky/engine/core/painting/Matrix4.h ('k') | sky/engine/core/painting/Matrix4.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698