Loading core/java/android/view/HardwareRenderer.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -136,6 +136,18 @@ public abstract class HardwareRenderer { */ */ public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions"; public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions"; /** * Turn on to flash hardware layers when they update. * * Possible values: * "true", to enable hardware layers updates debugging * "false", to disable hardware layers updates debugging * * @hide */ public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY = "debug.hwui.show_layers_updates"; /** /** * A process can set this flag to false to prevent the use of hardware * A process can set this flag to false to prevent the use of hardware * rendering. * rendering. Loading graphics/java/android/graphics/Bitmap.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -881,15 +881,17 @@ public final class Bitmap implements Parcelable { * <code>(128, 128, 0, 0)</code>.</p> * <code>(128, 128, 0, 0)</code>.</p> * * * <p>This method always returns false if {@link #getConfig()} is * <p>This method always returns false if {@link #getConfig()} is * {@link Bitmap.Config#ALPHA_8} or {@link Bitmap.Config#RGB_565}.</p> * {@link Bitmap.Config#RGB_565}.</p> * * <p>This method only returns true if {@link #hasAlpha()} returns true. * A bitmap with no alpha channel can be used both as a pre-multiplied and * as a non pre-multiplied bitmap.</p> * * * @return true if the underlying pixels have been pre-multiplied, false * @return true if the underlying pixels have been pre-multiplied, false * otherwise * otherwise */ */ public final boolean isPremultiplied() { public final boolean isPremultiplied() { final Config config = getConfig(); return getConfig() != Config.RGB_565 && hasAlpha(); //noinspection deprecation return config == Config.ARGB_8888 || config == Config.ARGB_4444; } } /** Returns the bitmap's width */ /** Returns the bitmap's width */ Loading libs/hwui/Caches.cpp +11 −4 Original line number Original line Diff line number Diff line Loading @@ -52,13 +52,10 @@ Caches::Caches(): Singleton<Caches>(), mInitialized(false) { initFont(); initFont(); initExtensions(); initExtensions(); initConstraints(); initConstraints(); initProperties(); mDebugLevel = readDebugLevel(); mDebugLevel = readDebugLevel(); ALOGD("Enabling debug mode %d", mDebugLevel); ALOGD("Enabling debug mode %d", mDebugLevel); #if RENDER_LAYERS_AS_REGIONS INIT_LOGD("Layers will be composited as regions"); #endif } } void Caches::init() { void Caches::init() { Loading Loading @@ -126,6 +123,16 @@ void Caches::initConstraints() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); } } void Caches::initProperties() { char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, NULL) > 0) { INIT_LOGD(" Layers updates debug enabled: %s", property); debugLayersUpdates = !strcmp(property, "true"); } else { debugLayersUpdates = false; } } void Caches::terminate() { void Caches::terminate() { if (!mInitialized) return; if (!mInitialized) return; Loading libs/hwui/Caches.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -236,6 +236,7 @@ public: // Misc // Misc GLint maxTextureSize; GLint maxTextureSize; bool debugLayersUpdates; TextureCache textureCache; TextureCache textureCache; LayerCache layerCache; LayerCache layerCache; Loading Loading @@ -267,6 +268,7 @@ private: void initFont(); void initFont(); void initExtensions(); void initExtensions(); void initConstraints(); void initConstraints(); void initProperties(); static void eventMarkNull(GLsizei length, const GLchar* marker) { } static void eventMarkNull(GLsizei length, const GLchar* marker) { } static void startMarkNull(GLsizei length, const GLchar* marker) { } static void startMarkNull(GLsizei length, const GLchar* marker) { } Loading libs/hwui/LayerRenderer.cpp +0 −10 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,6 @@ int LayerRenderer::prepareDirty(float left, float top, float right, float bottom const float width = mLayer->layer.getWidth(); const float width = mLayer->layer.getWidth(); const float height = mLayer->layer.getHeight(); const float height = mLayer->layer.getHeight(); #if RENDER_LAYERS_AS_REGIONS Rect dirty(left, top, right, bottom); Rect dirty(left, top, right, bottom); if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && dirty.right >= width && dirty.bottom >= height)) { dirty.right >= width && dirty.bottom >= height)) { Loading @@ -58,9 +57,6 @@ int LayerRenderer::prepareDirty(float left, float top, float right, float bottom } } return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); #else return OpenGLRenderer::prepareDirty(0.0f, 0.0f, width, height, opaque); #endif } } void LayerRenderer::finish() { void LayerRenderer::finish() { Loading @@ -87,14 +83,10 @@ bool LayerRenderer::hasLayer() { } } Region* LayerRenderer::getRegion() { Region* LayerRenderer::getRegion() { #if RENDER_LAYERS_AS_REGIONS if (getSnapshot()->flags & Snapshot::kFlagFboTarget) { if (getSnapshot()->flags & Snapshot::kFlagFboTarget) { return OpenGLRenderer::getRegion(); return OpenGLRenderer::getRegion(); } } return &mLayer->region; return &mLayer->region; #else return OpenGLRenderer::getRegion(); #endif } } // TODO: This implementation is flawed and can generate T-junctions // TODO: This implementation is flawed and can generate T-junctions Loading @@ -105,7 +97,6 @@ Region* LayerRenderer::getRegion() { // In practice, T-junctions do not appear often so this has yet // In practice, T-junctions do not appear often so this has yet // to be fixed. // to be fixed. void LayerRenderer::generateMesh() { void LayerRenderer::generateMesh() { #if RENDER_LAYERS_AS_REGIONS if (mLayer->region.isRect() || mLayer->region.isEmpty()) { if (mLayer->region.isRect() || mLayer->region.isEmpty()) { if (mLayer->mesh) { if (mLayer->mesh) { delete mLayer->mesh; delete mLayer->mesh; Loading Loading @@ -172,7 +163,6 @@ void LayerRenderer::generateMesh() { indices[index + 5] = quad + 3; // bottom-right indices[index + 5] = quad + 3; // bottom-right } } } } #endif } } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Loading Loading
core/java/android/view/HardwareRenderer.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -136,6 +136,18 @@ public abstract class HardwareRenderer { */ */ public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions"; public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions"; /** * Turn on to flash hardware layers when they update. * * Possible values: * "true", to enable hardware layers updates debugging * "false", to disable hardware layers updates debugging * * @hide */ public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY = "debug.hwui.show_layers_updates"; /** /** * A process can set this flag to false to prevent the use of hardware * A process can set this flag to false to prevent the use of hardware * rendering. * rendering. Loading
graphics/java/android/graphics/Bitmap.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -881,15 +881,17 @@ public final class Bitmap implements Parcelable { * <code>(128, 128, 0, 0)</code>.</p> * <code>(128, 128, 0, 0)</code>.</p> * * * <p>This method always returns false if {@link #getConfig()} is * <p>This method always returns false if {@link #getConfig()} is * {@link Bitmap.Config#ALPHA_8} or {@link Bitmap.Config#RGB_565}.</p> * {@link Bitmap.Config#RGB_565}.</p> * * <p>This method only returns true if {@link #hasAlpha()} returns true. * A bitmap with no alpha channel can be used both as a pre-multiplied and * as a non pre-multiplied bitmap.</p> * * * @return true if the underlying pixels have been pre-multiplied, false * @return true if the underlying pixels have been pre-multiplied, false * otherwise * otherwise */ */ public final boolean isPremultiplied() { public final boolean isPremultiplied() { final Config config = getConfig(); return getConfig() != Config.RGB_565 && hasAlpha(); //noinspection deprecation return config == Config.ARGB_8888 || config == Config.ARGB_4444; } } /** Returns the bitmap's width */ /** Returns the bitmap's width */ Loading
libs/hwui/Caches.cpp +11 −4 Original line number Original line Diff line number Diff line Loading @@ -52,13 +52,10 @@ Caches::Caches(): Singleton<Caches>(), mInitialized(false) { initFont(); initFont(); initExtensions(); initExtensions(); initConstraints(); initConstraints(); initProperties(); mDebugLevel = readDebugLevel(); mDebugLevel = readDebugLevel(); ALOGD("Enabling debug mode %d", mDebugLevel); ALOGD("Enabling debug mode %d", mDebugLevel); #if RENDER_LAYERS_AS_REGIONS INIT_LOGD("Layers will be composited as regions"); #endif } } void Caches::init() { void Caches::init() { Loading Loading @@ -126,6 +123,16 @@ void Caches::initConstraints() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); } } void Caches::initProperties() { char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, NULL) > 0) { INIT_LOGD(" Layers updates debug enabled: %s", property); debugLayersUpdates = !strcmp(property, "true"); } else { debugLayersUpdates = false; } } void Caches::terminate() { void Caches::terminate() { if (!mInitialized) return; if (!mInitialized) return; Loading
libs/hwui/Caches.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -236,6 +236,7 @@ public: // Misc // Misc GLint maxTextureSize; GLint maxTextureSize; bool debugLayersUpdates; TextureCache textureCache; TextureCache textureCache; LayerCache layerCache; LayerCache layerCache; Loading Loading @@ -267,6 +268,7 @@ private: void initFont(); void initFont(); void initExtensions(); void initExtensions(); void initConstraints(); void initConstraints(); void initProperties(); static void eventMarkNull(GLsizei length, const GLchar* marker) { } static void eventMarkNull(GLsizei length, const GLchar* marker) { } static void startMarkNull(GLsizei length, const GLchar* marker) { } static void startMarkNull(GLsizei length, const GLchar* marker) { } Loading
libs/hwui/LayerRenderer.cpp +0 −10 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,6 @@ int LayerRenderer::prepareDirty(float left, float top, float right, float bottom const float width = mLayer->layer.getWidth(); const float width = mLayer->layer.getWidth(); const float height = mLayer->layer.getHeight(); const float height = mLayer->layer.getHeight(); #if RENDER_LAYERS_AS_REGIONS Rect dirty(left, top, right, bottom); Rect dirty(left, top, right, bottom); if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && dirty.right >= width && dirty.bottom >= height)) { dirty.right >= width && dirty.bottom >= height)) { Loading @@ -58,9 +57,6 @@ int LayerRenderer::prepareDirty(float left, float top, float right, float bottom } } return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); #else return OpenGLRenderer::prepareDirty(0.0f, 0.0f, width, height, opaque); #endif } } void LayerRenderer::finish() { void LayerRenderer::finish() { Loading @@ -87,14 +83,10 @@ bool LayerRenderer::hasLayer() { } } Region* LayerRenderer::getRegion() { Region* LayerRenderer::getRegion() { #if RENDER_LAYERS_AS_REGIONS if (getSnapshot()->flags & Snapshot::kFlagFboTarget) { if (getSnapshot()->flags & Snapshot::kFlagFboTarget) { return OpenGLRenderer::getRegion(); return OpenGLRenderer::getRegion(); } } return &mLayer->region; return &mLayer->region; #else return OpenGLRenderer::getRegion(); #endif } } // TODO: This implementation is flawed and can generate T-junctions // TODO: This implementation is flawed and can generate T-junctions Loading @@ -105,7 +97,6 @@ Region* LayerRenderer::getRegion() { // In practice, T-junctions do not appear often so this has yet // In practice, T-junctions do not appear often so this has yet // to be fixed. // to be fixed. void LayerRenderer::generateMesh() { void LayerRenderer::generateMesh() { #if RENDER_LAYERS_AS_REGIONS if (mLayer->region.isRect() || mLayer->region.isEmpty()) { if (mLayer->region.isRect() || mLayer->region.isEmpty()) { if (mLayer->mesh) { if (mLayer->mesh) { delete mLayer->mesh; delete mLayer->mesh; Loading Loading @@ -172,7 +163,6 @@ void LayerRenderer::generateMesh() { indices[index + 5] = quad + 3; // bottom-right indices[index + 5] = quad + 3; // bottom-right } } } } #endif } } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Loading