~sil2100/nux/precise_sru-1

« back to all changes in this revision

Viewing changes to NuxImage/ImageSurface.cpp

  • Committer: Didier Roche
  • Date: 2012-03-12 08:57:27 UTC
  • mfrom: (159.3.35)
  • Revision ID: didier.roche@canonical.com-20120312085727-9fyfwnno545c46uz
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
    m_Pitch = surface.m_Pitch;
196
196
    Alignment_ = surface.Alignment_;
197
197
 
198
 
    RawData_ = new t_u8[surface.GetSize()];
 
198
    RawData_ = new unsigned char[surface.GetSize()];
199
199
    Memcpy(RawData_, surface.RawData_, surface.GetSize());
200
200
  }
201
201
 
213
213
 
214
214
    delete [] RawData_;
215
215
 
216
 
    RawData_ = new t_u8[surface.GetSize() ];
 
216
    RawData_ = new unsigned char[surface.GetSize() ];
217
217
    Memcpy(RawData_, surface.RawData_, surface.GetSize());
218
218
    return *this;
219
219
  }
298
298
 
299
299
      block = GPixelFormats[format].BlockSizeY;
300
300
      shift = Log2(GPixelFormats[format].BlockSizeY);
301
 
      RawData_ = new t_u8[m_Pitch * Align((height + (block-1)) >> shift, block) ];
 
301
      RawData_ = new unsigned char[m_Pitch * Align((height + (block-1)) >> shift, block) ];
302
302
    }
303
303
    else
304
304
    {
308
308
 
309
309
      block = GPixelFormats[format].BlockSizeY;
310
310
      shift = Log2(GPixelFormats[format].BlockSizeY);
311
 
      RawData_ = new t_u8[m_Pitch * Align((height + (block-1)) >> shift, block) ];
 
311
      RawData_ = new unsigned char[m_Pitch * Align((height + (block-1)) >> shift, block) ];
312
312
    }
313
313
 
314
314
    Clear();
430
430
    if ((format_ == BITFMT_DXT1) || (format_ == BITFMT_DXT2)  || (format_ == BITFMT_DXT3)  || (format_ == BITFMT_DXT4) || (format_ == BITFMT_DXT5))
431
431
      return;
432
432
 
433
 
    RawData_[j *m_Pitch + i *bpe_ + 0] = (t_u8) (value & 0xff);
434
 
    RawData_[j *m_Pitch + i *bpe_ + 1] = (t_u8) ((value & 0xff00) >> 8);
435
 
    RawData_[j *m_Pitch + i *bpe_ + 2] = (t_u8) ((value & 0xff0000) >> 16);
436
 
    RawData_[j *m_Pitch + i *bpe_ + 3] = (t_u8) ((value & 0xff000000) >> 24);
 
433
    RawData_[j *m_Pitch + i *bpe_ + 0] = (unsigned char) (value & 0xff);
 
434
    RawData_[j *m_Pitch + i *bpe_ + 1] = (unsigned char) ((value & 0xff00) >> 8);
 
435
    RawData_[j *m_Pitch + i *bpe_ + 2] = (unsigned char) ((value & 0xff0000) >> 16);
 
436
    RawData_[j *m_Pitch + i *bpe_ + 3] = (unsigned char) ((value & 0xff000000) >> 24);
437
437
  }
438
438
 
439
439
  void ImageSurface::Write24b(int i, int j, unsigned int value)
445
445
    if ((format_ == BITFMT_DXT1) || (format_ == BITFMT_DXT2)  || (format_ == BITFMT_DXT3)  || (format_ == BITFMT_DXT4) || (format_ == BITFMT_DXT5))
446
446
      return;
447
447
 
448
 
    RawData_[j *m_Pitch + i *bpe_ + 0] = (t_u8) (value & 0xff);
449
 
    RawData_[j *m_Pitch + i *bpe_ + 1] = (t_u8) ((value & 0xff00) >> 8);
450
 
    RawData_[j *m_Pitch + i *bpe_ + 2] = (t_u8) ((value & 0xff0000) >> 16);
 
