DisplayList.java revision b051e895ccb696604349c6c5efe7c4747e1d1ab6
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 */
26abstract class DisplayList {
27    /**
28     * Starts recording the display list. All operations performed on the
29     * returned canvas are recorded and stored in this display list.
30     *
31     * @return A canvas to record drawing operations.
32     */
33    abstract HardwareCanvas start();
34
35    /**
36     * Ends the recording for this display list. A display list cannot be
37     * replayed if recording is not finished.
38     */
39    abstract void end();
40
41    /**
42     * Frees resources taken by this display list. This method must be called
43     * before releasing all references.
44     */
45    abstract void destroy();
46
47    /**
48     * Indicates whether this display list can be replayed or not.
49     *
50     * @return True if the display list can be replayed, false otherwise.
51     *
52     * @see android.view.HardwareCanvas#drawDisplayList(DisplayList)
53     */
54    abstract boolean isReady();
55}
56