当前位置: 首页>>代码示例>>C++>>正文


C++ set_active_framebuffer函数代码示例

本文整理汇总了C++中set_active_framebuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ set_active_framebuffer函数的具体用法?C++ set_active_framebuffer怎么用?C++ set_active_framebuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_active_framebuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;

#ifdef BOARD_HAS_FLIPPED_SCREEN
    /* flip buffer 180 degrees for devices with physicaly inverted screens */
    unsigned int i;
    for (i = 1; i < (vi.xres * vi.yres); i++) {
        unsigned short tmp = gr_mem_surface.data[i];
        gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i];
        gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp;
    }
#endif

    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    if( vi.bits_per_pixel == 16)
    {
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               vi.xres * vi.yres * 2);
    }
    else
    {
        gr_flip_32((unsigned *)gr_framebuffer[gr_active_fb].data,
                   (unsigned short *)gr_mem_surface.data,
                   (gr_framebuffer[gr_active_fb].stride
                    * gr_framebuffer[gr_active_fb].height));
    }

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:SteelDroid,项目名称:platform_device_raidzero,代码行数:35,代码来源:graphics.c

示例2: gr_flip

void gr_flip(void)
{
    if (-EINVAL == overlay_display_frame(gr_fb_fd, gr_mem_surface.data,
                                         (fi.line_length * vi.yres))) {
        GGLContext *gl = gr_context;

        /* swap front and back buffers */
        if (double_buffering)
            gr_active_fb = (gr_active_fb + 1) & 1;

#ifdef BOARD_HAS_FLIPPED_SCREEN
        /* flip buffer 180 degrees for devices with physicaly inverted screens */
        unsigned int i;
        unsigned int j;
        uint8_t tmp;
        for (i = 0; i < ((vi.xres_virtual * vi.yres)/2); i++) {
            for (j = 0; j < PIXEL_SIZE; j++) {
                tmp = gr_mem_surface.data[i * PIXEL_SIZE + j];
                gr_mem_surface.data[i * PIXEL_SIZE + j] = gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j];
                gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j] = tmp;
            }
        }
#endif

        /* copy data from the in-memory surface to the buffer we're about
         * to make active. */
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               vi.xres_virtual * vi.yres * PIXEL_SIZE);

        /* inform the display driver */
        set_active_framebuffer(gr_active_fb);
    }
}
开发者ID:CaffeineCode,项目名称:twrp_device,代码行数:33,代码来源:graphics.c

示例3: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    if (double_buffering)
        gr_active_fb = (gr_active_fb + 1) & 1;

#ifdef BOARD_HAS_FLIPPED_SCREEN
    /* flip buffer 180 degrees for devices with physicaly inverted screens */
    unsigned int i;
    for (i = 1; i < (vi.xres * vi.yres); i++) {
        unsigned short tmp = gr_mem_surface.data[i];
        gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i];
        gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp;
    }
#endif

    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           vi.xres_virtual * vi.yres * PIXEL_SIZE);

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:andyvand,项目名称:android_device_samsung_golden_anv,代码行数:26,代码来源:twrp-graphics.c

示例4: gr_flip

void gr_flip(void)
{
    if (has_overlay) {
        // Allocate overly. It'll exit early if overlay already
        // allocated and allocate it if not already allocated.
        allocate_overlay(gr_fb_fd, gr_framebuffer);
        if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data,
                                     (fi.line_length * vi.yres)) < 0) {
            // Free overlay in failure case
            free_overlay(gr_fb_fd);
        }
    } else {
        GGLContext *gl = gr_context;

        /* swap front and back buffers */
        if (double_buffering)
            gr_active_fb = (gr_active_fb + 1) & 1;

        /* copy data from the in-memory surface to the buffer we're about
         * to make active. */
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               fi.line_length * vi.yres);

        /* inform the display driver */
        set_active_framebuffer(gr_active_fb);
    }
}
开发者ID:qinzuoze,项目名称:recovery-philz-changyu,代码行数:27,代码来源:graphics.c

示例5: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;
    
        /* currently active buffer becomes the backbuffer */
    gl->colorBuffer(gl, gr_framebuffer + gr_active_fb);

        /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;

        /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:13,代码来源:graphics.c

示例6: gr_init

int gr_init(void)
{
    gglInit(&gr_context);
    GGLContext *gl = gr_context;

    gr_init_font();
    gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if (gr_vt_fd < 0) {
        // This is non-fatal; post-Cupcake kernels don't have tty0.
    } else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
        // However, if we do open tty0, we expect the ioctl to work.
        perror("failed KDSETMODE to KD_GRAPHICS on tty0");
        gr_exit();
        return -1;
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    if (gr_fb_fd < 0) {
        perror("Unable to get framebuffer.\n");
        gr_exit();
        return -1;
    }

    get_memory_surface(&gr_mem_surface);

    fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
            gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);

    /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    if (!has_overlay)
        set_active_framebuffer(0);
    gl->colorBuffer(gl, &gr_mem_surface);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

