Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 3462d5c

Browse files
author
Raphael Kubo da Costa
committed
Merge pull request #331 from axinging/xwalk_transparenttexture_6519
[Android] Enable transparent TextureView
2 parents bde07cf + e7d4a95 commit 3462d5c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,22 @@ public ContentReadbackHandler getContentReadbackHandler() {
227227
return mContentReadbackHandler;
228228
}
229229

230+
private static boolean isOpaque(int color) {
231+
return ((color >> 24) & 0xFF) == 0xFF;
232+
}
233+
230234
/**
231-
* Sets the background color of the surface view. This method is necessary because the
235+
* Set the background color of SurfaceView or TextureView. This method is necessary because the
232236
* background color of ContentViewRenderView itself is covered by the background of
233-
* SurfaceView.
237+
* SurfaceView or TextureView.
234238
* @param color The color of the background.
235239
*/
236240
public void setSurfaceViewBackgroundColor(int color) {
237241
if (mSurfaceView != null) {
238242
mSurfaceView.setBackgroundColor(color);
243+
} else if (mTextureView != null) {
244+
mTextureView.setOpaque(isOpaque(color));
245+
mTextureView.setBackgroundColor(color);
239246
}
240247
}
241248

0 commit comments

Comments
 (0)