From b74b0945b2e19c32f05d8bcb016cc9434c99979d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 Feb 2021 15:24:02 +0200 Subject: [PATCH] Rename Image::Data::data to pixels And get_data to get_pixels accordingly --- source/graphics/bmploader.cpp | 6 +++--- source/graphics/devil/devilloader.cpp | 4 ++-- source/graphics/image.cpp | 20 ++++++++++---------- source/graphics/image.h | 5 +++-- source/graphics/jpeg/jpegloader.cpp | 4 ++-- source/graphics/png/pngloader.cpp | 6 +++--- source/graphics/quartz/quartzloader.cpp | 4 ++-- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/source/graphics/bmploader.cpp b/source/graphics/bmploader.cpp index fa23182..f711dc1 100644 --- a/source/graphics/bmploader.cpp +++ b/source/graphics/bmploader.cpp @@ -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; yjpeg.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_scanlinejpeg.output_scanline; unsigned count = min(y, 8U); for(unsigned i=0; i(data.data+(y-i-1)*data.stride); + rows[i] = reinterpret_cast(data.pixels+(y-i-1)*data.stride); jpeg_read_scanlines(&priv->jpeg, rows, count); } diff --git a/source/graphics/png/pngloader.cpp b/source/graphics/png/pngloader.cpp index c2691bd..537dcc1 100644 --- a/source/graphics/png/pngloader.cpp +++ b/source/graphics/png/pngloader.cpp @@ -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.data+data.stride*(data.height-1-y)); + rows[y] = reinterpret_cast(data.pixels+data.stride*(data.height-1-y)); for(unsigned i=0; ipng, rows, 0, data.height); @@ -109,7 +109,7 @@ void PngLoader::load(Image::Data &data) else { for(unsigned y=0; ypng, reinterpret_cast(data.data+data.stride*(data.height-1-y)), 0); + png_read_row(priv->png, reinterpret_cast(data.pixels+data.stride*(data.height-1-y)), 0); } png_read_end(priv->png, 0); diff --git a/source/graphics/quartz/quartzloader.cpp b/source/graphics/quartz/quartzloader.cpp index 2821190..5493e45 100644 --- a/source/graphics/quartz/quartzloader.cpp +++ b/source/graphics/quartz/quartzloader.cpp @@ -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(data.data)); + CFDataGetBytes(image_data, range, reinterpret_cast(data.pixels)); CFRelease(image_data); CFRelease(image); -- 2.45.2