• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_active_framebuffer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;
    int j,k;
    unsigned fb_lineLength = vi.xres_virtual * 2;
    unsigned mem_surface_lineLength = vi.xres * 2;
    void *d = NULL;
    void *s = gr_mem_surface.data;
	unsigned int width = vi.xres_virtual;
	unsigned int height = vi.yres;
    /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;
    d = gr_framebuffer[gr_active_fb].data;
    /* copy data from the in-memory surface to the buffer we're about
     * to make active. */

	if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3))
	{
		unsigned int l;
		unsigned short *s_temp;
		unsigned short *d_temp;

		s_temp = (unsigned short*)s;
		for (j=0; j<width; j++){
	  		for (k=0, l=height-1; k<height; k++, l--)
	    	{
				d_temp = d + ((width * l + j) << 1);
				*d_temp = *s_temp++;
	    	}
		}
	}
	else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2))
	{
		unsigned int l;
		unsigned short *s_temp;
		unsigned short *d_temp;

		s_temp = (unsigned short*)s;
		for (j=width - 1; j>=0; j--){
	  		for (k=0, l=0; k<height; k++, l++)
	    	{
				d_temp = d + ((width * l + j) << 1);
				*d_temp = *s_temp++;
	    	}
		}
	}
	else{
    	for (j = 0; j < vi.yres; ++ j)
    	{
        	memcpy(d, s, mem_surface_lineLength);
			d += fb_lineLength;
			s += mem_surface_lineLength;
    	}
	}
/*
    memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
           vi.xres * vi.yres * 2);
*/
    /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:61,代码来源:graphics.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_add函数代码示例发布时间:2022-05-30
下一篇:
C++ set_active函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap