mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
Update .clang-format
Align with wlroots style
This commit is contained in:
parent
96b5ab1fc1
commit
96e05057a3
32 changed files with 669 additions and 515 deletions
|
|
@ -5,32 +5,36 @@
|
|||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "xbm/parse.h"
|
||||
#include "common/bug-on.h"
|
||||
#include "xbm/parse.h"
|
||||
|
||||
static uint32_t color;
|
||||
|
||||
static uint32_t u32(float *rgba)
|
||||
static uint32_t
|
||||
u32(float *rgba)
|
||||
{
|
||||
uint32_t r[4] = { 0 };
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++) {
|
||||
r[i] = rgba[i] * 255;
|
||||
}
|
||||
return ((r[3] & 0xff) << 24) | ((r[0] & 0xff) << 16) |
|
||||
((r[1] & 0xff) << 8) | (r[2] & 0xff);
|
||||
}
|
||||
|
||||
void parse_set_color(float *rgba)
|
||||
void
|
||||
parse_set_color(float *rgba)
|
||||
{
|
||||
color = u32(rgba);
|
||||
}
|
||||
|
||||
static void process_bytes(struct pixmap *pixmap, struct token *tokens)
|
||||
static void
|
||||
process_bytes(struct pixmap *pixmap, struct token *tokens)
|
||||
{
|
||||
pixmap->data = (uint32_t *)calloc(pixmap->width * pixmap->height,
|
||||
sizeof(uint32_t));
|
||||
|
|
@ -42,33 +46,39 @@ static void process_bytes(struct pixmap *pixmap, struct token *tokens)
|
|||
++byte;
|
||||
++t;
|
||||
}
|
||||
if (!t->type)
|
||||
if (!t->type) {
|
||||
return;
|
||||
if (t->type != TOKEN_INT)
|
||||
}
|
||||
if (t->type != TOKEN_INT) {
|
||||
return;
|
||||
}
|
||||
int bit = 1 << (col % 8);
|
||||
if (t->value & bit)
|
||||
if (t->value & bit) {
|
||||
pixmap->data[row * pixmap->width + col] = color;
|
||||
}
|
||||
}
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
struct pixmap parse_xbm_tokens(struct token *tokens)
|
||||
struct pixmap
|
||||
parse_xbm_tokens(struct token *tokens)
|
||||
{
|
||||
struct pixmap pixmap = { 0 };
|
||||
|
||||
for (struct token *t = tokens; t->type; t++) {
|
||||
if (pixmap.width && pixmap.height) {
|
||||
if (t->type != TOKEN_INT)
|
||||
if (t->type != TOKEN_INT) {
|
||||
continue;
|
||||
}
|
||||
process_bytes(&pixmap, t);
|
||||
goto out;
|
||||
}
|
||||
if (strstr(t->name, "width"))
|
||||
if (strstr(t->name, "width")) {
|
||||
pixmap.width = atoi((++t)->name);
|
||||
else if (strstr(t->name, "height"))
|
||||
} else if (strstr(t->name, "height")) {
|
||||
pixmap.height = atoi((++t)->name);
|
||||
}
|
||||
}
|
||||
out:
|
||||
return pixmap;
|
||||
|
|
@ -79,7 +89,8 @@ out:
|
|||
* function to cope wit that max size
|
||||
*/
|
||||
#define LABWC_BUILTIN_ICON_MAX_SIZE (8)
|
||||
struct pixmap parse_xbm_builtin(const char *button, int size)
|
||||
struct pixmap
|
||||
parse_xbm_builtin(const char *button, int size)
|
||||
{
|
||||
struct pixmap pixmap = { 0 };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue