Default to rgba when subpixelorder is not specified

pull/3246/head
Isaac Connor 2021-05-02 11:49:12 -04:00
parent 44e8107cac
commit 3f5dbb7780
1 changed files with 10 additions and 2 deletions

View File

@ -160,20 +160,24 @@ Image::Image(int p_width, int p_height, int p_colours, int p_subpixelorder, uint
subpixelorder(p_subpixelorder), subpixelorder(p_subpixelorder),
buffer(p_buffer) { buffer(p_buffer) {
if ( !initialised ) if (!initialised)
Initialise(); Initialise();
pixels = width * height; pixels = width * height;
linesize = p_width * p_colours; linesize = p_width * p_colours;
size = linesize * height + padding; size = linesize * height + padding;
buffer = nullptr; buffer = nullptr;
holdbuffer = 0; holdbuffer = 0;
if ( p_buffer ) { if (p_buffer) {
allocation = size; allocation = size;
buffertype = ZM_BUFTYPE_DONTFREE; buffertype = ZM_BUFTYPE_DONTFREE;
buffer = p_buffer; buffer = p_buffer;
} else { } else {
AllocImgBuffer(size); AllocImgBuffer(size);
} }
if (!subpixelorder) {
// Default to RGBA when no subpixelorder is specified.
subpixelorder == ZM_SUBPIX_ORDER_RGBA;
}
imagePixFormat = AVPixFormat(); imagePixFormat = AVPixFormat();
update_function_pointers(); update_function_pointers();
@ -201,6 +205,10 @@ Image::Image(int p_width, int p_linesize, int p_height, int p_colours, int p_sub
} else { } else {
AllocImgBuffer(size); AllocImgBuffer(size);
} }
if (!subpixelorder) {
// Default to RGBA when no subpixelorder is specified.
subpixelorder == ZM_SUBPIX_ORDER_RGBA;
}
imagePixFormat = AVPixFormat(); imagePixFormat = AVPixFormat();
update_function_pointers(); update_function_pointers();