Revision ccd98f1c
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/main/DistortedBuffer.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
public DistortedBuffer(int target, int usage) |
44 | 44 |
{ |
45 |
super(DistortedObject.NOT_CREATED_YET,DistortedObject.TYPE_USER);
|
|
45 |
super(DistortedObject.TYPE_USER); |
|
46 | 46 |
|
47 | 47 |
mIndex = new int[1]; |
48 | 48 |
mTarget = target; |
49 | 49 |
mUsage = usage; |
50 |
mBuffer = null; |
|
51 |
mSize = 0; |
|
50 | 52 |
|
51 | 53 |
recreate(); |
52 | 54 |
} |
53 | 55 |
|
54 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 |
// mark for creation only now, when we do have all data ready, in order to avoid the situation |
|
58 |
// when create() would be called before this. |
|
55 | 59 |
|
56 | 60 |
public void setData(int size, Buffer buffer) |
57 | 61 |
{ |
58 | 62 |
mSize = size; |
59 | 63 |
mBuffer = buffer; |
64 |
|
|
65 |
markForCreation(); |
|
60 | 66 |
} |
61 | 67 |
|
62 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/main/DistortedObject.java | ||
---|---|---|
210 | 210 |
|
211 | 211 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
212 | 212 |
|
213 |
DistortedObject(int create, int type)
|
|
213 |
DistortedObject(int type) |
|
214 | 214 |
{ |
215 | 215 |
mID = type==TYPE_SYST ? --mNextSystemID : ++mNextClientID; |
216 | 216 |
mType= type; |
217 |
|
|
218 |
if( create!=DONT_CREATE ) |
|
219 |
{ |
|
220 |
synchronized(mToDoLock) |
|
221 |
{ |
|
222 |
mToDoMap.put(mID, new Job(this,JOB_CREATE) ); |
|
223 |
mToDo = true; |
|
224 |
} |
|
225 |
} |
|
226 | 217 |
} |
227 | 218 |
|
228 | 219 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/main/DistortedSurface.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
DistortedSurface(int width, int height, int create, int numfbos, int numcolors, int type) |
43 | 43 |
{ |
44 |
super(create,type); |
|
44 |
super(type); |
|
45 |
|
|
46 |
if( create!=DONT_CREATE ) markForCreation(); |
|
45 | 47 |
|
46 | 48 |
mNumFBOs = numfbos; |
47 | 49 |
mNumColors = numcolors; |
Also available in: Unified diff
Correct a bug in DistortedBuffer: we only mark it for creation when we actually have all the data ready, otherwise it can happen that create(0 is called before setData() !