/*
(c) Copyright 2000-2002 convergence integrated media GmbH.
(c) Copyright 2002 convergence GmbH.
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de> and
Sven Neumann <neo@directfb.org>.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <directfb.h>
#include <directfb_strings.h>
#include <directfb_util.h>
#include <direct/util.h>
#include <sys/time.h> /* for gettimeofday() */
#include <sys/times.h> /* for times() */
#include <stdio.h> /* for fprintf() */
#include <stdlib.h> /* for rand() */
#include <unistd.h> /* for sleep() */
#include <string.h> /* for strcmp() */
#include "pngtest3.h"
/* the super interface */
static IDirectFB *dfb;
/* the primary surface */
static IDirectFBSurface *primary;
static IDirectFBSurface *dest;
/* our "Press any key..." screen */
static IDirectFBSurface *intro;
/* some test images for blitting */
static IDirectFBSurface *cardicon;
static IDirectFBSurface *logo;
static IDirectFBSurface *simple;
static IDirectFBSurface *simple_ycbcr;
static IDirectFBSurface *colorkeyed;
static IDirectFBSurface *image32;
static IDirectFBSurface *image32a;
static IDirectFBSurface *image8a;
static IDirectFBSurface *image_lut;
static IDirectFBSurface *swirl;
static IDirectFBFont *bench_font;
static IDirectFBFont *ui_font;
static int stringwidth;
static int bench_fontheight;
static int ui_fontheight;
/* Media super interface and the provider for our images/font */
static IDirectFBImageProvider *provider;
/* Input interfaces: event buffer */
static IDirectFBEventBuffer *key_events;
static int SW, SH;
static int with_intro = 0;
static int selfrunning = 0;
static int do_system = 0;
static int do_offscreen = 0;
static int do_noaccel = 0;
static int show_results = 1;
static int mono_fonts = 0;
static int accel_only = 0;
static int do_dump = 0;
static int do_aa = 0;
static int do_matrix = 0;
static int do_smooth = 0;
static int do_xor = 0;
static int do_all_demos = 0;
/* some defines for benchmark test size and duration */
static int SX = 256;
static int SY = 256;
static int DEMOTIME = 3000; /* milliseconds */
static const char *fontfile = FONT;
static const char *imagefile;
static DFBSurfacePixelFormat pixelformat = DSPF_UNKNOWN;
static DFBSurfacePixelFormat imageformat = DSPF_UNKNOWN;
#define MAX(a,b) ((a) > (b) ? (a) : (b))
/* macro for a safe call to DirectFB functions */
#define DFBCHECK(x...) \
do { \
err = x; \
if (err != DFB_OK) { \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
} while (0)
#define SET_BLITTING_FLAGS( flags ) \
dest->SetBlittingFlags( dest, (flags) | (do_xor ? DSBLIT_XOR : 0) )
#define SET_DRAWING_FLAGS( flags ) \
dest->SetDrawingFlags( dest, (flags) | (do_xor ? DSDRAW_XOR : 0) )
/* the benchmarks */
static unsigned long long draw_string ( long t );
static unsigned long long draw_string_blend ( long t );
static unsigned long long fill_rect ( long t );
static unsigned long long fill_rect_blend ( long t );
static unsigned long long fill_rects ( long t );
static unsigned long long fill_rects_blend ( long t );
static unsigned long long fill_triangle ( long t );
static unsigned long long fill_triangle_blend ( long t );
static unsigned long long draw_rect ( long t );
static unsigned long long draw_rect_blend ( long t );
static unsigned long long draw_lines ( long t );
static unsigned long long draw_lines_blend ( long t );
static unsigned long long fill_spans ( long t );
static unsigned long long fill_spans_blend ( long t );
static unsigned long long blit ( long t );
static unsigned long long blit_mask ( long t );
static unsigned long long blit180 ( long t );
static unsigned long long blit_colorkeyed ( long t );
static unsigned long long blit_dst_colorkeyed ( long t );
static unsigned long long blit_convert ( long t );
static unsigned long long blit_colorize ( long t );
static unsigned long long blit_blend ( long t );
static unsigned long long blit_blend_colorize ( long t );
static unsigned long long blit_lut ( long t );
static unsigned long long blit_lut_blend ( long t );
static unsigned long long stretch_blit ( long t );
static unsigned long long stretch_blit_colorkeyed ( long t );
static unsigned long long stretch_blit_ycbcr ( long t );
static unsigned long long stretch_blit_indexed ( long t );
static unsigned long long load_dfiff ( long t );
static unsigned long long load_gif ( long t );
static unsigned long long load_jpeg ( long t );
static unsigned long long load_png ( long t );
static unsigned long long load_image ( long t );
typedef struct {
char desc[128];
char *message;
char *status;
char *option;
bool default_on;
int requested;
long result;
DFBBoolean accelerated;
char *unit;
unsigned long long (* func) ( long );
} Demo;
enum {
DEMO_LOAD_IMAGE,
DEMO_DRAWSTRING,
DEMO_DRAWSTRING_BLEND
};
static Demo demos[] = {
{ "Load Image",
"Loading image files!",
"Loading image files", "load-image <file>", false,
0, 0, 0, "MPixel/sec", load_image },
{ "Anti-aliased Text",
"This is the DirectFB benchmarking tool, let's start with some text!",
"Anti-aliased Text", "draw-string", true,
0, 0, 0, "KChars/sec", draw_string },
{ "Anti-aliased Text (blend)",
"Alpha blending based on color alpha",
"Alpha Blended Anti-aliased Text", "draw-string-blend", true,
0, 0, 0, "KChars/sec", draw_string_blend },
{ "Fill Rectangle",
"Ok, we'll go on with some opaque filled rectangles!",
"Rectangle Filling", "fill-rect", true,
0, 0, 0, "MPixel/sec", fill_rect },
{ "Fill Rectangle (blend)",
"What about alpha blended rectangles?",
"Alpha Blended Rectangle Filling", "fill-rect-blend", true,
0, 0, 0, "MPixel/sec", fill_rect_blend },
{ "Fill Rectangles [10]",
"Ok, we'll go on with some opaque filled rectangles!",
"Rectangle Filling", "f
没有合适的资源?快使用搜索试试~ 我知道了~
DirectFB-examples-1.2.2.tar.gz
需积分: 44 10 下载量 57 浏览量
2016-12-22
18:48:17
上传
评论
收藏 1.62MB GZ 举报
温馨提示
共109个文件
c:32个
png:32个
in:9个
DirectFB-examples-1.2.2.tar.gz 学习DirectDB 最好的code
资源推荐
资源详情
资源评论
收起资源包目录
DirectFB-examples-1.2.2.tar.gz (109个子文件)
Makefile.am 2KB
Makefile.am 683B
Makefile.am 346B
Makefile.am 309B
Makefile.am 238B
Makefile.am 226B
Makefile.am 207B
Makefile.am 58B
AUTHORS 106B
df_dok.c 58KB
ve.c 30KB
df_input.c 25KB
df_andi.c 19KB
df_fonts.c 18KB
df_matrix_water.c 16KB
df_window.c 14KB
df_matrix.c 13KB
df_fire.c 12KB
df_databuffer.c 12KB
df_video_particle.c 12KB
df_texture.c 11KB
main.c 10KB
df_layer.c 10KB
pss.c 10KB
df_neo.c 9KB
df_drivertest.c 9KB
df_netload.c 9KB
df_dioload.c 9KB
df_joystick.c 9KB
math3d.c 8KB
df_knuckles.c 8KB
df_cpuload.c 8KB
df_particle.c 7KB
df_bltload.c 7KB
df_video.c 7KB
df_porter.c 7KB
df_palette.c 5KB
df_stress.c 5KB
df_flip.c 5KB
matrix.c 3KB
ve_test.c 2KB
ChangeLog 60KB
configure 160KB
COPYING 1KB
depcomp 17KB
melted_rgb32.dfiff 64KB
melted_rgb16.dfiff 32KB
colorkeyed.gif 17KB
melted.gif 16KB
config.guess 44KB
pngtest3.h 100KB
skull.h 50KB
ve.h 7KB
util.h 5KB
math3d.h 2KB
matrix.h 905B
Makefile.in 29KB
Makefile.in 18KB
Makefile.in 16KB
Makefile.in 13KB
Makefile.in 13KB
Makefile.in 13KB
Makefile.in 10KB
Makefile.in 10KB
configure.in 1KB
INSTALL 9KB
install-sh 13KB
smokey_light.jpg 143KB
wood_andi.jpg 61KB
melted.jpg 22KB
background.jpg 22KB
aclocal.m4 38KB
missing 11KB
NEWS 0B
swirl.png 383KB
desktop.png 176KB
pngtest2.png 90KB
fish.png 57KB
texture.png 56KB
biglogo.png 40KB
pngtest.png 36KB
melted.png 33KB
shot.png 32KB
tux.png 24KB
pngtest3.png 22KB
intro.png 9KB
dfblogo.png 8KB
convergence.png 7KB
gnome-gsame.png 4KB
gnu-keys.png 4KB
apple-red.png 3KB
gnome-gimp.png 3KB
gnome-gmush.png 3KB
gnome-applets.png 3KB
gnome-foot.png 3KB
gnome-mouse.png 3KB
gnome-calendar.png 3KB
card.png 1KB
testmask.png 1KB
joystick.png 1KB
共 109 条
- 1
- 2
资源评论
独角鲸
- 粉丝: 23
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功