DisplayList.java revision daf98e941e140e8739458126640183b9f296a2ab
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.view; 18 19/** 20 * A display lists records a series of graphics related operation and can replay 21 * them later. Display lists are usually built by recording operations on a 22 * {@link android.graphics.Canvas}. Replaying the operations from a display list 23 * avoids executing views drawing code on every frame, and is thus much more 24 * efficient. 25 * 26 * @hide 27 */ 28public abstract class DisplayList { 29 /** 30 * Starts recording the display list. All operations performed on the 31 * returned canvas are recorded and stored in this display list. 32 * 33 * @return A canvas to record drawing operations. 34 */ 35 abstract HardwareCanvas start(); 36 37 /** 38 * Ends the recording for this display list. A display list cannot be 39 * replayed if recording is not finished. 40 */ 41 abstract void end(); 42 43 /** 44 * Indicates whether this display list can be replayed or not. 45 * 46 * @return True if the display list can be replayed, false otherwise. 47 * 48 * @see android.view.HardwareCanvas#drawDisplayList(DisplayList) 49 */ 50 abstract boolean isReady(); 51 52 /** 53 * Invalidates the display list, indicating that it should be repopulated 54 * with new drawing commands prior to being used again. Calling this method 55 * causes calls to {@link #isValid()} to return <code>false</code>. 56 */ 57 abstract void invalidate(); 58 59 /** 60 * Returns whether the display list is currently usable. If this returns false, 61 * the display list should be re-recorded prior to replaying it. 62 * 63 * @return boolean true if the display list is able to be replayed, false otherwise. 64 */ 65 abstract boolean isValid(); 66} 67