mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,rdtk] use png only if supported by winpr
rdtk compiles in bitmaps of fonts. if png format is supported by winpr, prefer the png images, otherwise use bmp
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <winpr/config.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/assert.h>
|
||||
@@ -33,6 +34,12 @@
|
||||
|
||||
#include "rdtk_font.h"
|
||||
|
||||
#if defined(WINPR_WITH_PNG)
|
||||
#define FILE_EXT "png"
|
||||
#else
|
||||
#define FILE_EXT "bmp"
|
||||
#endif
|
||||
|
||||
static int rdtk_font_draw_glyph(rdtkSurface* surface, int nXDst, int nYDst, rdtkFont* font,
|
||||
rdtkGlyph* glyph)
|
||||
{
|
||||
@@ -618,7 +625,8 @@ rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
|
||||
if (!fontImageFile)
|
||||
goto cleanup;
|
||||
|
||||
sprintf_s(fontImageFile, length + 8, "%s.png", fontBaseFile);
|
||||
sprintf_s(fontImageFile, length + 8, "%s." FILE_EXT, fontBaseFile);
|
||||
|
||||
fontDescriptorFile = (char*)malloc(length + 8);
|
||||
|
||||
if (!fontDescriptorFile)
|
||||
@@ -750,7 +758,8 @@ int rdtk_font_engine_init(rdtkEngine* engine)
|
||||
SSIZE_T descriptorSize;
|
||||
const uint8_t* imageData = NULL;
|
||||
const uint8_t* descriptorData = NULL;
|
||||
imageSize = rdtk_get_embedded_resource_file("source_serif_pro_regular_12.png", &imageData);
|
||||
imageSize =
|
||||
rdtk_get_embedded_resource_file("source_serif_pro_regular_12." FILE_EXT, &imageData);
|
||||
descriptorSize =
|
||||
rdtk_get_embedded_resource_file("source_serif_pro_regular_12.xml", &descriptorData);
|
||||
|
||||
|
||||
@@ -16,12 +16,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <winpr/config.h>
|
||||
|
||||
#include <rdtk/config.h>
|
||||
|
||||
#include "rdtk_resources.h"
|
||||
|
||||
#include "rdtk_nine_patch.h"
|
||||
|
||||
#if defined(WINPR_WITH_PNG)
|
||||
#define FILE_EXT "png"
|
||||
#else
|
||||
#define FILE_EXT "bmp"
|
||||
#endif
|
||||
|
||||
static int rdtk_image_copy_alpha_blend(uint8_t* pDstData, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, uint8_t* pSrcData, int nSrcStep,
|
||||
int nXSrc, int nYSrc)
|
||||
@@ -373,7 +381,7 @@ int rdtk_nine_patch_engine_init(rdtkEngine* engine)
|
||||
SSIZE_T size;
|
||||
const uint8_t* data;
|
||||
status = -1;
|
||||
size = rdtk_get_embedded_resource_file("btn_default_normal.9.png", &data);
|
||||
size = rdtk_get_embedded_resource_file("btn_default_normal.9." FILE_EXT, &data);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
@@ -401,7 +409,7 @@ int rdtk_nine_patch_engine_init(rdtkEngine* engine)
|
||||
SSIZE_T size;
|
||||
const uint8_t* data;
|
||||
status = -1;
|
||||
size = rdtk_get_embedded_resource_file("textfield_default.9.png", &data);
|
||||
size = rdtk_get_embedded_resource_file("textfield_default.9." FILE_EXT, &data);
|
||||
image = NULL;
|
||||
|
||||
if (size > 0)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -71,8 +71,6 @@ rdtkSurface* rdtk_surface_new(rdtkEngine* engine, uint8_t* data, uint16_t width,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(surface->data, 0, surface->scanline * surface->height);
|
||||
|
||||
surface->owner = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user