From aa6c24c21c727a196451332448d4e3b11a80be69 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 28 Apr 2011 18:40:04 -0700 Subject: New widget: TextureView Bug #4343984 TextureView can be used to render media content (video, OpenGL, RenderScript) inside a View. The key difference with SurfaceView is that TextureView does not create a new Surface. This gives the ability to seamlessly transform, animate, fade, etc. a TextureView, which was hard if not impossible to do with a SurfaceView. A TextureView also interacts perfectly with ScrollView, ListView, etc. It allows application to embed media content in a much more flexible way than before. For instance, to render the camera preview at 50% opacity, all you need to do is the following: mTextureView.setAlpha(0.5f); Camera c = Camera.open(); c.setPreviewTexture(mTextureView.getSurfaceTexture()); c.startPreview(); TextureView uses a SurfaceTexture to get the job done. More APIs are required to make it easy to create OpenGL contexts for a TextureView. It can currently be done with a bit of JNI code. Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7 --- libs/hwui/ProgramCache.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/hwui/ProgramCache.h') diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h index 18d98cb05e10..70909fd622bf 100644 --- a/libs/hwui/ProgramCache.h +++ b/libs/hwui/ProgramCache.h @@ -77,6 +77,8 @@ namespace uirenderer { #define PROGRAM_HAS_WIDTH_SHIFT 37 +#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 38 + /////////////////////////////////////////////////////////////////////////////// // Types /////////////////////////////////////////////////////////////////////////////// @@ -113,6 +115,7 @@ struct ProgramDescription { // Texturing bool hasTexture; bool hasAlpha8Texture; + bool hasExternalTexture; // Modulate, this should only be set when setColor() return true bool modulate; @@ -151,6 +154,7 @@ struct ProgramDescription { void reset() { hasTexture = false; hasAlpha8Texture = false; + hasExternalTexture = false; hasWidth = false; @@ -240,6 +244,7 @@ struct ProgramDescription { if (modulate) key |= programid(0x1) << PROGRAM_MODULATE_SHIFT; if (isPoint) key |= programid(0x1) << PROGRAM_IS_POINT_SHIFT; if (hasWidth) key |= programid(0x1) << PROGRAM_HAS_WIDTH_SHIFT; + if (hasExternalTexture) key |= programid(0x1) << PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT; return key; } -- cgit v1.2.3-59-g8ed1b