448
    RawData_[j *m_Pitch + i *bpe_ + 0] = (unsigned char) (value & 0xff);
 
449
    RawData_[j *m_Pitch + i *bpe_ + 1] = (unsigned char) ((value & 0xff00) >> 8);
 
450
    RawData_[j *m_Pitch + i *bpe_ + 2] = (unsigned char) ((value & 0xff0000) >> 16);
451
451
  }
452
452
 
453
453
  void ImageSurface::Write16b(int i, int j, unsigned short value)
459
459
    if ((format_ == BITFMT_DXT1) || (format_ == BITFMT_DXT2)  || (format_ == BITFMT_DXT3)  || (format_ == BITFMT_DXT4) || (format_ == BITFMT_DXT5))
460
460
      return;
461
461
 
462
 
    RawData_[j *m_Pitch + i *bpe_ + 0] = (t_u8) (value & 0xff);
463
 
    RawData_[j *m_Pitch + i *bpe_ + 1] = (t_u8) ((value & 0xff00) >> 8);
 
462
    RawData_[j *m_Pitch + i *bpe_ + 0] = (unsigned char) (value & 0xff);
 
463
    RawData_[j *m_Pitch + i *bpe_ + 1] = (unsigned char) ((value & 0xff00) >> 8);
464
464
  }
465
465
 
466
 
  void ImageSurface::Write8b(int i, int j, t_u8 value)
 
466
  void ImageSurface::Write8b(int i, int j, unsigned char value)
467
467
  {
468
468
    nuxAssert(i < width_);
469
469
    nuxAssert(j < height_);
472
472
    if ((format_ == BITFMT_DXT1) || (format_ == BITFMT_DXT2)  || (format_ == BITFMT_DXT3)  || (format_ == BITFMT_DXT4) || (format_ == BITFMT_DXT5))
473
473
      return;
474
474
 
475
 
    RawData_[j *m_Pitch + i *bpe_ + 0] = (t_u8) (value & 0xff);
 
475
    RawData_[j *m_Pitch + i *bpe_ + 0] = (unsigned char) (value & 0xff);
476
476
  }
477
477
 
478
 
  void ImageSurface::Write(int i, int j, t_u8 r, t_u8 g, t_u8 b, t_u8 a)
 
478
  void ImageSurface::Write(int i, int j, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
479
479
  {
480
480
    nuxAssert(i < width_);
481
481
    nuxAssert(j < height_);
555
555
      return;
556
556
 
557
557
    int i, j, k;
558
 
    t_u8 *flip_data;
 
558
    unsigned char *flip_data;
559
559
 
560
560
    if (RawData_ == 0)
561
561
      return;
563
563
    if (width_ == 0 || height_ == 0)
564
564
      return;
565
565
 
566
 
    flip_data =  new t_u8[m_Pitch*height_];
 
566
    flip_data =  new unsigned char[m_Pitch*height_];
567
567
 
568
568
    for (j = 0; j < height_; j++)
569
569
    {
584
584
  {
585
585
 
586
586
    int i, j, k;
587
 
    t_u8 *flip_data;
 
587
    unsigned char *flip_data;
588
588
 
589
589
    if (RawData_ == 0)
590
590
      return;
598
598
    }
599
599
    else
600
600
    {
601
 
      flip_data =  new t_u8[m_Pitch*height_];
 
601
      flip_data =  new unsigned char[m_Pitch*height_];
602
602
 
603
603
      for (j = 0; j < height_; j++)
604
604
      {
831
831
    *pBits = *pBits | (gBits[0][3] << 21);
832
832
  }
833
833
 
834
 
  const t_u8 *ImageSurface::GetPtrRawData() const
 
834
  const unsigned char *ImageSurface::GetPtrRawData() const
835
835
  {
836
836
    return RawData_;
837
837
  }
838
838
 
839
 
  t_u8 *ImageSurface::GetPtrRawData()
 
839
  unsigned char *ImageSurface::GetPtrRawData()
840
840
  {
841
841
    return RawData_;
842
842
  }