#ifdef TW_SCREEN_BLANK_ON_BOOT
    printf("TW_SCREEN_BLANK_ON_BOOT := true\n");
    gr_fb_blank(true);
    gr_fb_blank(false);
#endif

    if (!alloc_ion_mem(fi.line_length * vi.yres))
        allocate_overlay(gr_fb_fd, gr_framebuffer);

    return 0;
}
开发者ID:bju2000,项目名称:device_zopo_zp999,代码行数:49,代码来源:graphics.twrp.c

示例7: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;

#ifdef SCREEN_PORTRAIT
	int x, y;
	/* rotate 90
	for (x = 0; x < gr_mem_surface.width; x++) {
		for (y = 0; y < gr_mem_surface.height; y++) {
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * x + gr_mem_surface.height - y) * 2 - 2) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2); 
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * x + gr_mem_surface.height - y) * 2 - 1) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2 + 1); 
		}
	}
	*/

	/* rotate 270 */
	/*
	for (x = 0; x < gr_mem_surface.width; x++) {
		for (y = 0; y < gr_mem_surface.height; y++) {
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * (gr_mem_surface.width - x) + y) * 2 - 2) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2); 
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * (gr_mem_surface.width - x) + y) * 2 - 1) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2 + 1); 
		}
	}
	*/
	for (x = 0; x < gr_mem_surface.width; x++) {
		for (y = 0; y < gr_mem_surface.height; y++) {
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * (gr_mem_surface.width - x - 1) + y) * 2) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2); 
			*(gr_framebuffer[gr_active_fb].data + (gr_mem_surface.height * (gr_mem_surface.width - x - 1) + y) * 2 + 1) 
				= *(gr_mem_surface.data + (gr_mem_surface.width * y + x) * 2 + 1); 
		}
	}
#else
    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           vi.xres * vi.yres * 2);
#endif

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:zenki2001cn,项目名称:SnippetCode,代码行数:49,代码来源:graphics.c

示例8: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;

    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           fi.line_length * vi.yres);

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:playfulgod,项目名称:cm9_device_u8120,代码行数:15,代码来源:recovery_graphics.c

示例9: main

int main(int argc, char *argv[])
{
    time_t start = time(NULL);

    printf("Starting recovery on %s", ctime(&start));

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    if (gr_fb_fd < 0) {
        return -1;
    }

    get_memory_surface(&gr_mem_surface);

	 typedef unsigned short pixel;
	 pixel* dst = gr_framebuffer[gr_active_fb].data;
	 pixel* src = gr_mem_surface.data;
	 int i,j;
	switch(ROTATE){
		case ROTATE_90:
					for(i = 0;i < vi.yres;i++) {
						for(j = 0;j < vi.xres;j++) {
							dst[i * vi.xres + vi.xres - 1 - j] = src[i + j * vi.yres];
						}
					}
			break;
		case  ROTATE_270:
			for(i = 0;i < vi.yres;i++) {
				for(j = 0;j < vi.xres;j++) {
					dst[(vi.yres -1 - i) * vi.xres + j] = src[i + j * vi.yres];
				}
			}
			break;
		default://0
			memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
				  vi.xres * vi.yres * 2);
			break;
	}
	set_active_framebuffer(0);
	ioctl(gr_fb_fd, FBIOPAN_DISPLAY, &vi);

exit:
	munmap(gr_framebuffer[0].data, vi.yres * vi.xres * 2);
	munmap(gr_framebuffer[1].data, vi.yres * vi.xres * 2);
	munmap(recovery_ebc_buffer_base, recovery_ebc_buffer_len);
	close(gr_fb_fd);
	close(recovery_ebc_fd);
	return 0;
}
开发者ID:chengdongdong,项目名称:codes,代码行数:48,代码来源:disfb.c

示例10: gr_flip

void gr_flip(void)
{
    if (-EINVAL == overlay_display_frame(gr_fb_fd, gr_mem_surface.data,
                                         (fi.line_length * vi.yres))) {
        GGLContext *gl = gr_context;

        /* swap front and back buffers */
        if (double_buffering)
            gr_active_fb = (gr_active_fb + 1) & 1;

        /* copy data from the in-memory surface to the buffer we're about
         * to make active. */
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               vi.xres_virtual * vi.yres * PIXEL_SIZE);

        /* inform the display driver */
        set_active_framebuffer(gr_active_fb);
    }
}
开发者ID:bju2000,项目名称:device_zopo_zp999,代码行数:19,代码来源:graphics.twrp.c

