Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_splash_screen.c')
-rw-r--r--source/blender/windowmanager/intern/wm_splash_screen.c85
1 files changed, 43 insertions, 42 deletions
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c
index 2e04a629308..16e5f983bea 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.c
+++ b/source/blender/windowmanager/intern/wm_splash_screen.c
@@ -78,50 +78,51 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x,
static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf)
{
uchar *rct = (uchar *)ibuf->rect;
+ if (!rct) {
+ return;
+ }
- if (rct) {
- bTheme *btheme = UI_GetTheme();
- const float roundness = btheme->tui.wcol_menu_back.roundness * U.dpi_fac;
- const int size = roundness * 20;
-
- if (size < ibuf->x && size < ibuf->y) {
- /* Y-axis initial offset. */
- rct += 4 * (ibuf->y - size) * ibuf->x;
-
- for (int y = 0; y < size; y++) {
- for (int x = 0; x < size; x++, rct += 4) {
- const float pixel = 1.0 / size;
- const float u = pixel * x;
- const float v = pixel * y;
- const float distance = sqrt(u * u + v * v);
-
- /* Pointer offset to the alpha value of pixel. */
- /* NOTE: the left corner is flipped in the X-axis. */
- const int offset_l = 4 * (size - x - x - 1) + 3;
- const int offset_r = 4 * (ibuf->x - size) + 3;
-
- if (distance > 1.0) {
- rct[offset_l] = 0;
- rct[offset_r] = 0;
- }
- else {
- /* Create a single pixel wide transition for anti-aliasing.
- * Invert the distance and map its range [0, 1] to [0, pixel]. */
- const float fac = (1.0 - distance) * size;
-
- if (fac > 1.0) {
- continue;
- }
-
- const uchar alpha = unit_float_to_uchar_clamp(fac);
- rct[offset_l] = alpha;
- rct[offset_r] = alpha;
- }
+ bTheme *btheme = UI_GetTheme();
+ const float roundness = btheme->tui.wcol_menu_back.roundness * U.dpi_fac;
+ const int size = roundness * 20;
+
+ if (size < ibuf->x && size < ibuf->y) {
+ /* Y-axis initial offset. */
+ rct += 4 * (ibuf->y - size) * ibuf->x;
+
+ for (int y = 0; y < size; y++) {
+ for (int x = 0; x < size; x++, rct += 4) {
+ const float pixel = 1.0 / size;
+ const float u = pixel * x;
+ const float v = pixel * y;
+ const float distance = sqrt(u * u + v * v);
+
+ /* Pointer offset to the alpha value of pixel. */
+ /* NOTE: the left corner is flipped in the X-axis. */
+ const int offset_l = 4 * (size - x - x - 1) + 3;
+ const int offset_r = 4 * (ibuf->x - size) + 3;
+
+ if (distance > 1.0) {
+ rct[offset_l] = 0;
+ rct[offset_r] = 0;
}
+ else {
+ /* Create a single pixel wide transition for anti-aliasing.
+ * Invert the distance and map its range [0, 1] to [0, pixel]. */
+ const float fac = (1.0 - distance) * size;
- /* X-axis offset to the next row. */
- rct += 4 * (ibuf->x - size);
+ if (fac > 1.0) {
+ continue;
+ }
+
+ const uchar alpha = unit_float_to_uchar_clamp(fac);
+ rct[offset_l] = alpha;
+ rct[offset_r] = alpha;
+ }
}
+
+ /* X-axis offset to the next row. */
+ rct += 4 * (ibuf->x - size);
}
}
}
@@ -139,7 +140,7 @@ static ImBuf *wm_block_splash_image(int width, int *r_height)
char template_directory[FILE_MAX];
if (BKE_appdir_app_template_id_search(
U.app_template, template_directory, sizeof(template_directory))) {
- BLI_join_dirfile(splash_filepath, sizeof(splash_filepath), template_directory, "splash.png");
+ BLI_path_join(splash_filepath, sizeof(splash_filepath), template_directory, "splash.png");
ibuf = IMB_loadiffname(splash_filepath, IB_rect, NULL);
}
}
@@ -217,7 +218,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
if (cfgdir) {
- BLI_path_join(userpref, sizeof(userpref), cfgdir, BLENDER_USERPREF_FILE, NULL);
+ BLI_path_join(userpref, sizeof(userpref), cfgdir, BLENDER_USERPREF_FILE);
}
/* Draw setup screen if no preferences have been saved yet. */