Revision 09ab7524
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/DistortedSurface.java | ||
|---|---|---|
| 36 | 36 |
static final int DONT_CREATE = 3; |
| 37 | 37 |
static final int CREATED = 4; |
| 38 | 38 |
|
| 39 |
static final int TYPE_USER = 0; |
|
| 40 |
static final int TYPE_TREE = 1; |
|
| 41 |
static final int TYPE_SYST = 2; |
|
| 42 |
|
|
| 39 | 43 |
private static boolean mToDo = false; |
| 40 | 44 |
private static LinkedList<DistortedSurface> mDoneList = new LinkedList<>(); |
| 41 | 45 |
private static LinkedList<DistortedSurface> mToDoList = new LinkedList<>(); |
| ... | ... | |
| 44 | 48 |
|
| 45 | 49 |
private long mID; |
| 46 | 50 |
private boolean mMarked; |
| 47 |
private boolean mSystem;
|
|
| 51 |
private int mType;
|
|
| 48 | 52 |
int mColorCreated; |
| 49 | 53 |
int[] mColorH = new int[1]; |
| 50 | 54 |
int mSizeX, mSizeY; // in screen space |
| ... | ... | |
| 98 | 102 |
{
|
| 99 | 103 |
surface = mDoneList.removeFirst(); |
| 100 | 104 |
|
| 101 |
if( surface.mSystem )
|
|
| 105 |
if( surface.mType==TYPE_SYST )
|
|
| 102 | 106 |
{
|
| 103 | 107 |
mToDoList.add(surface); |
| 104 | 108 |
surface.recreate(); |
| ... | ... | |
| 111 | 115 |
{
|
| 112 | 116 |
surface = mToDoList.get(i); |
| 113 | 117 |
|
| 114 |
if( !surface.mSystem )
|
|
| 118 |
if( surface.mType!=TYPE_SYST )
|
|
| 115 | 119 |
{
|
| 116 | 120 |
mDoneList.remove(i); |
| 117 | 121 |
i--; |
| ... | ... | |
| 165 | 169 |
|
| 166 | 170 |
str += ("("+surface.getWidth()+","+surface.getHeight()+") surfaceID:"+surface.getID());
|
| 167 | 171 |
|
| 172 |
switch(surface.mType) |
|
| 173 |
{
|
|
| 174 |
case TYPE_SYST: str+=" SYSTEM"; break; |
|
| 175 |
case TYPE_USER: str+=" USER" ; break; |
|
| 176 |
case TYPE_TREE: str+=" TREE" ; break; |
|
| 177 |
default : str+=" ERROR??"; |
|
| 178 |
} |
|
| 179 |
|
|
| 168 | 180 |
android.util.Log.e("Surface", str);
|
| 169 | 181 |
} |
| 170 | 182 |
} |
| 171 | 183 |
|
| 172 | 184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 173 | 185 |
|
| 174 |
DistortedSurface(int width, int height, int create, boolean system)
|
|
| 186 |
DistortedSurface(int width, int height, int create, int type)
|
|
| 175 | 187 |
{
|
| 176 | 188 |
mSizeX = width ; |
| 177 | 189 |
mSizeY = height; |
| 178 | 190 |
mColorCreated = create; |
| 179 | 191 |
mColorH[0] = 0; |
| 180 | 192 |
mMarked = false; |
| 181 |
mID = system ? --mNextSystemID : ++mNextClientID;
|
|
| 182 |
mSystem = system;
|
|
| 193 |
mID = type==TYPE_SYST ? --mNextSystemID : ++mNextClientID;
|
|
| 194 |
mType = type;
|
|
| 183 | 195 |
|
| 184 | 196 |
if( create!=DONT_CREATE ) |
| 185 | 197 |
{
|
Also available in: Unified diff
Introduce 3 types of Surfaces: System, Tree, User