示例11: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    if (double_buffering)
        gr_active_fb = (gr_active_fb + 1) & 1;

    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           fi.line_length * vi.yres);
#ifdef BOARD_HAS_FLIPPED_SCREEN
    rk_rotate_surface_180(&gr_framebuffer[gr_active_fb]);
#endif

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:ccfrom,项目名称:test,代码行数:19,代码来源:graphics.c

示例12: gr_flip

void gr_flip(void)
{
    if (has_overlay) {
        // Allocate overly. It'll exit early if overlay already
        // allocated and allocate it if not already allocated.
        allocate_overlay(gr_fb_fd, gr_framebuffer);
        if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data,
                                     (fi.line_length * vi.yres)) < 0) {
            // Free overlay in failure case
            free_overlay(gr_fb_fd);
        }
    } else {
        GGLContext *gl = gr_context;

        /* swap front and back buffers */
        if (double_buffering)
            gr_active_fb = (gr_active_fb + 1) & 1;

#ifdef BOARD_HAS_FLIPPED_SCREEN
        /* flip buffer 180 degrees for devices with physicaly inverted screens */
        unsigned int i;
        unsigned int j;
        uint8_t tmp;
        vi.xres_virtual = fi.line_length / PIXEL_SIZE;
        for (i = 0; i < ((vi.xres_virtual * vi.yres)/2); i++) {
            for (j = 0; j < PIXEL_SIZE; j++) {
                tmp = gr_mem_surface.data[i * PIXEL_SIZE + j];
                gr_mem_surface.data[i * PIXEL_SIZE + j] = gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j];
                gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j] = tmp;
            }
        }
#endif

        /* copy data from the in-memory surface to the buffer we're about
         * to make active. */
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               fi.line_length * vi.yres);

        /* inform the display driver */
        set_active_framebuffer(gr_active_fb);
    }
}
开发者ID:qinzuoze,项目名称:recovery-philz-changyu,代码行数:42,代码来源:graphics_cn.c

示例13: gr_init

int gr_init(void)
{
    GGLContext *gl;
    int fd;

    gglInit(&gr_context);
    gl = gr_context;

    gr_init_font();

    fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if(fd < 0) return -1;

    if(ioctl(fd, KDSETMODE, (void*) KD_GRAPHICS)) {
        close(fd);
        return -1;
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    
    if(gr_fb_fd < 0) {
        ioctl(fd, KDSETMODE, (void*) KD_TEXT);
        close(fd);
        return -1;
    }

    gr_vt_fd = fd;

        /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    set_active_framebuffer(0);
    gl->colorBuffer(gl, gr_framebuffer + 1);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

    return 0;
}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:39,代码来源:graphics.c

示例14: gr_flip

void gr_flip(void)
{
    if (has_overlay) {
        // Allocate overly. It'll exit early if overlay already
        // allocated and allocate it if not already allocated.
        allocate_overlay(gr_fb_fd, gr_framebuffer);
        if (overlay_display_frame(gr_fb_fd,gr_mem_surface.data,
                                     (fi.line_length * vi.yres)) < 0) {
            // Free overlay in failure case
            free_overlay(gr_fb_fd);
        }
    } else {
        GGLContext *gl = gr_context;

        /* swap front and back buffers */
        if (double_buffering)
            gr_active_fb = (gr_active_fb + 1) & 1;
        /*PERSONAL MOD FOR FLIPPED SCREN like Unite2 */
    #ifdef BOARD_HAS_FLIPPED_SCREEN
        /* flip buffer 180 degrees for devices with physicaly inverted screens */
        unsigned int i;
        for (i = 1; i < (vi.xres * vi.yres); i++) {
             unsigned short tmp = gr_mem_surface.data[i];
             gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i];
             gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp;
         }
    #endif

        /* copy data from the in-memory surface to the buffer we're about
         * to make active. */
        memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
               fi.line_length * vi.yres);

        /* inform the display driver */
        set_active_framebuffer(gr_active_fb);
    }
}
开发者ID:fjy2003,项目名称:android_bootable_recovery-1,代码行数:37,代码来源:graphics.c

示例15: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;

    /* swap front and back buffers */
    if (double_buffering)
        gr_active_fb = (gr_active_fb + 1) & 1;

    /* flip buffer 180 degrees for devices with physicaly inverted screens */
    /*unsigned int i;
    for (i = 1; i < (vi.xres * vi.yres); i++) {
        unsigned short tmp = gr_mem_surface.data[i];
        gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i];
        gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp;
    }*/

    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           fi.line_length * vi.yres);

    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:lenkyun,项目名称:android_device_zte_v817,代码行数:24,代码来源:graphics.c


注:本文中的set_active_framebuffer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。