]> git.tdb.fi Git - libs/gui.git/commitdiff
Rename Image::Data::data to pixels
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Feb 2021 13:24:02 +0000 (15:24 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Feb 2021 13:24:02 +0000 (15:24 +0200)
And get_data to get_pixels accordingly

source/graphics/bmploader.cpp
source/graphics/devil/devilloader.cpp
source/graphics/image.cpp
source/graphics/image.h
source/graphics/jpeg/jpegloader.cpp
source/graphics/png/pngloader.cpp
source/graphics/quartz/quartzloader.cpp

index fa23182883996164a73611c17b1416893aef0a62..f711dc1e8d66b2c50761ceab07ecdc72a97b8bf9 100644 (file)
@@ -92,16 +92,16 @@ void BmpLoader::load(Image::Data &data)
                skip -= size;
        }
 
-       data.data = new char[data.stride*data.height];
+       data.pixels = new char[data.stride*data.height];
        if(height<0)
        {
                for(unsigned y=0; y<data.height; ++y)
-                       read_full(io, data.data+(data.height-1-y)*data.stride, data.stride);
+                       read_full(io, data.pixels+(data.height-1-y)*data.stride, data.stride);
        }
        else
        {
                for(unsigned y=0; y<data.height; ++y)
-                       read_full(io, data.data+y*data.stride, data.stride);
+                       read_full(io, data.pixels+y*data.stride, data.stride);
        }
 }
 
index ab962d1d503352fbc5a44911c48817377241f872..e837154ecc3ed4730ba4d469a7023c8ce0724418 100644 (file)
@@ -126,9 +126,9 @@ void DevilLoader::load(Image::Data &data)
        data.height = ilGetInteger(IL_IMAGE_HEIGHT);
        data.stride = data.width*ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
        unsigned data_size = data.stride*data.height;
-       data.data = new char[data_size];
+       data.pixels = new char[data_size];
        ILubyte *il_data = ilGetData();
-       copy(il_data, il_data+data_size, data.data);
+       copy(il_data, il_data+data_size, data.pixels);
 
        ilBindImage(0);
        ilResetRead();
index a0e6e380ad24d54b20c5144c6001208147f9dbc5..e22d8eaef79958eb7ff83d389de018d0365c53c5 100644 (file)
@@ -14,7 +14,7 @@ Image::Data::Data():
        fmt(RGB),
        width(0),
        height(0),
-       data(0)
+       pixels(0)
 { }
 
 Image::Data::Data(const Data &other):
@@ -22,26 +22,26 @@ Image::Data::Data(const Data &other):
        width(other.width),
        height(other.height),
        stride(other.stride),
-       data(other.data ? new char[stride*height] : 0)
+       pixels(other.pixels ? new char[stride*height] : 0)
 {
-       if(data)
-               copy(other.data, other.data+stride*height, data);
+       if(pixels)
+               copy(other.pixels, other.pixels+stride*height, pixels);
 }
 
 Image::Data &Image::Data::operator=(const Data &other)
 {
-       delete[] data;
-       data = 0;
+       delete[] pixels;
+       pixels = 0;
 
        fmt = other.fmt;
        width = other.width;
        height = other.height;
        stride = other.stride;
 
-       if(other.data)
+       if(other.pixels)
        {
-               data = new char[stride*height];
-               copy(other.data, other.data+stride*height, data);
+               pixels = new char[stride*height];
+               copy(other.pixels, other.pixels+stride*height, pixels);
        }
 
        return *this;
@@ -49,7 +49,7 @@ Image::Data &Image::Data::operator=(const Data &other)
 
 Image::Data::~Data()
 {
-       delete[] data;
+       delete[] pixels;
 }
 
 
index 9f170046a333880bcad995e2fbd3e0574b28e538..86cfa4589824d9413fbb5996f6e695d4a2e8a93f 100644 (file)
@@ -20,7 +20,7 @@ public:
                unsigned width;
                unsigned height;
                unsigned stride;
-               char *data;
+               char *pixels;
 
                Data();
                Data(const Data &);
@@ -40,7 +40,8 @@ public:
        unsigned get_width() const { return data.width; }
        unsigned get_height() const { return data.height; }
        unsigned get_stride() const { return data.stride; }
-       const void *get_data() const { return data.data; }
+       DEPRECATED const void *get_data() const { return data.pixels; }
+       const void *get_pixels() const { return data.pixels; }
 };
 
 } // namespace Graphics
