Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
98002dfb
Commit
98002dfb
authored
11 years ago
by
Narayan Kamath
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "AArch64: Use long for pointers in graphics/PathMeasure"
parents
1b0f0be0
0c10cc60
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/jni/android/graphics/PathMeasure.cpp
+62
-36
62 additions, 36 deletions
core/jni/android/graphics/PathMeasure.cpp
graphics/java/android/graphics/PathMeasure.java
+10
-10
10 additions, 10 deletions
graphics/java/android/graphics/PathMeasure.java
with
72 additions
and
46 deletions
core/jni/android/graphics/PathMeasure.cpp
+
62
−
36
View file @
98002dfb
...
...
@@ -52,11 +52,24 @@ namespace android {
class
SkPathMeasureGlue
{
public:
static
PathMeasurePair
*
create
(
JNIEnv
*
env
,
jobject
clazz
,
const
SkPath
*
path
,
jboolean
forceClosed
)
{
return
path
?
new
PathMeasurePair
(
*
path
,
forceClosed
)
:
new
PathMeasurePair
;
static
jlong
create
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pathHandle
,
jboolean
forceClosedHandle
)
{
const
SkPath
*
path
=
reinterpret_cast
<
SkPath
*>
(
pathHandle
);
bool
forceClosed
=
(
forceClosedHandle
==
JNI_TRUE
);
PathMeasurePair
*
pair
;
if
(
path
)
pair
=
new
PathMeasurePair
(
*
path
,
forceClosed
);
else
pair
=
new
PathMeasurePair
;
return
reinterpret_cast
<
jlong
>
(
pair
);
}
static
void
setPath
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
,
const
SkPath
*
path
,
jboolean
forceClosed
)
{
static
void
setPath
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
,
jlong
pathHandle
,
jboolean
forceClosedHandle
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
const
SkPath
*
path
=
reinterpret_cast
<
SkPath
*>
(
pathHandle
);
bool
forceClosed
=
(
forceClosedHandle
==
JNI_TRUE
);
if
(
NULL
==
path
)
{
pair
->
fPath
.
reset
();
}
else
{
...
...
@@ -64,11 +77,12 @@ public:
}
pair
->
fMeasure
.
setPath
(
&
pair
->
fPath
,
forceClosed
);
}
static
jfloat
getLength
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
)
{
return
SkScalarToFloat
(
pair
->
fMeasure
.
getLength
());
static
jfloat
getLength
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
return
static_cast
<
jfloat
>
(
SkScalarToFloat
(
pair
->
fMeasure
.
getLength
()));
}
static
void
convertTwoElemFloatArray
(
JNIEnv
*
env
,
jfloatArray
array
,
const
SkScalar
src
[
2
])
{
AutoJavaFloatArray
autoArray
(
env
,
array
,
2
);
jfloat
*
ptr
=
autoArray
.
ptr
();
...
...
@@ -76,13 +90,14 @@ public:
ptr
[
1
]
=
SkScalarToFloat
(
src
[
1
]);
}
static
jboolean
getPosTan
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
,
jfloat
dist
,
jfloatArray
pos
,
jfloatArray
tan
)
{
static
jboolean
getPosTan
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
,
jfloat
dist
,
jfloatArray
pos
,
jfloatArray
tan
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
SkScalar
tmpPos
[
2
],
tmpTan
[
2
];
SkScalar
*
posPtr
=
pos
?
tmpPos
:
NULL
;
SkScalar
*
tanPtr
=
tan
?
tmpTan
:
NULL
;
if
(
!
pair
->
fMeasure
.
getPosTan
(
SkFloatToScalar
(
dist
),
(
SkPoint
*
)
posPtr
,
(
SkVector
*
)
tanPtr
))
{
return
false
;
return
JNI_FALSE
;
}
if
(
pos
)
{
...
...
@@ -91,42 +106,53 @@ public:
if
(
tan
)
{
convertTwoElemFloatArray
(
env
,
tan
,
tmpTan
);
}
return
true
;
return
JNI_TRUE
;
}
static
jboolean
getMatrix
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
,
jfloat
dist
,
SkMatrix
*
matrix
,
int
flags
)
{
return
pair
->
fMeasure
.
getMatrix
(
SkFloatToScalar
(
dist
),
matrix
,
(
SkPathMeasure
::
MatrixFlags
)
flags
);
static
jboolean
getMatrix
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
,
jfloat
dist
,
jlong
matrixHandle
,
jint
flags
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
SkMatrix
*
matrix
=
reinterpret_cast
<
SkMatrix
*>
(
matrixHandle
);
bool
result
=
pair
->
fMeasure
.
getMatrix
(
SkFloatToScalar
(
dist
),
matrix
,
(
SkPathMeasure
::
MatrixFlags
)
flags
);
return
result
?
JNI_TRUE
:
JNI_FALSE
;
}
static
jboolean
getSegment
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
,
jfloat
startF
,
jfloat
stopF
,
SkPath
*
dst
,
jboolean
startWithMoveTo
)
{
return
pair
->
fMeasure
.
getSegment
(
SkFloatToScalar
(
startF
),
SkFloatToScalar
(
stopF
),
dst
,
startWithMoveTo
);
static
jboolean
getSegment
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
,
jfloat
startF
,
jfloat
stopF
,
jlong
dstHandle
,
jboolean
startWithMoveTo
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
SkPath
*
dst
=
reinterpret_cast
<
SkPath
*>
(
dstHandle
);
bool
result
=
pair
->
fMeasure
.
getSegment
(
SkFloatToScalar
(
startF
),
SkFloatToScalar
(
stopF
),
dst
,
startWithMoveTo
);
return
result
?
JNI_TRUE
:
JNI_FALSE
;
}
static
jboolean
isClosed
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
)
{
return
pair
->
fMeasure
.
isClosed
();
static
jboolean
isClosed
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
bool
result
=
pair
->
fMeasure
.
isClosed
();
return
result
?
JNI_TRUE
:
JNI_FALSE
;
}
static
jboolean
nextContour
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
)
{
return
pair
->
fMeasure
.
nextContour
();
static
jboolean
nextContour
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
bool
result
=
pair
->
fMeasure
.
nextContour
();
return
result
?
JNI_TRUE
:
JNI_FALSE
;
}
static
void
destroy
(
JNIEnv
*
env
,
jobject
clazz
,
PathMeasurePair
*
pair
)
{
static
void
destroy
(
JNIEnv
*
env
,
jobject
clazz
,
jlong
pairHandle
)
{
PathMeasurePair
*
pair
=
reinterpret_cast
<
PathMeasurePair
*>
(
pairHandle
);
delete
pair
;
}
};
static
JNINativeMethod
methods
[]
=
{
{
"native_create"
,
"(
I
Z)
I
"
,
(
void
*
)
SkPathMeasureGlue
::
create
},
{
"native_setPath"
,
"(
II
Z)V"
,
(
void
*
)
SkPathMeasureGlue
::
setPath
},
{
"native_getLength"
,
"(
I
)F"
,
(
void
*
)
SkPathMeasureGlue
::
getLength
},
{
"native_getPosTan"
,
"(
I
F[F[F)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getPosTan
},
{
"native_getMatrix"
,
"(
IFI
I)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getMatrix
},
{
"native_getSegment"
,
"(
I
FF
I
Z)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getSegment
},
{
"native_isClosed"
,
"(
I
)Z"
,
(
void
*
)
SkPathMeasureGlue
::
isClosed
},
{
"native_nextContour"
,
"(
I
)Z"
,
(
void
*
)
SkPathMeasureGlue
::
nextContour
},
{
"native_destroy"
,
"(
I
)V"
,
(
void
*
)
SkPathMeasureGlue
::
destroy
}
{
"native_create"
,
"(
J
Z)
J
"
,
(
void
*
)
SkPathMeasureGlue
::
create
},
{
"native_setPath"
,
"(
JJ
Z)V"
,
(
void
*
)
SkPathMeasureGlue
::
setPath
},
{
"native_getLength"
,
"(
J
)F"
,
(
void
*
)
SkPathMeasureGlue
::
getLength
},
{
"native_getPosTan"
,
"(
J
F[F[F)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getPosTan
},
{
"native_getMatrix"
,
"(
JFJ
I)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getMatrix
},
{
"native_getSegment"
,
"(
J
FF
J
Z)Z"
,
(
void
*
)
SkPathMeasureGlue
::
getSegment
},
{
"native_isClosed"
,
"(
J
)Z"
,
(
void
*
)
SkPathMeasureGlue
::
isClosed
},
{
"native_nextContour"
,
"(
J
)Z"
,
(
void
*
)
SkPathMeasureGlue
::
nextContour
},
{
"native_destroy"
,
"(
J
)V"
,
(
void
*
)
SkPathMeasureGlue
::
destroy
}
};
int
register_android_graphics_PathMeasure
(
JNIEnv
*
env
)
{
...
...
This diff is collapsed.
Click to expand it.
graphics/java/android/graphics/PathMeasure.java
+
10
−
10
View file @
98002dfb
...
...
@@ -138,16 +138,16 @@ public class PathMeasure {
native_destroy
(
native_instance
);
}
private
static
native
int
native_create
(
int
native_path
,
boolean
forceClosed
);
private
static
native
void
native_setPath
(
int
native_instance
,
int
native_path
,
boolean
forceClosed
);
private
static
native
float
native_getLength
(
int
native_instance
);
private
static
native
boolean
native_getPosTan
(
int
native_instance
,
float
distance
,
float
pos
[],
float
tan
[]);
private
static
native
boolean
native_getMatrix
(
int
native_instance
,
float
distance
,
int
native_matrix
,
int
flags
);
private
static
native
boolean
native_getSegment
(
int
native_instance
,
float
startD
,
float
stopD
,
int
native_path
,
boolean
startWithMoveTo
);
private
static
native
boolean
native_isClosed
(
int
native_instance
);
private
static
native
boolean
native_nextContour
(
int
native_instance
);
private
static
native
void
native_destroy
(
int
native_instance
);
private
static
native
long
native_create
(
long
native_path
,
boolean
forceClosed
);
private
static
native
void
native_setPath
(
long
native_instance
,
long
native_path
,
boolean
forceClosed
);
private
static
native
float
native_getLength
(
long
native_instance
);
private
static
native
boolean
native_getPosTan
(
long
native_instance
,
float
distance
,
float
pos
[],
float
tan
[]);
private
static
native
boolean
native_getMatrix
(
long
native_instance
,
float
distance
,
long
native_matrix
,
int
flags
);
private
static
native
boolean
native_getSegment
(
long
native_instance
,
float
startD
,
float
stopD
,
long
native_path
,
boolean
startWithMoveTo
);
private
static
native
boolean
native_isClosed
(
long
native_instance
);
private
static
native
boolean
native_nextContour
(
long
native_instance
);
private
static
native
void
native_destroy
(
long
native_instance
);
/* package */
private
final
int
native_instance
;
/* package */
private
final
long
native_instance
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment