~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/glu/sgi/libutil/mipmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
377
377
{
378
378
    int i, j, k;
379
379
    int newwidth, newheight;
 
380
    int padBytes;
380
381
    GLubyte *s;
381
382
    const char *t;
382
383
 
390
391
 
391
392
    newwidth = width / 2;
392
393
    newheight = height / 2;
 
394
    padBytes = ysize - (width*group_size);
393
395
    s = dataout;
394
396
    t = (const char *)datain;
395
397
 
405
407
            }
406
408
            t += group_size;
407
409
        }
 
410
        t += padBytes;
408
411
        t += ysize;
409
412
    }
410
413
}
476
479
{
477
480
    int i, j, k;
478
481
    int newwidth, newheight;
 
482
    int padBytes;
479
483
    GLbyte *s;
480
484
    const char *t;
481
485
 
489
493
 
490
494
    newwidth = width / 2;
491
495
    newheight = height / 2;
 
496
    padBytes = ysize - (width*group_size);
492
497
    s = dataout;
493
498
    t = (const char *)datain;
494
499
 
504
509
            }
505
510
            t += group_size;
506
511
        }
 
512
        t += padBytes;
507
513
        t += ysize;
508
514
    }
509
515
}
573
579
{
574
580
    int i, j, k;
575
581
    int newwidth, newheight;
 
582
    int padBytes;
576
583
    GLushort *s;
577
584
    const char *t;
578
585
 
586
593
 
587
594
    newwidth = width / 2;
588
595
    newheight = height / 2;
 
596
    padBytes = ysize - (width*group_size);
589
597
    s = dataout;
590
598
    t = (const char *)datain;
591
599
 
602
610
            }
603
611
            t += group_size;
604
612
        }
 
613
        t += padBytes;
605
614
        t += ysize;
606
615
    }
607
616
    else
616
625
            }
617
626
            t += group_size;
618
627
        }
 
628
        t += padBytes;
619
629
        t += ysize;
620
630
    }
621
631
}
708
718
{
709
719
    int i, j, k;
710
720
    int newwidth, newheight;
 
721
    int padBytes;
711
722
    GLshort *s;
712
723
    const char *t;
713
724
 
721
732
 
722
733
    newwidth = width / 2;
723
734
    newheight = height / 2;
 
735
    padBytes = ysize - (width*group_size);
724
736
    s = dataout;
725
737
    t = (const char *)datain;
726
738
 
737
749
            }
738
750
            t += group_size;
739
751
        }
 
752
        t += padBytes;
740
753
        t += ysize;
741
754
    }
742
755
    else
758
771
            }
759
772
            t += group_size;
760
773
        }
 
774
        t += padBytes;
761
775
        t += ysize;
762
776
    }
763
777
}
850
864
{
851
865
    int i, j, k;
852
866
    int newwidth, newheight;
 
867
    int padBytes;
853
868
    GLuint *s;
854
869
    const char *t;
855
870
 
863
878
 
864
879
    newwidth = width / 2;
865
880
    newheight = height / 2;
 
881
    padBytes = ysize - (width*group_size);
866
882
    s = dataout;
867
883
    t = (const char *)datain;
868
884
 
881
897
            }
882
898
            t += group_size;
883
899
        }
 
900
        t += padBytes;
884
901
        t += ysize;
885
902
    }
886
903
    else
899
916
            }
900
917
            t += group_size;
901
918
        }
 
919
        t += padBytes;
902
920
        t += ysize;
903
921
    }
904
922
}
990
1008
{
991
1009
    int i, j, k;
992
1010
    int newwidth, newheight;
 
1011
    int padBytes;
993
1012
    GLint *s;
994
1013
    const char *t;
995
1014
 
1003
1022
 
1004
1023
    newwidth = width / 2;
1005
1024
    newheight = height / 2;
 
1025
    padBytes = ysize - (width*group_size);
1006
1026
    s = dataout;
1007
1027
    t = (const char *)datain;
1008
1028
 
1019
1039
            }
1020
1040
            t += group_size;
1021
1041
        }
 
1042
        t += padBytes;
1022
1043
        t += ysize;
1023
1044
    }
1024
1045
    else
1041
1062
            }
1042
1063
            t += group_size;
1043
1064
        }
 
1065
        t += padBytes;
1044
1066
        t += ysize;
1045
1067
    }
1046
1068
}
1134
1156
{
1135
1157
    int i, j, k;
1136
1158
    int newwidth, newheight;
 
1159
    int padBytes;
1137
1160
    GLfloat *s;
1138
1161
    const char *t;
1139
1162
 
1147
1170
 
1148
1171
    newwidth = width / 2;
1149
1172
    newheight = height / 2;
 
1173
    padBytes = ysize - (width*group_size);
1150
1174
    s = dataout;
1151
1175
    t = (const char *)datain;
1152
1176
 
1163
1187
            }
