prepare glogin-beta for eventual cairo port
This commit is contained in:
parent
b728f1ce16
commit
a5621fee66
@ -10,6 +10,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "lib/sha2.h"
|
||||
@ -167,53 +169,73 @@ int main (int argc, char ** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* Generate surface for background */
|
||||
#if 0
|
||||
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, y->display_width);
|
||||
cairo_surface_t * bg_surf = cairo_image_surface_create_for_data(
|
||||
|
||||
int width = y->display_width;
|
||||
int height = y->display_height;
|
||||
yg->framebuffer_surface = cairo_image_surface_create_for_data(
|
||||
yg->backend_framebuffer, CAIRO_FORMAT_ARGB32, yg->width, yg->height, stride);
|
||||
#endif
|
||||
|
||||
win_width = width;
|
||||
win_height = height;
|
||||
sprite_t * bg_sprite;
|
||||
cairo_surface_t * bg_surf;
|
||||
|
||||
if (!sprites[2]) {
|
||||
float x = (float)width / (float)sprites[1]->width;
|
||||
float y = (float)height / (float)sprites[1]->height;
|
||||
int width = y->display_width;
|
||||
int height = y->display_height;
|
||||
|
||||
int nh = (int)(x * (float)sprites[1]->height);
|
||||
int nw = (int)(y * (float)sprites[1]->width);;
|
||||
win_width = width;
|
||||
win_height = height;
|
||||
|
||||
sprite_t * tmp = create_sprite(width, height, ALPHA_OPAQUE);
|
||||
gfx_context_t * bg_tmp = init_graphics_sprite(tmp);
|
||||
/* Do something with a window */
|
||||
yutani_window_t * wina = yutani_window_create(y, width, height);
|
||||
assert(wina);
|
||||
yutani_set_stack(y, wina, 0);
|
||||
ctx = init_graphics_yutani_double_buffer(wina);
|
||||
draw_fill(ctx, rgba(0,0,0,0));
|
||||
yutani_flip(y, wina);
|
||||
|
||||
sprites[2] = create_sprite(width, height, ALPHA_OPAQUE);
|
||||
gfx_context_t * bg = init_graphics_sprite(sprites[2]);
|
||||
{
|
||||
float x = (float)width / (float)sprites[1]->width;
|
||||
float y = (float)height / (float)sprites[1]->height;
|
||||
|
||||
if (nw > width) {
|
||||
draw_sprite_scaled(bg_tmp, sprites[1], (width - nw) / 2, 0, nw, height);
|
||||
} else {
|
||||
draw_sprite_scaled(bg_tmp, sprites[1], 0, (height - nh) / 2, width, nh);
|
||||
}
|
||||
int nh = (int)(x * (float)sprites[1]->height);
|
||||
int nw = (int)(y * (float)sprites[1]->width);;
|
||||
|
||||
blur_context_no_vignette(bg, bg_tmp, 80.0);
|
||||
blur_context_no_vignette(bg_tmp, bg, 400.0);
|
||||
blur_context_no_vignette(bg, bg_tmp, 200.0);
|
||||
sprite_t * tmp = create_sprite(width, height, ALPHA_OPAQUE);
|
||||
gfx_context_t * bg_tmp = init_graphics_sprite(tmp);
|
||||
|
||||
sprite_free(tmp);
|
||||
bg_sprite = create_sprite(width, height, ALPHA_OPAQUE);
|
||||
gfx_context_t * bg = init_graphics_sprite(bg_sprite);
|
||||
|
||||
free(bg_tmp);
|
||||
free(bg);
|
||||
if (nw > width) {
|
||||
draw_sprite_scaled(bg_tmp, sprites[1], (width - nw) / 2, 0, nw, height);
|
||||
} else {
|
||||
draw_sprite_scaled(bg_tmp, sprites[1], 0, (height - nh) / 2, width, nh);
|
||||
}
|
||||
|
||||
blur_context_no_vignette(bg, bg_tmp, 80.0);
|
||||
blur_context_no_vignette(bg_tmp, bg, 400.0);
|
||||
blur_context_no_vignette(bg, bg_tmp, 200.0);
|
||||
|
||||
/* Do something with a window */
|
||||
yutani_window_t * wina = yutani_window_create(y, width, height);
|
||||
assert(wina);
|
||||
//window_reorder (wina, 0); /* Disables movement */
|
||||
ctx = init_graphics_yutani_double_buffer(wina);
|
||||
sprite_free(tmp);
|
||||
|
||||
free(bg_tmp);
|
||||
free(bg);
|
||||
}
|
||||
|
||||
bg_surf = cairo_image_surface_create_for_data((void*)bg_sprite->bitmap, CAIRO_FORMAT_ARGB32, bg_sprite->width, bg_sprite->height, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, bg_sprite->width));
|
||||
|
||||
cairo_surface_t * cs = cairo_image_surface_create_for_data((void*)ctx->backbuffer, CAIRO_FORMAT_ARGB32, ctx->width, ctx->height, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, ctx->width));
|
||||
cairo_t * cr = cairo_create(cs);
|
||||
|
||||
while (1) {
|
||||
|
||||
yutani_set_stack(y, wina, 0);
|
||||
|
||||
for (int i = 0; i < LOGO_FINAL_OFFSET; ++i) {
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
draw_sprite(ctx, sprites[2], center_x(width), center_y(height));
|
||||
draw_sprite(ctx, bg_sprite, center_x(width), center_y(height));
|
||||
draw_sprite(ctx, sprites[0], center_x(sprites[0]->width), center_y(sprites[0]->height) - i);
|
||||
flip(ctx);
|
||||
yutani_flip(y, wina);
|
||||
@ -303,7 +325,7 @@ int main (int argc, char ** argv) {
|
||||
/* Redraw the background */
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
|
||||
draw_sprite(ctx, sprites[2], center_x(width), center_y(height));
|
||||
draw_sprite(ctx, bg_sprite, center_x(width), center_y(height));
|
||||
draw_sprite(ctx, sprites[0], center_x(sprites[0]->width), center_y(sprites[0]->height) - LOGO_FINAL_OFFSET);
|
||||
|
||||
draw_string_shadow(ctx, hostname_label_left, height - 12, white, hostname, rgb(0,0,0), 2, 1, 1, 3.0);
|
||||
@ -390,14 +412,11 @@ int main (int argc, char ** argv) {
|
||||
}
|
||||
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
draw_sprite(ctx, sprites[2], center_x(width), center_y(height));
|
||||
draw_sprite(ctx, bg_sprite, center_x(width), center_y(height));
|
||||
draw_sprite(ctx, sprites[0], center_x(sprites[0]->width), center_y(sprites[0]->height) - LOGO_FINAL_OFFSET);
|
||||
flip(ctx);
|
||||
yutani_flip(y, wina);
|
||||
|
||||
//teardown_windowing();
|
||||
yutani_close(y, wina);
|
||||
|
||||
pid_t _session_pid = fork();
|
||||
if (!_session_pid) {
|
||||
setenv("PATH", "/usr/bin:/bin", 0);
|
||||
@ -413,5 +432,8 @@ int main (int argc, char ** argv) {
|
||||
syscall_wait(_session_pid);
|
||||
}
|
||||
|
||||
yutani_close(y, wina);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user