Loading core/java/android/view/ViewGroup.java +4 −4 Original line number Diff line number Diff line Loading @@ -2203,10 +2203,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** * Perform dispatching of a {@link #saveHierarchyState freeze()} to only this view, * not to its children. For use when overriding * {@link #dispatchSaveInstanceState dispatchFreeze()} to allow subclasses to freeze * their own state but not the state of their children. * Perform dispatching of a {@link #saveHierarchyState(android.util.SparseArray)} freeze()} * to only this view, not to its children. For use when overriding * {@link #dispatchSaveInstanceState(android.util.SparseArray)} dispatchFreeze()} to allow * subclasses to freeze their own state but not the state of their children. * * @param container the container */ Loading core/java/android/widget/ImageView.java +18 −16 Original line number Diff line number Diff line Loading @@ -218,15 +218,16 @@ public class ImageView extends View { /** * An optional argument to supply a maximum width for this view. Only valid if * {@link #setAdjustViewBounds} has been set to true. To set an image to be a maximum of 100 x * 100 while preserving the original aspect ratio, do the following: 1) set adjustViewBounds to * true 2) set maxWidth and maxHeight to 100 3) set the height and width layout params to * WRAP_CONTENT. * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a maximum * of 100 x 100 while preserving the original aspect ratio, do the following: 1) set * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width * layout params to WRAP_CONTENT. * * <p> * Note that this view could be still smaller than 100 x 100 using this approach if the original * image is small. To set an image to a fixed size, specify that size in the layout params and * then use {@link #setScaleType} to determine how to fit the image within the bounds. * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit * the image within the bounds. * </p> * * @param maxWidth maximum width for this view Loading @@ -240,15 +241,16 @@ public class ImageView extends View { /** * An optional argument to supply a maximum height for this view. Only valid if * {@link #setAdjustViewBounds} has been set to true. To set an image to be a maximum of 100 x * 100 while preserving the original aspect ratio, do the following: 1) set adjustViewBounds to * true 2) set maxWidth and maxHeight to 100 3) set the height and width layout params to * WRAP_CONTENT. * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a * maximum of 100 x 100 while preserving the original aspect ratio, do the following: 1) set * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width * layout params to WRAP_CONTENT. * * <p> * Note that this view could be still smaller than 100 x 100 using this approach if the original * image is small. To set an image to a fixed size, specify that size in the layout params and * then use {@link #setScaleType} to determine how to fit the image within the bounds. * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit * the image within the bounds. * </p> * * @param maxHeight maximum height for this view Loading @@ -272,8 +274,8 @@ public class ImageView extends View { * * <p class="note">This does Bitmap reading and decoding on the UI * thread, which can cause a latency hiccup. If that's a concern, * consider using {@link #setImageDrawable} or * {@link #setImageBitmap} and * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or * {@link #setImageBitmap(android.graphics.Bitmap)} and * {@link android.graphics.BitmapFactory} instead.</p> * * @param resId the resource identifier of the the drawable Loading @@ -297,8 +299,8 @@ public class ImageView extends View { * * <p class="note">This does Bitmap reading and decoding on the UI * thread, which can cause a latency hiccup. If that's a concern, * consider using {@link #setImageDrawable} or * {@link #setImageBitmap} and * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or * {@link #setImageBitmap(android.graphics.Bitmap)} and * {@link android.graphics.BitmapFactory} instead.</p> * * @param uri The Uri of an image Loading Loading @@ -902,12 +904,12 @@ public class ImageView extends View { /** * <p>Set the offset of the widget's text baseline from the widget's top * boundary. This value is overridden by the {@link #setBaselineAlignBottom} * boundary. This value is overridden by the {@link #setBaselineAlignBottom(boolean)} * property.</p> * * @param baseline The baseline to use, or -1 if none is to be provided. * * @see #setBaseline * @see #setBaseline(int) * @attr ref android.R.styleable#ImageView_baseline */ public void setBaseline(int baseline) { Loading libs/hwui/Layer.h +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ struct Layer { if (meshIndices) delete meshIndices; } /** * Sets this layer's region to a rectangle. Computes the appropriate * texture coordinates. */ void setRegionAsRect() { const android::Rect& bounds = region.getBounds(); regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); const float texX = 1.0f / float(width); const float texY = 1.0f / float(height); const float height = layer.getHeight(); texCoords.set( regionRect.left * texX, (height - regionRect.top) * texY, regionRect.right * texX, (height - regionRect.bottom) * texY); } /** * Bounds of the layer. */ Loading libs/hwui/LayerRenderer.cpp +1 −13 Original line number Diff line number Diff line Loading @@ -102,19 +102,7 @@ void LayerRenderer::generateMesh() { mLayer->meshElementCount = 0; } const android::Rect& bounds = mLayer->region.getBounds(); mLayer->regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); const float texX = 1.0f / float(mLayer->width); const float texY = 1.0f / float(mLayer->height); const float height = mLayer->layer.getHeight(); mLayer->texCoords.set( mLayer->regionRect.left * texX, (height - mLayer->regionRect.top) * texY, mLayer->regionRect.right * texX, (height - mLayer->regionRect.bottom) * texY); mLayer->setRegionAsRect(); return; } Loading libs/hwui/OpenGLRenderer.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -647,10 +647,10 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) { #if RENDER_LAYERS_AS_REGIONS if (layer->region.isRect()) { const android::Rect& bounds = layer->region.getBounds(); layer->regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); layer->setRegionAsRect(); composeLayerRect(layer, layer->regionRect); layer->region.clear(); return; } Loading Loading
core/java/android/view/ViewGroup.java +4 −4 Original line number Diff line number Diff line Loading @@ -2203,10 +2203,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** * Perform dispatching of a {@link #saveHierarchyState freeze()} to only this view, * not to its children. For use when overriding * {@link #dispatchSaveInstanceState dispatchFreeze()} to allow subclasses to freeze * their own state but not the state of their children. * Perform dispatching of a {@link #saveHierarchyState(android.util.SparseArray)} freeze()} * to only this view, not to its children. For use when overriding * {@link #dispatchSaveInstanceState(android.util.SparseArray)} dispatchFreeze()} to allow * subclasses to freeze their own state but not the state of their children. * * @param container the container */ Loading
core/java/android/widget/ImageView.java +18 −16 Original line number Diff line number Diff line Loading @@ -218,15 +218,16 @@ public class ImageView extends View { /** * An optional argument to supply a maximum width for this view. Only valid if * {@link #setAdjustViewBounds} has been set to true. To set an image to be a maximum of 100 x * 100 while preserving the original aspect ratio, do the following: 1) set adjustViewBounds to * true 2) set maxWidth and maxHeight to 100 3) set the height and width layout params to * WRAP_CONTENT. * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a maximum * of 100 x 100 while preserving the original aspect ratio, do the following: 1) set * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width * layout params to WRAP_CONTENT. * * <p> * Note that this view could be still smaller than 100 x 100 using this approach if the original * image is small. To set an image to a fixed size, specify that size in the layout params and * then use {@link #setScaleType} to determine how to fit the image within the bounds. * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit * the image within the bounds. * </p> * * @param maxWidth maximum width for this view Loading @@ -240,15 +241,16 @@ public class ImageView extends View { /** * An optional argument to supply a maximum height for this view. Only valid if * {@link #setAdjustViewBounds} has been set to true. To set an image to be a maximum of 100 x * 100 while preserving the original aspect ratio, do the following: 1) set adjustViewBounds to * true 2) set maxWidth and maxHeight to 100 3) set the height and width layout params to * WRAP_CONTENT. * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a * maximum of 100 x 100 while preserving the original aspect ratio, do the following: 1) set * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width * layout params to WRAP_CONTENT. * * <p> * Note that this view could be still smaller than 100 x 100 using this approach if the original * image is small. To set an image to a fixed size, specify that size in the layout params and * then use {@link #setScaleType} to determine how to fit the image within the bounds. * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit * the image within the bounds. * </p> * * @param maxHeight maximum height for this view Loading @@ -272,8 +274,8 @@ public class ImageView extends View { * * <p class="note">This does Bitmap reading and decoding on the UI * thread, which can cause a latency hiccup. If that's a concern, * consider using {@link #setImageDrawable} or * {@link #setImageBitmap} and * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or * {@link #setImageBitmap(android.graphics.Bitmap)} and * {@link android.graphics.BitmapFactory} instead.</p> * * @param resId the resource identifier of the the drawable Loading @@ -297,8 +299,8 @@ public class ImageView extends View { * * <p class="note">This does Bitmap reading and decoding on the UI * thread, which can cause a latency hiccup. If that's a concern, * consider using {@link #setImageDrawable} or * {@link #setImageBitmap} and * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or * {@link #setImageBitmap(android.graphics.Bitmap)} and * {@link android.graphics.BitmapFactory} instead.</p> * * @param uri The Uri of an image Loading Loading @@ -902,12 +904,12 @@ public class ImageView extends View { /** * <p>Set the offset of the widget's text baseline from the widget's top * boundary. This value is overridden by the {@link #setBaselineAlignBottom} * boundary. This value is overridden by the {@link #setBaselineAlignBottom(boolean)} * property.</p> * * @param baseline The baseline to use, or -1 if none is to be provided. * * @see #setBaseline * @see #setBaseline(int) * @attr ref android.R.styleable#ImageView_baseline */ public void setBaseline(int baseline) { Loading
libs/hwui/Layer.h +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ struct Layer { if (meshIndices) delete meshIndices; } /** * Sets this layer's region to a rectangle. Computes the appropriate * texture coordinates. */ void setRegionAsRect() { const android::Rect& bounds = region.getBounds(); regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); const float texX = 1.0f / float(width); const float texY = 1.0f / float(height); const float height = layer.getHeight(); texCoords.set( regionRect.left * texX, (height - regionRect.top) * texY, regionRect.right * texX, (height - regionRect.bottom) * texY); } /** * Bounds of the layer. */ Loading
libs/hwui/LayerRenderer.cpp +1 −13 Original line number Diff line number Diff line Loading @@ -102,19 +102,7 @@ void LayerRenderer::generateMesh() { mLayer->meshElementCount = 0; } const android::Rect& bounds = mLayer->region.getBounds(); mLayer->regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); const float texX = 1.0f / float(mLayer->width); const float texY = 1.0f / float(mLayer->height); const float height = mLayer->layer.getHeight(); mLayer->texCoords.set( mLayer->regionRect.left * texX, (height - mLayer->regionRect.top) * texY, mLayer->regionRect.right * texX, (height - mLayer->regionRect.bottom) * texY); mLayer->setRegionAsRect(); return; } Loading
libs/hwui/OpenGLRenderer.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -647,10 +647,10 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) { #if RENDER_LAYERS_AS_REGIONS if (layer->region.isRect()) { const android::Rect& bounds = layer->region.getBounds(); layer->regionRect.set(bounds.leftTop().x, bounds.leftTop().y, bounds.rightBottom().x, bounds.rightBottom().y); layer->setRegionAsRect(); composeLayerRect(layer, layer->regionRect); layer->region.clear(); return; } Loading