Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
c9cf1f3b
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c9cf1f3b
编写于
1月 18, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove integration between tonic and WTF::Vector
There's no reason to use WTF::Vector here over std::vector.
上级
0140555b
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
112 addition
and
111 deletion
+112
-111
sky/engine/bindings/jni/dart_jni.cc
sky/engine/bindings/jni/dart_jni.cc
+1
-1
sky/engine/bindings/jni/dart_jni.h
sky/engine/bindings/jni/dart_jni.h
+1
-1
sky/engine/bindings/jni/jni_class.cc
sky/engine/bindings/jni/jni_class.cc
+12
-12
sky/engine/bindings/jni/jni_class.h
sky/engine/bindings/jni/jni_class.h
+13
-12
sky/engine/bindings/jni/jni_object.cc
sky/engine/bindings/jni/jni_object.cc
+6
-6
sky/engine/bindings/jni/jni_object.h
sky/engine/bindings/jni/jni_object.h
+5
-4
sky/engine/core/painting/Canvas.cpp
sky/engine/core/painting/Canvas.cpp
+31
-31
sky/engine/core/painting/Canvas.h
sky/engine/core/painting/Canvas.h
+8
-6
sky/engine/core/painting/CanvasGradient.cpp
sky/engine/core/painting/CanvasGradient.cpp
+11
-11
sky/engine/core/painting/CanvasGradient.h
sky/engine/core/painting/CanvasGradient.h
+5
-5
sky/engine/tonic/dart_converter.h
sky/engine/tonic/dart_converter.h
+13
-18
sky/engine/tonic/dart_wrappable.h
sky/engine/tonic/dart_wrappable.h
+2
-0
sky/engine/tonic/float32_list.cc
sky/engine/tonic/float32_list.cc
+1
-1
sky/engine/tonic/float64_list.cc
sky/engine/tonic/float64_list.cc
+1
-1
sky/engine/tonic/int32_list.cc
sky/engine/tonic/int32_list.cc
+1
-1
sky/engine/tonic/uint8_list.cc
sky/engine/tonic/uint8_list.cc
+1
-1
未找到文件。
sky/engine/bindings/jni/dart_jni.cc
浏览文件 @
c9cf1f3b
...
@@ -242,7 +242,7 @@ Dart_Handle DartJni::jni_float_type() {
...
@@ -242,7 +242,7 @@ Dart_Handle DartJni::jni_float_type() {
}
}
void
JniMethodArgs
::
Convert
(
JNIEnv
*
env
,
void
JniMethodArgs
::
Convert
(
JNIEnv
*
env
,
const
V
ector
<
Dart_Handle
>&
dart_args
,
const
std
::
v
ector
<
Dart_Handle
>&
dart_args
,
Dart_Handle
*
exception
)
{
Dart_Handle
*
exception
)
{
jvalues_
.
reserve
(
dart_args
.
size
());
jvalues_
.
reserve
(
dart_args
.
size
());
...
...
sky/engine/bindings/jni/dart_jni.h
浏览文件 @
c9cf1f3b
...
@@ -42,7 +42,7 @@ class DartJni {
...
@@ -42,7 +42,7 @@ class DartJni {
class
JniMethodArgs
{
class
JniMethodArgs
{
public:
public:
void
Convert
(
JNIEnv
*
env
,
void
Convert
(
JNIEnv
*
env
,
const
V
ector
<
Dart_Handle
>&
dart_args
,
const
std
::
v
ector
<
Dart_Handle
>&
dart_args
,
Dart_Handle
*
exception
);
Dart_Handle
*
exception
);
jvalue
*
jvalues
()
{
return
jvalues_
.
data
();
}
jvalue
*
jvalues
()
{
return
jvalues_
.
data
();
}
...
...
sky/engine/bindings/jni/jni_class.cc
浏览文件 @
c9cf1f3b
...
@@ -119,8 +119,8 @@ fail:
...
@@ -119,8 +119,8 @@ fail:
return
0
;
return
0
;
}
}
PassRefPtr
<
JniObject
>
JniClass
::
NewObject
(
jmethodID
methodId
,
PassRefPtr
<
JniObject
>
JniClass
::
NewObject
(
const
V
ector
<
Dart_Handle
>&
args
)
{
jmethodID
methodId
,
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -430,7 +430,7 @@ fail:
...
@@ -430,7 +430,7 @@ fail:
}
}
PassRefPtr
<
JniObject
>
JniClass
::
CallStaticObjectMethod
(
PassRefPtr
<
JniObject
>
JniClass
::
CallStaticObjectMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
jmethodID
methodId
,
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -452,7 +452,7 @@ fail:
...
@@ -452,7 +452,7 @@ fail:
}
}
bool
JniClass
::
CallStaticBooleanMethod
(
jmethodID
methodId
,
bool
JniClass
::
CallStaticBooleanMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -474,7 +474,7 @@ fail:
...
@@ -474,7 +474,7 @@ fail:
}
}
int64_t
JniClass
::
CallStaticByteMethod
(
jmethodID
methodId
,
int64_t
JniClass
::
CallStaticByteMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -496,7 +496,7 @@ fail:
...
@@ -496,7 +496,7 @@ fail:
}
}
int64_t
JniClass
::
CallStaticCharMethod
(
jmethodID
methodId
,
int64_t
JniClass
::
CallStaticCharMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -518,7 +518,7 @@ fail:
...
@@ -518,7 +518,7 @@ fail:
}
}
int64_t
JniClass
::
CallStaticShortMethod
(
jmethodID
methodId
,
int64_t
JniClass
::
CallStaticShortMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -540,7 +540,7 @@ fail:
...
@@ -540,7 +540,7 @@ fail:
}
}
int64_t
JniClass
::
CallStaticIntMethod
(
jmethodID
methodId
,
int64_t
JniClass
::
CallStaticIntMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -562,7 +562,7 @@ fail:
...
@@ -562,7 +562,7 @@ fail:
}
}
int64_t
JniClass
::
CallStaticLongMethod
(
jmethodID
methodId
,
int64_t
JniClass
::
CallStaticLongMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -584,7 +584,7 @@ fail:
...
@@ -584,7 +584,7 @@ fail:
}
}
double
JniClass
::
CallStaticFloatMethod
(
jmethodID
methodId
,
double
JniClass
::
CallStaticFloatMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -606,7 +606,7 @@ fail:
...
@@ -606,7 +606,7 @@ fail:
}
}
double
JniClass
::
CallStaticDoubleMethod
(
jmethodID
methodId
,
double
JniClass
::
CallStaticDoubleMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -628,7 +628,7 @@ fail:
...
@@ -628,7 +628,7 @@ fail:
}
}
void
JniClass
::
CallStaticVoidMethod
(
jmethodID
methodId
,
void
JniClass
::
CallStaticVoidMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
...
sky/engine/bindings/jni/jni_class.h
浏览文件 @
c9cf1f3b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_android.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefCounted.h"
namespace
blink
{
namespace
blink
{
...
@@ -31,7 +32,7 @@ class JniClass : public RefCounted<JniClass>, public DartWrappable {
...
@@ -31,7 +32,7 @@ class JniClass : public RefCounted<JniClass>, public DartWrappable {
intptr_t
GetStaticMethodId
(
const
char
*
name
,
const
char
*
sig
);
intptr_t
GetStaticMethodId
(
const
char
*
name
,
const
char
*
sig
);
PassRefPtr
<
JniObject
>
NewObject
(
jmethodID
methodId
,
PassRefPtr
<
JniObject
>
NewObject
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
PassRefPtr
<
JniObject
>
GetStaticObjectField
(
jfieldID
fieldId
);
PassRefPtr
<
JniObject
>
GetStaticObjectField
(
jfieldID
fieldId
);
bool
GetStaticBooleanField
(
jfieldID
fieldId
);
bool
GetStaticBooleanField
(
jfieldID
fieldId
);
...
@@ -53,26 +54,26 @@ class JniClass : public RefCounted<JniClass>, public DartWrappable {
...
@@ -53,26 +54,26 @@ class JniClass : public RefCounted<JniClass>, public DartWrappable {
void
SetStaticFloatField
(
jfieldID
fieldId
,
double
value
);
void
SetStaticFloatField
(
jfieldID
fieldId
,
double
value
);
void
SetStaticDoubleField
(
jfieldID
fieldId
,
double
value
);
void
SetStaticDoubleField
(
jfieldID
fieldId
,
double
value
);
PassRefPtr
<
JniObject
>
CallStaticObjectMethod
(
jmethodID
methodId
,
PassRefPtr
<
JniObject
>
CallStaticObjectMethod
(
const
V
ector
<
Dart_Handle
>&
args
);
jmethodID
methodId
,
const
std
::
v
ector
<
Dart_Handle
>&
args
);
bool
CallStaticBooleanMethod
(
jmethodID
methodId
,
bool
CallStaticBooleanMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallStaticByteMethod
(
jmethodID
methodId
,
int64_t
CallStaticByteMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallStaticCharMethod
(
jmethodID
methodId
,
int64_t
CallStaticCharMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallStaticShortMethod
(
jmethodID
methodId
,
int64_t
CallStaticShortMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallStaticIntMethod
(
jmethodID
methodId
,
int64_t
CallStaticIntMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallStaticLongMethod
(
jmethodID
methodId
,
int64_t
CallStaticLongMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
double
CallStaticFloatMethod
(
jmethodID
methodId
,
double
CallStaticFloatMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
double
CallStaticDoubleMethod
(
jmethodID
methodId
,
double
CallStaticDoubleMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
void
CallStaticVoidMethod
(
jmethodID
methodId
,
void
CallStaticVoidMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
private:
private:
JniClass
(
JNIEnv
*
env
,
jclass
clazz
);
JniClass
(
JNIEnv
*
env
,
jclass
clazz
);
...
...
sky/engine/bindings/jni/jni_object.cc
浏览文件 @
c9cf1f3b
...
@@ -56,7 +56,7 @@ fail:
...
@@ -56,7 +56,7 @@ fail:
PassRefPtr
<
JniObject
>
JniObject
::
CallObjectMethod
(
PassRefPtr
<
JniObject
>
JniObject
::
CallObjectMethod
(
jmethodID
methodId
,
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -78,7 +78,7 @@ fail:
...
@@ -78,7 +78,7 @@ fail:
}
}
bool
JniObject
::
CallBooleanMethod
(
jmethodID
methodId
,
bool
JniObject
::
CallBooleanMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -100,7 +100,7 @@ fail:
...
@@ -100,7 +100,7 @@ fail:
}
}
int64_t
JniObject
::
CallIntMethod
(
jmethodID
methodId
,
int64_t
JniObject
::
CallIntMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
)
{
const
std
::
v
ector
<
Dart_Handle
>&
args
)
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -133,7 +133,7 @@ jstring JniString::java_string() {
...
@@ -133,7 +133,7 @@ jstring JniString::java_string() {
return
static_cast
<
jstring
>
(
java_object
());
return
static_cast
<
jstring
>
(
java_object
());
}
}
S
tring
JniString
::
GetText
()
{
std
::
s
tring
JniString
::
GetText
()
{
Dart_Handle
exception
=
nullptr
;
Dart_Handle
exception
=
nullptr
;
{
{
ENTER_JNI
();
ENTER_JNI
();
...
@@ -144,7 +144,7 @@ String JniString::GetText() {
...
@@ -144,7 +144,7 @@ String JniString::GetText() {
const
jchar
*
chars
=
env
->
GetStringChars
(
java_string
(),
NULL
);
const
jchar
*
chars
=
env
->
GetStringChars
(
java_string
(),
NULL
);
if
(
CheckJniException
(
env
,
&
exception
))
goto
fail
;
if
(
CheckJniException
(
env
,
&
exception
))
goto
fail
;
String
result
(
chars
,
length
);
std
::
string
result
(
reinterpret_cast
<
const
char
*>
(
chars
)
,
length
);
env
->
ReleaseStringChars
(
java_string
(),
chars
);
env
->
ReleaseStringChars
(
java_string
(),
chars
);
return
result
;
return
result
;
...
@@ -152,7 +152,7 @@ String JniString::GetText() {
...
@@ -152,7 +152,7 @@ String JniString::GetText() {
fail:
fail:
Dart_ThrowException
(
exception
);
Dart_ThrowException
(
exception
);
ASSERT_NOT_REACHED
();
ASSERT_NOT_REACHED
();
return
S
tring
();
return
std
::
s
tring
();
}
}
}
// namespace blink
}
// namespace blink
sky/engine/bindings/jni/jni_object.h
浏览文件 @
c9cf1f3b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_android.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefCounted.h"
namespace
blink
{
namespace
blink
{
...
@@ -27,11 +28,11 @@ class JniObject : public RefCounted<JniObject>, public DartWrappable {
...
@@ -27,11 +28,11 @@ class JniObject : public RefCounted<JniObject>, public DartWrappable {
int64_t
GetIntField
(
jfieldID
fieldId
);
int64_t
GetIntField
(
jfieldID
fieldId
);
PassRefPtr
<
JniObject
>
CallObjectMethod
(
jmethodID
methodId
,
PassRefPtr
<
JniObject
>
CallObjectMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
bool
CallBooleanMethod
(
jmethodID
methodId
,
bool
CallBooleanMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
int64_t
CallIntMethod
(
jmethodID
methodId
,
int64_t
CallIntMethod
(
jmethodID
methodId
,
const
V
ector
<
Dart_Handle
>&
args
);
const
std
::
v
ector
<
Dart_Handle
>&
args
);
protected:
protected:
JniObject
(
JNIEnv
*
env
,
jobject
object
);
JniObject
(
JNIEnv
*
env
,
jobject
object
);
...
@@ -47,7 +48,7 @@ class JniString : public JniObject {
...
@@ -47,7 +48,7 @@ class JniString : public JniObject {
public:
public:
~
JniString
()
override
;
~
JniString
()
override
;
S
tring
GetText
();
std
::
s
tring
GetText
();
private:
private:
JniString
(
JNIEnv
*
env
,
jstring
string
);
JniString
(
JNIEnv
*
env
,
jstring
string
);
...
...
sky/engine/core/painting/Canvas.cpp
浏览文件 @
c9cf1f3b
...
@@ -279,35 +279,35 @@ void Canvas::drawPicture(Picture* picture)
...
@@ -279,35 +279,35 @@ void Canvas::drawPicture(Picture* picture)
}
}
void
Canvas
::
drawVertices
(
SkCanvas
::
VertexMode
vertexMode
,
void
Canvas
::
drawVertices
(
SkCanvas
::
VertexMode
vertexMode
,
const
V
ector
<
Point
>&
vertices
,
const
std
::
v
ector
<
Point
>&
vertices
,
const
V
ector
<
Point
>&
textureCoordinates
,
const
std
::
v
ector
<
Point
>&
textureCoordinates
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
TransferMode
transferMode
,
TransferMode
transferMode
,
const
V
ector
<
int
>&
indices
,
const
std
::
v
ector
<
int
>&
indices
,
const
Paint
&
paint
)
const
Paint
&
paint
)
{
{
if
(
!
m_canvas
)
if
(
!
m_canvas
)
return
;
return
;
V
ector
<
SkPoint
>
skVertices
;
std
::
v
ector
<
SkPoint
>
skVertices
;
skVertices
.
reserve
InitialCapacity
(
vertices
.
size
());
skVertices
.
reserve
(
vertices
.
size
());
for
(
const
Point
&
point
:
vertices
)
for
(
const
Point
&
point
:
vertices
)
skVertices
.
append
(
point
.
sk_point
);
skVertices
.
push_back
(
point
.
sk_point
);
V
ector
<
SkPoint
>
skTextureCoordinates
;
std
::
v
ector
<
SkPoint
>
skTextureCoordinates
;
skVertices
.
reserve
InitialCapacity
(
textureCoordinates
.
size
());
skVertices
.
reserve
(
textureCoordinates
.
size
());
for
(
const
Point
&
point
:
textureCoordinates
)
for
(
const
Point
&
point
:
textureCoordinates
)
skTextureCoordinates
.
append
(
point
.
sk_point
);
skTextureCoordinates
.
push_back
(
point
.
sk_point
);
V
ector
<
SkColor
>
skColors
;
std
::
v
ector
<
SkColor
>
skColors
;
skColors
.
reserve
InitialCapacity
(
colors
.
size
());
skColors
.
reserve
(
colors
.
size
());
for
(
const
CanvasColor
&
color
:
colors
)
for
(
const
CanvasColor
&
color
:
colors
)
skColors
.
append
(
color
);
skColors
.
push_back
(
color
);
V
ector
<
uint16_t
>
skIndices
;
std
::
v
ector
<
uint16_t
>
skIndices
;
skIndices
.
reserve
InitialCapacity
(
indices
.
size
());
skIndices
.
reserve
(
indices
.
size
());
for
(
uint16_t
i
:
indices
)
for
(
uint16_t
i
:
indices
)
skIndices
.
append
(
i
);
skIndices
.
push_back
(
i
);
RefPtr
<
SkXfermode
>
transferModePtr
=
adoptRef
(
SkXfermode
::
Create
(
transferMode
));
RefPtr
<
SkXfermode
>
transferModePtr
=
adoptRef
(
SkXfermode
::
Create
(
transferMode
));
...
@@ -315,18 +315,18 @@ void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
...
@@ -315,18 +315,18 @@ void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
vertexMode
,
vertexMode
,
skVertices
.
size
(),
skVertices
.
size
(),
skVertices
.
data
(),
skVertices
.
data
(),
skTextureCoordinates
.
isE
mpty
()
?
nullptr
:
skTextureCoordinates
.
data
(),
skTextureCoordinates
.
e
mpty
()
?
nullptr
:
skTextureCoordinates
.
data
(),
skColors
.
isE
mpty
()
?
nullptr
:
skColors
.
data
(),
skColors
.
e
mpty
()
?
nullptr
:
skColors
.
data
(),
transferModePtr
.
get
(),
transferModePtr
.
get
(),
skIndices
.
isE
mpty
()
?
nullptr
:
skIndices
.
data
(),
skIndices
.
e
mpty
()
?
nullptr
:
skIndices
.
data
(),
skIndices
.
size
(),
skIndices
.
size
(),
*
paint
.
paint
()
*
paint
.
paint
()
);
);
}
}
void
Canvas
::
drawAtlas
(
CanvasImage
*
atlas
,
void
Canvas
::
drawAtlas
(
CanvasImage
*
atlas
,
const
Vector
<
RSTransform
>&
transforms
,
const
V
ector
<
Rect
>&
rects
,
const
std
::
vector
<
RSTransform
>&
transforms
,
const
std
::
v
ector
<
Rect
>&
rects
,
const
V
ector
<
CanvasColor
>&
colors
,
TransferMode
mode
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
TransferMode
mode
,
const
Rect
&
cullRect
,
const
Paint
&
paint
)
const
Rect
&
cullRect
,
const
Paint
&
paint
)
{
{
if
(
!
m_canvas
)
if
(
!
m_canvas
)
...
@@ -334,26 +334,26 @@ void Canvas::drawAtlas(CanvasImage* atlas,
...
@@ -334,26 +334,26 @@ void Canvas::drawAtlas(CanvasImage* atlas,
RefPtr
<
SkImage
>
skImage
=
atlas
->
image
();
RefPtr
<
SkImage
>
skImage
=
atlas
->
image
();
V
ector
<
SkRSXform
>
skXForms
;
std
::
v
ector
<
SkRSXform
>
skXForms
;
skXForms
.
reserve
InitialCapacity
(
transforms
.
size
());
skXForms
.
reserve
(
transforms
.
size
());
for
(
const
RSTransform
&
transform
:
transforms
)
for
(
const
RSTransform
&
transform
:
transforms
)
skXForms
.
append
(
transform
.
sk_xform
);
skXForms
.
push_back
(
transform
.
sk_xform
);
V
ector
<
SkRect
>
skRects
;
std
::
v
ector
<
SkRect
>
skRects
;
skRects
.
reserve
InitialCapacity
(
rects
.
size
());
skRects
.
reserve
(
rects
.
size
());
for
(
const
Rect
&
rect
:
rects
)
for
(
const
Rect
&
rect
:
rects
)
skRects
.
append
(
rect
.
sk_rect
);
skRects
.
push_back
(
rect
.
sk_rect
);
V
ector
<
SkColor
>
skColors
;
std
::
v
ector
<
SkColor
>
skColors
;
skColors
.
reserve
InitialCapacity
(
colors
.
size
());
skColors
.
reserve
(
colors
.
size
());
for
(
const
CanvasColor
&
color
:
colors
)
for
(
const
CanvasColor
&
color
:
colors
)
skColors
.
append
(
color
);
skColors
.
push_back
(
color
);
m_canvas
->
drawAtlas
(
m_canvas
->
drawAtlas
(
skImage
.
get
(),
skImage
.
get
(),
skXForms
.
data
(),
skXForms
.
data
(),
skRects
.
data
(),
skRects
.
data
(),
skColors
.
isE
mpty
()
?
nullptr
:
skColors
.
data
(),
skColors
.
e
mpty
()
?
nullptr
:
skColors
.
data
(),
skXForms
.
size
(),
skXForms
.
size
(),
mode
,
mode
,
cullRect
.
is_null
?
nullptr
:
&
cullRect
.
sk_rect
,
cullRect
.
is_null
?
nullptr
:
&
cullRect
.
sk_rect
,
...
...
sky/engine/core/painting/Canvas.h
浏览文件 @
c9cf1f3b
...
@@ -69,16 +69,18 @@ public:
...
@@ -69,16 +69,18 @@ public:
void
drawPicture
(
Picture
*
picture
);
void
drawPicture
(
Picture
*
picture
);
void
drawVertices
(
SkCanvas
::
VertexMode
vertexMode
,
void
drawVertices
(
SkCanvas
::
VertexMode
vertexMode
,
const
V
ector
<
Point
>&
vertices
,
const
std
::
v
ector
<
Point
>&
vertices
,
const
V
ector
<
Point
>&
textureCoordinates
,
const
std
::
v
ector
<
Point
>&
textureCoordinates
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
TransferMode
transferMode
,
TransferMode
transferMode
,
const
V
ector
<
int
>&
indices
,
const
std
::
v
ector
<
int
>&
indices
,
const
Paint
&
paint
);
const
Paint
&
paint
);
void
drawAtlas
(
CanvasImage
*
atlas
,
void
drawAtlas
(
CanvasImage
*
atlas
,
const
Vector
<
RSTransform
>&
transforms
,
const
Vector
<
Rect
>&
rects
,
const
std
::
vector
<
RSTransform
>&
transforms
,
const
Vector
<
CanvasColor
>&
colors
,
TransferMode
mode
,
const
std
::
vector
<
Rect
>&
rects
,
const
std
::
vector
<
CanvasColor
>&
colors
,
TransferMode
mode
,
const
Rect
&
cullRect
,
const
Paint
&
paint
);
const
Rect
&
cullRect
,
const
Paint
&
paint
);
SkCanvas
*
skCanvas
()
{
return
m_canvas
;
}
SkCanvas
*
skCanvas
()
{
return
m_canvas
;
}
...
...
sky/engine/core/painting/CanvasGradient.cpp
浏览文件 @
c9cf1f3b
...
@@ -36,9 +36,9 @@ PassRefPtr<CanvasGradient> CanvasGradient::create() {
...
@@ -36,9 +36,9 @@ PassRefPtr<CanvasGradient> CanvasGradient::create() {
return
adoptRef
(
new
CanvasGradient
());
return
adoptRef
(
new
CanvasGradient
());
}
}
void
CanvasGradient
::
initLinear
(
const
V
ector
<
Point
>&
end_points
,
void
CanvasGradient
::
initLinear
(
const
std
::
v
ector
<
Point
>&
end_points
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
const
V
ector
<
float
>&
color_stops
,
const
std
::
v
ector
<
float
>&
color_stops
,
SkShader
::
TileMode
tile_mode
)
{
SkShader
::
TileMode
tile_mode
)
{
ASSERT
(
end_points
.
size
()
==
2
);
ASSERT
(
end_points
.
size
()
==
2
);
ASSERT
(
colors
.
size
()
==
color_stops
.
size
()
||
color_stops
.
data
()
==
nullptr
);
ASSERT
(
colors
.
size
()
==
color_stops
.
size
()
||
color_stops
.
data
()
==
nullptr
);
...
@@ -46,10 +46,10 @@ void CanvasGradient::initLinear(const Vector<Point>& end_points,
...
@@ -46,10 +46,10 @@ void CanvasGradient::initLinear(const Vector<Point>& end_points,
for
(
int
i
=
0
;
i
<
2
;
++
i
)
for
(
int
i
=
0
;
i
<
2
;
++
i
)
sk_end_points
[
i
]
=
end_points
[
i
].
sk_point
;
sk_end_points
[
i
]
=
end_points
[
i
].
sk_point
;
V
ector
<
SkColor
>
sk_colors
;
std
::
v
ector
<
SkColor
>
sk_colors
;
sk_colors
.
reserve
InitialCapacity
(
colors
.
size
());
sk_colors
.
reserve
(
colors
.
size
());
for
(
const
CanvasColor
&
color
:
colors
)
for
(
const
CanvasColor
&
color
:
colors
)
sk_colors
.
append
(
color
);
sk_colors
.
push_back
(
color
);
SkShader
*
shader
=
SkGradientShader
::
CreateLinear
(
SkShader
*
shader
=
SkGradientShader
::
CreateLinear
(
sk_end_points
,
sk_colors
.
data
(),
color_stops
.
data
(),
sk_colors
.
size
(),
sk_end_points
,
sk_colors
.
data
(),
color_stops
.
data
(),
sk_colors
.
size
(),
...
@@ -59,15 +59,15 @@ void CanvasGradient::initLinear(const Vector<Point>& end_points,
...
@@ -59,15 +59,15 @@ void CanvasGradient::initLinear(const Vector<Point>& end_points,
void
CanvasGradient
::
initRadial
(
const
Point
&
center
,
void
CanvasGradient
::
initRadial
(
const
Point
&
center
,
double
radius
,
double
radius
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
const
V
ector
<
float
>&
color_stops
,
const
std
::
v
ector
<
float
>&
color_stops
,
SkShader
::
TileMode
tile_mode
)
{
SkShader
::
TileMode
tile_mode
)
{
ASSERT
(
colors
.
size
()
==
color_stops
.
size
()
||
color_stops
.
data
()
==
nullptr
);
ASSERT
(
colors
.
size
()
==
color_stops
.
size
()
||
color_stops
.
data
()
==
nullptr
);
V
ector
<
SkColor
>
sk_colors
;
std
::
v
ector
<
SkColor
>
sk_colors
;
sk_colors
.
reserve
InitialCapacity
(
colors
.
size
());
sk_colors
.
reserve
(
colors
.
size
());
for
(
const
CanvasColor
&
color
:
colors
)
for
(
const
CanvasColor
&
color
:
colors
)
sk_colors
.
append
(
color
);
sk_colors
.
push_back
(
color
);
SkShader
*
shader
=
SkGradientShader
::
CreateRadial
(
SkShader
*
shader
=
SkGradientShader
::
CreateRadial
(
center
.
sk_point
,
radius
,
sk_colors
.
data
(),
color_stops
.
data
(),
center
.
sk_point
,
radius
,
sk_colors
.
data
(),
color_stops
.
data
(),
...
...
sky/engine/core/painting/CanvasGradient.h
浏览文件 @
c9cf1f3b
...
@@ -25,15 +25,15 @@ class CanvasGradient : public Shader {
...
@@ -25,15 +25,15 @@ class CanvasGradient : public Shader {
~
CanvasGradient
()
override
;
~
CanvasGradient
()
override
;
static
PassRefPtr
<
CanvasGradient
>
create
();
static
PassRefPtr
<
CanvasGradient
>
create
();
void
initLinear
(
const
V
ector
<
Point
>&
end_points
,
void
initLinear
(
const
std
::
v
ector
<
Point
>&
end_points
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
const
V
ector
<
float
>&
color_stops
,
const
std
::
v
ector
<
float
>&
color_stops
,
SkShader
::
TileMode
tile_mode
);
SkShader
::
TileMode
tile_mode
);
void
initRadial
(
const
Point
&
center
,
void
initRadial
(
const
Point
&
center
,
double
radius
,
double
radius
,
const
V
ector
<
CanvasColor
>&
colors
,
const
std
::
v
ector
<
CanvasColor
>&
colors
,
const
V
ector
<
float
>&
color_stops
,
const
std
::
v
ector
<
float
>&
color_stops
,
SkShader
::
TileMode
tile_mode
);
SkShader
::
TileMode
tile_mode
);
static
void
RegisterNatives
(
DartLibraryNatives
*
natives
);
static
void
RegisterNatives
(
DartLibraryNatives
*
natives
);
...
...
sky/engine/tonic/dart_converter.h
浏览文件 @
c9cf1f3b
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
#define SKY_ENGINE_TONIC_DART_CONVERTER_H_
#define SKY_ENGINE_TONIC_DART_CONVERTER_H_
#include <string>
#include <string>
#include <vector>
#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/wtf/Vector.h"
namespace
blink
{
namespace
blink
{
...
@@ -239,11 +239,11 @@ struct DartConverter<const char*> {
...
@@ -239,11 +239,11 @@ struct DartConverter<const char*> {
// Collections
// Collections
template
<
typename
T
>
template
<
typename
T
>
struct
DartConverter
<
V
ector
<
T
>>
{
struct
DartConverter
<
std
::
v
ector
<
T
>>
{
using
ValueType
=
typename
DartConverterTypes
<
T
>::
ValueType
;
using
ValueType
=
typename
DartConverterTypes
<
T
>::
ValueType
;
using
ConverterType
=
typename
DartConverterTypes
<
T
>::
ConverterType
;
using
ConverterType
=
typename
DartConverterTypes
<
T
>::
ConverterType
;
static
Dart_Handle
ToDart
(
const
V
ector
<
ValueType
>&
val
)
{
static
Dart_Handle
ToDart
(
const
std
::
v
ector
<
ValueType
>&
val
)
{
Dart_Handle
list
=
Dart_NewList
(
val
.
size
());
Dart_Handle
list
=
Dart_NewList
(
val
.
size
());
if
(
Dart_IsError
(
list
))
if
(
Dart_IsError
(
list
))
return
list
;
return
list
;
...
@@ -257,35 +257,35 @@ struct DartConverter<Vector<T>> {
...
@@ -257,35 +257,35 @@ struct DartConverter<Vector<T>> {
return
list
;
return
list
;
}
}
static
Vector
<
ValueType
>
FromDart
(
Dart_Handle
handle
)
{
static
std
::
vector
<
ValueType
>
FromDart
(
Dart_Handle
handle
)
{
Vector
<
ValueType
>
result
;
std
::
vector
<
ValueType
>
result
;
if
(
!
Dart_IsList
(
handle
))
if
(
!
Dart_IsList
(
handle
))
return
result
;
return
result
;
intptr_t
length
=
0
;
intptr_t
length
=
0
;
Dart_ListLength
(
handle
,
&
length
);
Dart_ListLength
(
handle
,
&
length
);
if
(
length
==
0
)
{
if
(
length
==
0
)
return
result
;
return
result
;
}
result
.
reserve
Capacity
(
length
);
result
.
reserve
(
length
);
V
ector
<
Dart_Handle
>
items
(
length
);
std
::
v
ector
<
Dart_Handle
>
items
(
length
);
Dart_Handle
items_result
=
Dart_ListGetRange
(
handle
,
0
,
length
,
Dart_Handle
items_result
=
Dart_ListGetRange
(
handle
,
0
,
length
,
items
.
data
());
items
.
data
());
DCHECK
(
!
Dart_IsError
(
items_result
));
DCHECK
(
!
Dart_IsError
(
items_result
));
for
(
intptr_t
i
=
0
;
i
<
length
;
++
i
)
{
for
(
intptr_t
i
=
0
;
i
<
length
;
++
i
)
{
DCHECK
(
items
[
i
]);
DCHECK
(
items
[
i
]);
result
.
append
(
DartConverter
<
ConverterType
>::
FromDart
(
items
[
i
]));
result
.
push_back
(
DartConverter
<
ConverterType
>::
FromDart
(
items
[
i
]));
}
}
return
result
;
return
result
;
}
}
static
V
ector
<
ValueType
>
FromArguments
(
Dart_NativeArguments
args
,
static
std
::
v
ector
<
ValueType
>
FromArguments
(
Dart_NativeArguments
args
,
int
index
,
int
index
,
Dart_Handle
&
exception
)
{
Dart_Handle
&
exception
)
{
// TODO(abarth): What should we do with auto_scope?
return
FromDart
(
Dart_GetNativeArgument
(
args
,
index
));
return
FromDart
(
Dart_GetNativeArgument
(
args
,
index
));
}
}
};
};
...
@@ -316,12 +316,7 @@ struct DartConverter<Dart_Handle> {
...
@@ -316,12 +316,7 @@ struct DartConverter<Dart_Handle> {
};
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Convience wrappers using type inference for ease of code generation
// Convience wrappers using type inference
template
<
typename
T
>
inline
Dart_Handle
VectorToDart
(
const
Vector
<
T
>&
val
)
{
return
DartConverter
<
Vector
<
T
>>::
ToDart
(
val
);
}
template
<
typename
T
>
template
<
typename
T
>
Dart_Handle
ToDart
(
const
T
&
object
)
{
Dart_Handle
ToDart
(
const
T
&
object
)
{
...
...
sky/engine/tonic/dart_wrappable.h
浏览文件 @
c9cf1f3b
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
#include "sky/engine/tonic/dart_error.h"
#include "sky/engine/tonic/dart_error.h"
#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/tonic/dart_wrapper_info.h"
#include "sky/engine/tonic/dart_wrapper_info.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefPtr.h"
namespace
blink
{
namespace
blink
{
class
DartGCVisitor
;
class
DartGCVisitor
;
...
...
sky/engine/tonic/float32_list.cc
浏览文件 @
c9cf1f3b
...
@@ -19,7 +19,7 @@ Float32List::Float32List(Dart_Handle list)
...
@@ -19,7 +19,7 @@ Float32List::Float32List(Dart_Handle list)
Dart_TypedDataAcquireData
(
Dart_TypedDataAcquireData
(
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
DCHECK
(
!
LogIfError
(
list
));
DCHECK
(
!
LogIfError
(
list
));
ASSERT
(
type
==
Dart_TypedData_kFloat32
);
DCHECK
(
type
==
Dart_TypedData_kFloat32
);
}
}
Float32List
::
Float32List
(
Float32List
&&
other
)
Float32List
::
Float32List
(
Float32List
&&
other
)
...
...
sky/engine/tonic/float64_list.cc
浏览文件 @
c9cf1f3b
...
@@ -19,7 +19,7 @@ Float64List::Float64List(Dart_Handle list)
...
@@ -19,7 +19,7 @@ Float64List::Float64List(Dart_Handle list)
Dart_TypedDataAcquireData
(
Dart_TypedDataAcquireData
(
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
DCHECK
(
!
LogIfError
(
list
));
DCHECK
(
!
LogIfError
(
list
));
ASSERT
(
type
==
Dart_TypedData_kFloat64
);
DCHECK
(
type
==
Dart_TypedData_kFloat64
);
}
}
Float64List
::
Float64List
(
Float64List
&&
other
)
Float64List
::
Float64List
(
Float64List
&&
other
)
...
...
sky/engine/tonic/int32_list.cc
浏览文件 @
c9cf1f3b
...
@@ -19,7 +19,7 @@ Int32List::Int32List(Dart_Handle list)
...
@@ -19,7 +19,7 @@ Int32List::Int32List(Dart_Handle list)
Dart_TypedDataAcquireData
(
Dart_TypedDataAcquireData
(
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
DCHECK
(
!
LogIfError
(
list
));
DCHECK
(
!
LogIfError
(
list
));
ASSERT
(
type
==
Dart_TypedData_kInt32
);
DCHECK
(
type
==
Dart_TypedData_kInt32
);
}
}
Int32List
::
Int32List
(
Int32List
&&
other
)
Int32List
::
Int32List
(
Int32List
&&
other
)
...
...
sky/engine/tonic/uint8_list.cc
浏览文件 @
c9cf1f3b
...
@@ -19,7 +19,7 @@ Uint8List::Uint8List(Dart_Handle list)
...
@@ -19,7 +19,7 @@ Uint8List::Uint8List(Dart_Handle list)
Dart_TypedDataAcquireData
(
Dart_TypedDataAcquireData
(
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
list
,
&
type
,
reinterpret_cast
<
void
**>
(
&
data_
),
&
num_elements_
);
DCHECK
(
!
LogIfError
(
list
));
DCHECK
(
!
LogIfError
(
list
));
ASSERT
(
type
==
Dart_TypedData_kUint8
);
DCHECK
(
type
==
Dart_TypedData_kUint8
);
}
}
Uint8List
::
Uint8List
(
Uint8List
&&
other
)
Uint8List
::
Uint8List
(
Uint8List
&&
other
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录