// Platform implementation of EterLib/JpegFile.h. 40250 writes it with libjpeg-9a (JpegFile.cpp: a stdio // destination manager, JCS_RGB, jpeg_set_defaults + jpeg_set_quality); here stb_image_write encodes the // same input (top-down RGB rows, 3 bytes per pixel) at the same quality into a baseline JFIF file. // // Only jpeg_save has a caller in 40250 (CPythonGraphic::SaveJPEG, the screenshot key); the other // declarations of JpegFile.h stay undefined. #include "EterLib/StdAfx.h" #include "EterLib/JpegFile.h" #include #include #define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_STATIC #define STBI_WRITE_NO_STDIO #include "../third_party/stb_image_write.h" namespace { void write_to_file(void* context, void* data, int size) { fwrite(data, 1, size_t(size), static_cast(context)); } } int jpeg_save(unsigned char*data_d, int width, int height, int quality, const char*filename) { // The Win32 CRT takes '\\' as a separator (grp.SaveScreenShot builds "\\METIN2\\