mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Fix Qt screenhot crash (#889)
This commit is contained in:
		@@ -136,7 +136,9 @@ public:
 | 
			
		||||
 | 
			
		||||
	void toRgb(ImageData<ColorRgb>& image)
 | 
			
		||||
	{
 | 
			
		||||
		image.resize(_width, _height);
 | 
			
		||||
		if (image.width() != _width || image.height() != _height)
 | 
			
		||||
			image.resize(_width, _height);
 | 
			
		||||
 | 
			
		||||
		const unsigned imageSize = _width * _height;
 | 
			
		||||
 | 
			
		||||
		for (unsigned idx = 0; idx < imageSize; idx++)
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,7 @@ int QtGrabber::grabFrame(Image<ColorRgb> & image)
 | 
			
		||||
	QPixmap originalPixmap = _screen->grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max);
 | 
			
		||||
	QPixmap resizedPixmap = originalPixmap.scaled(_width,_height);
 | 
			
		||||
	QImage imageFrame = resizedPixmap.toImage().convertToFormat( QImage::Format_RGB888);
 | 
			
		||||
	image.resize(imageFrame.width(), imageFrame.height());
 | 
			
		||||
 | 
			
		||||
	for (int y=0; y<imageFrame.height(); ++y)
 | 
			
		||||
		for (int x=0; x<imageFrame.width(); ++x)
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,9 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
 | 
			
		||||
	// calculate the output size
 | 
			
		||||
	int outputWidth = (width - _cropLeft - cropRight - (_horizontalDecimation >> 1) + _horizontalDecimation - 1) / _horizontalDecimation;
 | 
			
		||||
	int outputHeight = (height - _cropTop - cropBottom - (_verticalDecimation >> 1) + _verticalDecimation - 1) / _verticalDecimation;
 | 
			
		||||
	outputImage.resize(outputWidth, outputHeight);
 | 
			
		||||
 | 
			
		||||
	if (outputImage.width() != outputWidth || outputImage.height() != outputHeight)
 | 
			
		||||
		outputImage.resize(outputWidth, outputHeight);
 | 
			
		||||
 | 
			
		||||
	for (int yDest = 0, ySource = _cropTop + (_verticalDecimation >> 1); yDest < outputHeight; ySource += _verticalDecimation, ++yDest)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user