index bc0f2df60ef50c6967dcde7e56f43d8f4fafce61..9b7150d40eb4cb590710e3e881e535f7ed822d4a 100644 (file)
@@ -133,14 +133,14 @@ void JpegLoader::load(Image::Data &data)
        data.stride = priv->jpeg.output_width*priv->jpeg.output_components;
        data.fmt = RGB;
 
-       data.data = new char[data.stride*data.height];
+       data.pixels = new char[data.stride*data.height];
        JSAMPROW rows[8];
        while(priv->jpeg.output_scanline<data.height)
        {
                unsigned y = data.height-priv->jpeg.output_scanline;
                unsigned count = min(y, 8U);
                for(unsigned i=0; i<count; ++i)
-                       rows[i] = reinterpret_cast<JSAMPROW>(data.data+(y-i-1)*data.stride);
+                       rows[i] = reinterpret_cast<JSAMPROW>(data.pixels+(y-i-1)*data.stride);
                jpeg_read_scanlines(&priv->jpeg, rows, count);
        }
 
index c2691bd5c30522a51843bc7774d4ab8453c6db1e..537dcc190958ffd525443b2ef1af3de5ccd67cac 100644 (file)
@@ -90,7 +90,7 @@ void PngLoader::load(Image::Data &data)
        default: throw unsupported_image_format("unknown color type");
        }
 
-       data.data = new char[data.stride*data.height];
+       data.pixels = new char[data.stride*data.height];
 
        if(interlace==PNG_INTERLACE_ADAM7)
        {
@@ -98,7 +98,7 @@ void PngLoader::load(Image::Data &data)
                unsigned n_passes = png_set_interlace_handling(priv->png);
                rows = new png_byte *[data.height];
                for(unsigned y=0; y<data.height; ++y)
-                       rows[y] = reinterpret_cast<png_byte *>(data.data+data.stride*(data.height-1-y));
+                       rows[y] = reinterpret_cast<png_byte *>(data.pixels+data.stride*(data.height-1-y));
 
                for(unsigned i=0; i<n_passes; ++i)
                        png_read_rows(priv->png, rows, 0, data.height);
@@ -109,7 +109,7 @@ void PngLoader::load(Image::Data &data)
        else
        {
                for(unsigned y=0; y<data.height; ++y)
-                       png_read_row(priv->png, reinterpret_cast<png_byte *>(data.data+data.stride*(data.height-1-y)), 0);
+                       png_read_row(priv->png, reinterpret_cast<png_byte *>(data.pixels+data.stride*(data.height-1-y)), 0);
        }
 
        png_read_end(priv->png, 0);
index 2821190a465f880f3cedbf83005779d431b2f511..5493e45bace18709d00084fbc69d4a5ab0a6e6ae 100644 (file)
@@ -112,10 +112,10 @@ void QuartzLoader::load(Image::Data &data)
 
                CGDataProviderRef dp = CGImageGetDataProvider(image);
                CFDataRef image_data = CGDataProviderCopyData(dp);
-               data.data = new char[data.height*data.stride];
+               data.pixels = new char[data.height*data.stride];
                unsigned offset = (alpha==kCGImageAlphaNoneSkipFirst);
                CFRange range = CFRangeMake(offset, CFDataGetLength(image_data)-offset);
-               CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.data));
+               CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.pixels));
                CFRelease(image_data);
 
                CFRelease(image);