am 89fca351: Merge "Make nested hardware layers work again" into honeycomb

* commit '89fca351702e3ec54c2748e2e2676ec1b2fbe9dc':
  Make nested hardware layers work again
This commit is contained in:
Romain Guy
2011-01-24 22:53:21 -08:00
committed by Android Git Automerger
2 changed files with 7 additions and 4 deletions

View File

@@ -8087,7 +8087,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* *
* @return A HardwareLayer ready to render, or null if an error occurred. * @return A HardwareLayer ready to render, or null if an error occurred.
*/ */
HardwareLayer getHardwareLayer(Canvas currentCanvas) { HardwareLayer getHardwareLayer() {
if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
return null; return null;
} }
@@ -8107,7 +8107,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
mHardwareLayer.resize(width, height); mHardwareLayer.resize(width, height);
} }
final HardwareCanvas canvas = mHardwareLayer.start(mAttachInfo.mHardwareCanvas); Canvas currentCanvas = mAttachInfo.mHardwareCanvas;
final HardwareCanvas canvas = mHardwareLayer.start(currentCanvas);
mAttachInfo.mHardwareCanvas = canvas;
try { try {
canvas.setViewport(width, height); canvas.setViewport(width, height);
// TODO: We should pass the dirty rect // TODO: We should pass the dirty rect
@@ -8131,7 +8133,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
canvas.restoreToCount(restoreCount); canvas.restoreToCount(restoreCount);
} finally { } finally {
canvas.onPostDraw(); canvas.onPostDraw();
mHardwareLayer.end(mAttachInfo.mHardwareCanvas); mHardwareLayer.end(currentCanvas);
mAttachInfo.mHardwareCanvas = currentCanvas;
} }
} }

View File

@@ -2475,7 +2475,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (hasNoCache) { if (hasNoCache) {
boolean layerRendered = false; boolean layerRendered = false;
if (layerType == LAYER_TYPE_HARDWARE) { if (layerType == LAYER_TYPE_HARDWARE) {
final HardwareLayer layer = child.getHardwareLayer(canvas); final HardwareLayer layer = child.getHardwareLayer();
if (layer != null && layer.isValid()) { if (layer != null && layer.isValid()) {
((HardwareCanvas) canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint); ((HardwareCanvas) canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint);
layerRendered = true; layerRendered = true;