Project

General

Profile

« Previous | Next » 

Revision d58b50e7

Added by Leszek Koltunski about 4 years ago

Remove width & height from InternalSurface and move it to InternalOutputSurface.

View differences:

src/main/java/org/distorted/library/main/DistortedNode.java
313 313
        }
314 314
      else if( node.mSurface instanceof DistortedFramebuffer )
315 315
        {
316
        int w = node.mSurface.getWidth();
317
        int h = node.mSurface.getHeight();
316
        DistortedFramebuffer fbo = (DistortedFramebuffer)node.mSurface;
317

  
318
        int w = fbo.getWidth();
319
        int h = fbo.getHeight();
318 320
        int depthStencil = DistortedFramebuffer.NO_DEPTH_NO_STENCIL;
319 321

  
320
        if( ((DistortedFramebuffer) node.mSurface).hasDepth() )
322
        if( fbo.hasDepth() )
321 323
          {
322
          boolean hasStencil = ((DistortedFramebuffer) node.mSurface).hasStencil();
324
          boolean hasStencil = fbo.hasStencil();
323 325
          depthStencil = (hasStencil ? DistortedFramebuffer.BOTH_DEPTH_STENCIL:DistortedFramebuffer.DEPTH_NO_STENCIL);
324 326
          }
325 327

  
src/main/java/org/distorted/library/main/DistortedTexture.java
115 115

  
116 116
  public DistortedTexture(int type)
117 117
    {
118
    super(0,0,NOT_CREATED_YET,1,1,type);
118
    super(NOT_CREATED_YET,1,1,type);
119 119
    mBmp= null;
120 120
    }
121 121

  
......
157 157
 */
158 158
  public void setTexture(Bitmap bmp)
159 159
    {
160
    mBmp   = bmp;
161
    mWidth = bmp.getWidth();
162
    mHeight= bmp.getHeight();
163

  
160
    mBmp= bmp;
164 161
    markForCreation();
165 162
    }
166 163

  
......
176 173
    paint.setColor(argb);
177 174
    paint.setStyle(Paint.Style.FILL);
178 175

  
179
    mWidth = 1;
180
    mHeight= 1;
181

  
182
    mBmp = Bitmap.createBitmap(mWidth,mHeight, Bitmap.Config.ARGB_8888);
176
    mBmp = Bitmap.createBitmap(1,1, Bitmap.Config.ARGB_8888);
183 177
    Canvas canvas = new Canvas(mBmp);
184
    canvas.drawRect(0,0,mWidth,mHeight,paint);
178
    canvas.drawRect(0,0,1,1,paint);
185 179

  
186 180
    markForCreation();
187 181
    }
src/main/java/org/distorted/library/main/InternalOutputSurface.java
45 45
  int mRealWidth;   // the Surface can be backed up by a texture larger than the viewport we have to it.
46 46
  int mRealHeight;  // mWidth,mHeight are the sizes of the Viewport, those - sizes of the backing up texture.
47 47
  int mCurrFBO;     // internal current FBO (see DistortedLibrary.FBO_QUEUE_SIZE)
48
  int mWidth, mHeight;
48 49

  
49 50
  private static DistortedFramebuffer[] mBuffer=null; // Global buffers used for postprocessing.
50 51
  private long[] mTime;
......
57 58

  
58 59
  InternalOutputSurface(int width, int height, int createColor, int numfbos, int numcolors, int depthStencil, int fbo, int type)
59 60
    {
60
    super(width,height,createColor,numfbos,numcolors,type);
61
    super(createColor,numfbos,numcolors,type);
61 62

  
62 63
    mRenderWayOIT = false;
63 64
    mCurrFBO      = 0;
......
68 69
    mTime = new long[numfbos];
69 70
    for(int i=0; i<mNumFBOs;i++) mTime[i]=0;
70 71

  
71
    mRealWidth = width;
72
    mRealHeight= height;
72
    mRealWidth = mWidth = width;
73
    mRealHeight= mHeight= height;
73 74

  
74 75
    mProjectionMatrix = new float[16];
75 76

  
......
936 937
    {
937 938
    mChildren.detachAll();
938 939
    }
940

  
941
///////////////////////////////////////////////////////////////////////////////////////////////////
942
/**
943
 * Return the width of this Surface.
944
 *
945
 * @return width of the Object, in pixels.
946
 */
947
  public int getWidth()
948
    {
949
    return mWidth;
950
    }
951

  
952
///////////////////////////////////////////////////////////////////////////////////////////////////
953
/**
954
 * Return the height of this Surface.
955
 *
956
 * @return height of the Object, in pixels.
957
 */
958
  public int getHeight()
959
    {
960
    return mHeight;
961
    }
939 962
}
src/main/java/org/distorted/library/main/InternalSurface.java
29 29
  int mNumColors;
30 30
  int mNumFBOs;
31 31
  int[] mColorH;
32
  int mWidth, mHeight;
33 32

  
34 33
///////////////////////////////////////////////////////////////////////////////////////////////////
35 34

  
36
  InternalSurface(int width, int height, int create, int numfbos, int numcolors, int type)
35
  InternalSurface(int create, int numfbos, int numcolors, int type)
37 36
    {
38 37
    super(type);
39 38

  
40 39
    mNumFBOs      = numfbos;
41 40
    mNumColors    = numcolors;
42
    mWidth        = width ;
43
    mHeight       = height;
44 41
    mColorCreated = create;
45 42

  
46 43
    int total = mNumFBOs*mNumColors;
......
57 54

  
58 55
  String printDetails()
59 56
    {
60
    return getClass().getSimpleName()+" "+mWidth+"x"+mHeight;
57
    return getClass().getSimpleName();
61 58
    }
62 59

  
63 60
///////////////////////////////////////////////////////////////////////////////////////////////////
64 61
// PUBLIC API
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66
/**
67
 * Return the width of this Surface.
68
 *
69
 * @return width of the Object, in pixels.
70
 */
71
  public int getWidth()
72
    {
73
    return mWidth;
74
    }
75

  
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77
/**
78
 * Return the height of this Surface.
79
 *
80
 * @return height of the Object, in pixels.
81
 */
82
  public int getHeight()
83
    {
84
    return mHeight;
85
    }
86

  
87 62
///////////////////////////////////////////////////////////////////////////////////////////////////
88 63
/**
89 64
 * Bind the underlying rectangle of pixels as a OpenGL Texture.

Also available in: Unified diff