1164
1188
            t += group_size;
1165
1189
        }
 
1190
        t += padBytes;
1166
1191
        t += ysize;
1167
1192
    }
1168
1193
    else
1183
1208
            }
1184
1209
            t += group_size;
1185
1210
        }
 
1211
        t += padBytes;
1186
1212
        t += ysize;
1187
1213
    }
1188
1214
}
3845
3871
    if (width == newwidth && height == newheight) {
3846
3872
        /* Use usersImage for level userLevel */
3847
3873
        if (baseLevel <= level && level <= maxLevel) {
 
3874
        glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
3848
3875
        glTexImage2D(target, level, internalFormat, width,
3849
3876
                height, 0, format, type,
3850
3877
                usersImage);
3851
3878
        }
 
3879
        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
3852
3880
        if(levels == 0) { /* we're done. clean up and return */
3853
3881
          glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
3854
3882
          glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
6590
6618
 * Contributed by Gerk Huisma <gerk@five-d.demon.nl>.
6591
6619
 */
6592
6620
 
6593
 
typedef GLAPI void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level,
 
6621
typedef void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level,
6594
6622
                                                 GLenum internalFormat,
6595
6623
                                                 GLsizei width, GLsizei height,
6596
6624
                                                 GLsizei depth, GLint border,
6597
6625
                                                 GLenum format, GLenum type,
6598
6626
                                                 const GLvoid *pixels );
6599
6627
 
6600
 
static TexImage3Dproc pTexImage3D;
 
6628
static TexImage3Dproc pTexImage3D = 0;
6601
6629
 
6602
 
#ifndef WIN32
 
6630
#ifndef _WIN32
6603
6631
#  include <dlfcn.h>
6604
6632
#  include <sys/types.h>
6605
6633
#else
6614
6642
                           const GLvoid *pixels )
6615
6643
{
6616
6644
   if (!pTexImage3D) {
6617
 
#ifdef WIN32
 
6645
#ifdef _WIN32
6618
6646
      pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3D");
6619
6647
      if (!pTexImage3D)
6620
6648
         pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT");
8643
8671
   int halfHeight= height / 2;
8644
8672
   int halfDepth= depth / 2;
8645
8673
   const char *src= (const char *)dataIn;
8646
 
   int padBytes= rowSizeInBytes - (width * groupSizeInBytes);
 
8674
   int rowPadBytes= rowSizeInBytes - (width * groupSizeInBytes);
 
8675
   int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes);
8647
8676
   int outIndex= 0;
8648
8677
 
8649
8678
   assert((width == 1 || height == 1) && depth >= 2);
8727
8756
            /* skip over to next horizontal square of 4 */
8728
8757
            src+= groupSizeInBytes;
8729
8758
         } /* for jj */
8730
 
         src+= padBytes;
 
8759
         src+= rowPadBytes;
8731
8760
 
8732
8761
         src+= rowSizeInBytes;
8733
8762
      } /* for ii */
8772
8801
 
8773
8802
               src+= elementSizeInBytes;
8774
8803
            } /* for cc */
8775
 
            src+= padBytes;
 
8804
            src+= rowPadBytes;
8776
8805
 
8777
8806
            /* skip over to next vertical square of 4 */
8778
8807
            src+= rowSizeInBytes;
8779
8808
         } /* for jj */
 
8809
         src+= imagePadBytes;
8780
8810
 
8781
8811
         src+= imageSizeInBytes;
8782
8812
      } /* for ii */
8816
8846
      int halfHeight= height / 2;
8817
8847
      int halfDepth= depth / 2;
8818
8848
      const char *src= (const char *) dataIn;
8819
 
      int padBytes= rowSizeInBytes - (width*groupSizeInBytes);
 
8849
      int rowPadBytes= rowSizeInBytes - (width*groupSizeInBytes);
 
8850
      int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes);
8820
8851
      int outIndex= 0;
8821
8852
 
8822
8853
      for (dd= 0; dd < halfDepth; dd++) {
8872
8903
               src+= groupSizeInBytes;
8873
8904
            } /* for jj */
8874
8905
            /* skip past pad bytes, if any, to get to next row */
8875
 
            src+= padBytes;
 
8906
            src+= rowPadBytes;
8876
8907
 
8877
8908
            /* src is at beginning of a row here, but it's the second row of
8878
8909
             * the square block of 4 pixels that we just worked on so we
8887
8918
            src+= rowSizeInBytes;
8888
8919
         } /* for ii */
8889
8920
 
 
8921
         /* skip past pad bytes, if any, to get to next image */
 
8922
         src+= imagePadBytes;
 
8923
 
8890
8924
         src+= imageSizeInBytes;
8891
8925
      } /* for dd */
8892
8926