use of android.view.DisplayListCanvas in project android_frameworks_base by crdroidandroid.
the class BackdropFrameRenderer method redrawLocked.
/**
* Redraws the background, the caption and the system inset backgrounds if something changed.
*
* @param newBounds The window bounds which needs to be drawn.
* @param fullscreen Whether the window is currently drawing in fullscreen.
* @param systemInsets The current visible system insets for the window.
* @param stableInsets The stable insets for the window.
*/
private void redrawLocked(Rect newBounds, boolean fullscreen, Rect systemInsets, Rect stableInsets) {
// While a configuration change is taking place the view hierarchy might become
// inaccessible. For that case we remember the previous metrics to avoid flashes.
// Note that even when there is no visible caption, the caption child will exist.
final int captionHeight = mDecorView.getCaptionHeight();
// Once set to something other then 0 it should be kept that way.
if (captionHeight != 0) {
// Remember the height of the caption.
mLastCaptionHeight = captionHeight;
}
// content. If any size is 0, we have to wait for it to be drawn first.
if ((mLastCaptionHeight == 0 && mDecorView.isShowingCaption()) || mLastContentWidth == 0 || mLastContentHeight == 0) {
return;
}
// Since the surface is spanning the entire screen, we have to add the start offset of
// the bounds to get to the surface location.
final int left = mLastXOffset + newBounds.left;
final int top = mLastYOffset + newBounds.top;
final int width = newBounds.width();
final int height = newBounds.height();
mFrameAndBackdropNode.setLeftTopRightBottom(left, top, left + width, top + height);
// Draw the caption and content backdrops in to our render node.
DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
final Drawable drawable = mUserCaptionBackgroundDrawable != null ? mUserCaptionBackgroundDrawable : mCaptionBackgroundDrawable;
if (drawable != null) {
drawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
drawable.draw(canvas);
}
// The backdrop: clear everything with the background. Clipping is done elsewhere.
if (mResizingBackgroundDrawable != null) {
mResizingBackgroundDrawable.setBounds(0, mLastCaptionHeight, left + width, top + height);
mResizingBackgroundDrawable.draw(canvas);
}
mFrameAndBackdropNode.end(canvas);
drawColorViews(left, top, width, height, fullscreen, systemInsets, stableInsets);
// We need to render the node explicitly
mRenderer.drawRenderNode(mFrameAndBackdropNode);
reportDrawIfNeeded();
}
use of android.view.DisplayListCanvas in project android_frameworks_base by crdroidandroid.
the class KeyguardAffordanceView method drawBackgroundCircle.
private void drawBackgroundCircle(Canvas canvas) {
if (mCircleRadius > 0 || mFinishing) {
if (mFinishing && mSupportHardware && mHwCenterX != null) {
// Our hardware drawing proparties can be null if the finishing started but we have
// never drawn before. In that case we are not doing a render thread animation
// anyway, so we need to use the normal drawing.
DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
displayListCanvas.drawCircle(mHwCenterX, mHwCenterY, mHwCircleRadius, mHwCirclePaint);
} else {
updateCircleColor();
canvas.drawCircle(mCenterX, mCenterY, mCircleRadius, mCirclePaint);
}
}
}
use of android.view.DisplayListCanvas in project platform_frameworks_base by android.
the class BackdropFrameRenderer method redrawLocked.
/**
* Redraws the background, the caption and the system inset backgrounds if something changed.
*
* @param newBounds The window bounds which needs to be drawn.
* @param fullscreen Whether the window is currently drawing in fullscreen.
* @param systemInsets The current visible system insets for the window.
* @param stableInsets The stable insets for the window.
*/
private void redrawLocked(Rect newBounds, boolean fullscreen, Rect systemInsets, Rect stableInsets) {
// While a configuration change is taking place the view hierarchy might become
// inaccessible. For that case we remember the previous metrics to avoid flashes.
// Note that even when there is no visible caption, the caption child will exist.
final int captionHeight = mDecorView.getCaptionHeight();
// Once set to something other then 0 it should be kept that way.
if (captionHeight != 0) {
// Remember the height of the caption.
mLastCaptionHeight = captionHeight;
}
// content. If any size is 0, we have to wait for it to be drawn first.
if ((mLastCaptionHeight == 0 && mDecorView.isShowingCaption()) || mLastContentWidth == 0 || mLastContentHeight == 0) {
return;
}
// Since the surface is spanning the entire screen, we have to add the start offset of
// the bounds to get to the surface location.
final int left = mLastXOffset + newBounds.left;
final int top = mLastYOffset + newBounds.top;
final int width = newBounds.width();
final int height = newBounds.height();
mFrameAndBackdropNode.setLeftTopRightBottom(left, top, left + width, top + height);
// Draw the caption and content backdrops in to our render node.
DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
final Drawable drawable = mUserCaptionBackgroundDrawable != null ? mUserCaptionBackgroundDrawable : mCaptionBackgroundDrawable;
if (drawable != null) {
drawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
drawable.draw(canvas);
}
// The backdrop: clear everything with the background. Clipping is done elsewhere.
if (mResizingBackgroundDrawable != null) {
mResizingBackgroundDrawable.setBounds(0, mLastCaptionHeight, left + width, top + height);
mResizingBackgroundDrawable.draw(canvas);
}
mFrameAndBackdropNode.end(canvas);
drawColorViews(left, top, width, height, fullscreen, systemInsets, stableInsets);
// We need to render the node explicitly
mRenderer.drawRenderNode(mFrameAndBackdropNode);
reportDrawIfNeeded();
}
use of android.view.DisplayListCanvas in project platform_frameworks_base by android.
the class KeyguardAffordanceView method drawBackgroundCircle.
private void drawBackgroundCircle(Canvas canvas) {
if (mCircleRadius > 0 || mFinishing) {
if (mFinishing && mSupportHardware && mHwCenterX != null) {
// Our hardware drawing proparties can be null if the finishing started but we have
// never drawn before. In that case we are not doing a render thread animation
// anyway, so we need to use the normal drawing.
DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
displayListCanvas.drawCircle(mHwCenterX, mHwCenterY, mHwCircleRadius, mHwCirclePaint);
} else {
updateCircleColor();
canvas.drawCircle(mCenterX, mCenterY, mCircleRadius, mCirclePaint);
}
}
}
use of android.view.DisplayListCanvas in project android_frameworks_base by AOSPA.
the class BackdropFrameRenderer method drawColorViews.
private void drawColorViews(int left, int top, int width, int height, boolean fullscreen, Rect systemInsets, Rect stableInsets) {
if (mSystemBarBackgroundNode == null) {
return;
}
DisplayListCanvas canvas = mSystemBarBackgroundNode.start(width, height);
mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height);
final int topInset = DecorView.getColorViewTopInset(mStableInsets.top, mSystemInsets.top);
final int bottomInset = DecorView.getColorViewBottomInset(stableInsets.bottom, systemInsets.bottom);
final int rightInset = DecorView.getColorViewRightInset(stableInsets.right, systemInsets.right);
final int leftInset = DecorView.getColorViewLeftInset(stableInsets.left, systemInsets.left);
if (mStatusBarColor != null) {
mStatusBarColor.setBounds(0, 0, left + width, topInset);
mStatusBarColor.draw(canvas);
}
// However, we need it for the transitions into/out of docked mode.
if (mNavigationBarColor != null && fullscreen) {
final int size = DecorView.getNavBarSize(bottomInset, rightInset, leftInset);
if (DecorView.isNavBarToRightEdge(bottomInset, rightInset)) {
mNavigationBarColor.setBounds(width - size, 0, width, height);
} else if (DecorView.isNavBarToLeftEdge(bottomInset, leftInset)) {
mNavigationBarColor.setBounds(0, 0, size, height);
} else {
mNavigationBarColor.setBounds(0, height - size, width, height);
}
mNavigationBarColor.draw(canvas);
}
mSystemBarBackgroundNode.end(canvas);
mRenderer.drawRenderNode(mSystemBarBackgroundNode);
}
Aggregations