Skip to content

Commit a10c97f

Browse files
committed
Merge branch 'master' into dev
2 parents e4c33c2 + fad4d01 commit a10c97f

File tree

8 files changed

+30
-3
lines changed

8 files changed

+30
-3
lines changed

cgeDemo/src/main/res/layout/activity_basic_filter_demo.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<org.wysaid.view.ImageGLSurfaceView
1212
android:id="@+id/mainImageView"
1313
android:layout_width="match_parent"
14-
android:layout_height="match_parent"/>
14+
android:layout_height="match_parent"
15+
android:layout_below="@+id/seekBar"
16+
android:layout_above="@+id/horizontalScroll"/>
1517

1618
<SeekBar
1719
android:id="@+id/seekBar"
@@ -22,6 +24,7 @@
2224
/>
2325

2426
<HorizontalScrollView
27+
android:id="@+id/horizontalScroll"
2528
android:layout_width="match_parent"
2629
android:layout_height="wrap_content"
2730
android:layout_alignParentBottom="true">

cgeDemo/src/main/res/layout/activity_filter_demo.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<org.wysaid.view.ImageGLSurfaceView
1212
android:id="@+id/mainImageView"
1313
android:layout_width="match_parent"
14-
android:layout_height="match_parent"/>
14+
android:layout_height="match_parent"
15+
android:layout_below="@+id/seekBar"
16+
android:layout_above="@+id/horizontalScroll"/>
1517

1618
<SeekBar
1719
android:id="@+id/seekBar"
@@ -22,6 +24,7 @@
2224
/>
2325

2426
<HorizontalScrollView
27+
android:id="@+id/horizontalScroll"
2528
android:layout_width="match_parent"
2629
android:layout_height="wrap_content"
2730
android:layout_alignParentBottom="true">

library/src/main/java/org/wysaid/myUtils/FileUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static String getPathInPackage(Context context, boolean grantPermissions)
5555

5656
if(!file.exists()) {
5757
if(!file.mkdirs()) {
58-
Log.e(LOG_TAG, "在pakage目录创建CGE临时目录失败!");
58+
Log.e(LOG_TAG, "Create package dir of CGE failed!");
5959
return null;
6060
}
6161

library/src/main/java/org/wysaid/nativePort/CGEFrameRenderer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ public void bindImageFBO() {
142142
nativeBindImageFBO(mNativeAddress);
143143
}
144144

145+
public void swapImageFBO() {
146+
nativeSwapBufferFBO(mNativeAddress);
147+
}
148+
145149
//nativeFilter 为 JNI 下的 CGEImageFilterInterfaceAbstract 或者其子类.
146150
public void processWithFilter(long nativeFilter) {
147151
nativeProcessWithFilter(mNativeAddress, nativeFilter);
@@ -182,6 +186,7 @@ public void setNativeFilter(long nativeFilter) {
182186

183187
protected native long nativeGetImageHandler(long holder);
184188
protected native void nativeBindImageFBO(long holder);
189+
protected native void nativeSwapBufferFBO(long holder);
185190

186191
//辅助方法
187192
protected native void nativeProcessWithFilter(long holder, long nativeFilter);

library/src/main/java/org/wysaid/nativePort/CGEImageHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ public void release() {
125125
}
126126
}
127127

128+
public void setFilterWithAddres(long filter) {
129+
nativeSetFilterWithAddress(mNativeAddress, filter);
130+
}
128131

129132
///////////////// protected ///////////////////////
130133

@@ -136,6 +139,7 @@ public void release() {
136139
protected native void nativeSetDrawerRotation(long holder, float rad);
137140
protected native void nativeSetDrawerFlipScale(long holder, float x, float y);
138141
protected native boolean nativeSetFilterWithConfig(long holder, String config, boolean shouldCleanOlder, boolean shouldProcess);
142+
protected native void nativeSetFilterWithAddress(long holder, long filter);
139143
protected native void nativeSetFilterIntensity(long holder, float value, boolean shouldProcess);
140144
protected native boolean nativeSetFilterIntensityAtIndex(long holder, float value, int index, boolean shouldProcess);
141145

library/src/main/jni/interface/cgeImageHandlerWrapper.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetDrawe
6262
drawer->setFlipScale(x, y);
6363
}
6464

65+
JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetFilterWithAddress
66+
(JNIEnv *, jobject, jlong addr, jlong filter)
67+
{
68+
CGEImageHandlerAndroid* handler = (CGEImageHandlerAndroid*)addr;
69+
handler->clearImageFilters(true);
70+
handler->revertToKeptResult();
71+
handler->addImageFilter((CGEImageFilterInterfaceAbstract *)filter);
72+
}
73+
6574
JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetFilterWithConfig
6675
(JNIEnv *env, jobject, jlong addr, jstring config, jboolean shouldCleanOlder, jboolean shouldProcess)
6776
{

library/src/main/jni/interface/cgeImageHandlerWrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetDrawe
3737
JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetFilterWithConfig
3838
(JNIEnv *, jobject, jlong, jstring, jboolean, jboolean);
3939

40+
JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetFilterWithAddress
41+
(JNIEnv *, jobject, jlong, jlong);
42+
4043
JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEImageHandler_nativeSetFilterIntensity
4144
(JNIEnv *, jobject, jlong, jfloat, jboolean);
4245

-3.98 KB
Binary file not shown.

0 commit comments

Comments
 (0)