Loading core/java/android/view/Surface.java +3 −3 Original line number Diff line number Diff line Loading @@ -220,14 +220,14 @@ public class Surface implements Parcelable { /** * Gets a {@link Canvas} for drawing into this surface. * * After drawing into the provided {@link Canvas}, the caller should * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * @param inOutDirty A rectangle that represents the dirty region that the caller wants * to redraw. This function may choose to expand the dirty rectangle if for example * the surface has been resized or if the previous contents of the surface were * not available. The caller should redraw the entire dirty region as represented * by the contents of the dirty rect upon return from this function. * not available. The caller must redraw the entire dirty region as represented * by the contents of the inOutDirty rectangle upon return from this function. * The caller may also pass <code>null</code> instead, in the case where the * entire surface should be redrawn. * @return A canvas for drawing into the surface. Loading core/java/android/view/SurfaceView.java +32 −2 Original line number Diff line number Diff line Loading @@ -755,12 +755,36 @@ public class SurfaceView extends View { mHandler.sendMessage(msg); } /** * Gets a {@link Canvas} for drawing into the SurfaceView's Surface * * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * The caller must redraw the entire surface. * @return A canvas for drawing into the surface. */ public Canvas lockCanvas() { return internalLockCanvas(null); } public Canvas lockCanvas(Rect dirty) { return internalLockCanvas(dirty); /** * Gets a {@link Canvas} for drawing into the SurfaceView's Surface * * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * @param inOutDirty A rectangle that represents the dirty region that the caller wants * to redraw. This function may choose to expand the dirty rectangle if for example * the surface has been resized or if the previous contents of the surface were * not available. The caller must redraw the entire dirty region as represented * by the contents of the inOutDirty rectangle upon return from this function. * The caller may also pass <code>null</code> instead, in the case where the * entire surface should be redrawn. * @return A canvas for drawing into the surface. */ public Canvas lockCanvas(Rect inOutDirty) { return internalLockCanvas(inOutDirty); } private final Canvas internalLockCanvas(Rect dirty) { Loading Loading @@ -810,6 +834,12 @@ public class SurfaceView extends View { return null; } /** * Posts the new contents of the {@link Canvas} to the surface and * releases the {@link Canvas}. * * @param canvas The canvas previously obtained from {@link #lockCanvas}. */ public void unlockCanvasAndPost(Canvas canvas) { mSurface.unlockCanvasAndPost(canvas); mSurfaceLock.unlock(); Loading Loading
core/java/android/view/Surface.java +3 −3 Original line number Diff line number Diff line Loading @@ -220,14 +220,14 @@ public class Surface implements Parcelable { /** * Gets a {@link Canvas} for drawing into this surface. * * After drawing into the provided {@link Canvas}, the caller should * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * @param inOutDirty A rectangle that represents the dirty region that the caller wants * to redraw. This function may choose to expand the dirty rectangle if for example * the surface has been resized or if the previous contents of the surface were * not available. The caller should redraw the entire dirty region as represented * by the contents of the dirty rect upon return from this function. * not available. The caller must redraw the entire dirty region as represented * by the contents of the inOutDirty rectangle upon return from this function. * The caller may also pass <code>null</code> instead, in the case where the * entire surface should be redrawn. * @return A canvas for drawing into the surface. Loading
core/java/android/view/SurfaceView.java +32 −2 Original line number Diff line number Diff line Loading @@ -755,12 +755,36 @@ public class SurfaceView extends View { mHandler.sendMessage(msg); } /** * Gets a {@link Canvas} for drawing into the SurfaceView's Surface * * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * The caller must redraw the entire surface. * @return A canvas for drawing into the surface. */ public Canvas lockCanvas() { return internalLockCanvas(null); } public Canvas lockCanvas(Rect dirty) { return internalLockCanvas(dirty); /** * Gets a {@link Canvas} for drawing into the SurfaceView's Surface * * After drawing into the provided {@link Canvas}, the caller must * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface. * * @param inOutDirty A rectangle that represents the dirty region that the caller wants * to redraw. This function may choose to expand the dirty rectangle if for example * the surface has been resized or if the previous contents of the surface were * not available. The caller must redraw the entire dirty region as represented * by the contents of the inOutDirty rectangle upon return from this function. * The caller may also pass <code>null</code> instead, in the case where the * entire surface should be redrawn. * @return A canvas for drawing into the surface. */ public Canvas lockCanvas(Rect inOutDirty) { return internalLockCanvas(inOutDirty); } private final Canvas internalLockCanvas(Rect dirty) { Loading Loading @@ -810,6 +834,12 @@ public class SurfaceView extends View { return null; } /** * Posts the new contents of the {@link Canvas} to the surface and * releases the {@link Canvas}. * * @param canvas The canvas previously obtained from {@link #lockCanvas}. */ public void unlockCanvasAndPost(Canvas canvas) { mSurface.unlockCanvasAndPost(canvas); mSurfaceLock.unlock(); Loading