Project

General

Profile

« Previous | Next » 

Revision 2f9752c5

Added by Leszek Koltunski over 7 years ago

Tidy up 'FOV'

View differences:

src/main/java/org/distorted/examples/fov/FOVRenderer.java
43 43
   
44 44
   private GLSurfaceView mView;
45 45
   private DistortedBitmap fov;
46
   private Paint mPaint;
47
    
46

  
48 47
///////////////////////////////////////////////////////////////////////////////////////////////////
49 48

  
50
   public FOVRenderer(GLSurfaceView view) 
49
   FOVRenderer(GLSurfaceView view)
51 50
      { 
52 51
      mView = view;
53 52
      }
54 53

  
55 54
///////////////////////////////////////////////////////////////////////////////////////////////////
56 55

  
57
   public static void setFOV(int fov)
56
   static void setFOV(int fov)
58 57
      {
59 58
      Distorted.setFov(fov);
60 59
      }
......
95 94

  
96 95
    private void setupBitmap(int w, int h)
97 96
      {
98
      mPaint = new Paint();
97
      Paint paint = new Paint();
99 98
      fov = new DistortedBitmap(w,h, 50);
100 99
      Bitmap fovBitmap = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
101 100
      Canvas fovCanvas = new Canvas(fovBitmap);    
102 101

  
103
      mPaint.setColor(0xff008800);
104
      mPaint.setStyle(Style.FILL);
105
      fovCanvas.drawRect(0, 0, w, h, mPaint);
106
      mPaint.setColor(0xffffffff);
102
      paint.setColor(0xff008800);
103
      paint.setStyle(Style.FILL);
104
      fovCanvas.drawRect(0, 0, w, h, paint);
105
      paint.setColor(0xffffffff);
107 106
      
108 107
      for(int i=0; i<=NUMLINES ; i++ )
109 108
        {
110
        fovCanvas.drawRect(w*i/NUMLINES - 1,                0,  w*i/NUMLINES + 1,  h               , mPaint);
111
        fovCanvas.drawRect(               0, h *i/NUMLINES -1,  w               ,  h*i/NUMLINES + 1, mPaint);  
109
        fovCanvas.drawRect(w*i/NUMLINES - 1,                0,  w*i/NUMLINES + 1,  h               , paint);
110
        fovCanvas.drawRect(               0, h *i/NUMLINES -1,  w               ,  h*i/NUMLINES + 1, paint);
112 111
        }
113 112
        
114 113
      fov.setBitmap(fovBitmap);

Also available in: Unified diff