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

Unified Diff: sky/engine/tonic/float32_list.h

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/tonic/BUILD.gn ('k') | sky/engine/tonic/float32_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/tonic/float32_list.h
diff --git a/sky/engine/tonic/float32_list.h b/sky/engine/tonic/float32_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..be9503ba3157dee0f1d5e582ac6fc731d587922e
--- /dev/null
+++ b/sky/engine/tonic/float32_list.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_ENGINE_TONIC_FLOAT32_LIST_H_
+#define SKY_ENGINE_TONIC_FLOAT32_LIST_H_
+
+#include "dart/runtime/include/dart_api.h"
+#include "sky/engine/tonic/dart_converter.h"
+
+namespace blink {
+
+// A simple wrapper around a Dart Float32List. It uses Dart_TypedDataAcquireData
+// to obtain a raw pointer to the data, which is released when this object is
+// destroyed.
+//
+// This is designed to be used with DartConverter only.
+class Float32List {
+ public:
+ explicit Float32List(Dart_Handle list);
+ Float32List(Float32List&& other);
+ ~Float32List();
+
+ const float* data() const { return data_; }
+ intptr_t num_elements() const { return num_elements_; }
+
+ private:
+ float* data_;
+ intptr_t num_elements_;
+ Dart_Handle dart_handle_;
+
+ Float32List(const Float32List& other) = delete;
+};
+
+template <>
+struct DartConverter<Float32List> {
+ static Float32List FromArgumentsWithNullCheck(Dart_NativeArguments args,
+ int index,
+ Dart_Handle& exception);
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_TONIC_FLOAT32_LIST_H_
« no previous file with comments | « sky/engine/tonic/BUILD.gn ('k') | sky/engine/tonic/float32_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698