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 17 package com.android.gallery3d.ui; 18 19 public abstract class DisplayItem { 20 21 protected int mBoxWidth; 22 protected int mBoxHeight; 23 24 // setBox() specifies the box that the DisplayItem should render into. It 25 // should be called before first render(). It may be called again between 26 // render() calls to change the size of the box. setBox(int width, int height)27 public void setBox(int width, int height) { 28 mBoxWidth = width; 29 mBoxHeight = height; 30 } 31 32 // Return values of render(): 33 // RENDER_MORE_PASS: more pass is needed for this item 34 // RENDER_MORE_FRAME: need to render next frame (used for animation) 35 public static final int RENDER_MORE_PASS = 1; 36 public static final int RENDER_MORE_FRAME = 2; 37 render(GLCanvas canvas, int pass)38 public abstract int render(GLCanvas canvas, int pass); 39 getIdentity()40 public abstract long getIdentity(); 41 getRotation()42 public int getRotation() { 43 return 0; 44 } 45 } 46