瀏覽代碼

egl: Add macros to define typecast functions.

There are standard typecast functions that are common to most drivers.
They are used to typecast, for example, an _EGLSurface to a
driver-defined type.

This commits define _EGL_DRIVER_STANDARD_TYPECASTS and
_EGL_DRIVER_TYPECAST that should hopefully save some typings for driver
writers.
tags/7.8-rc1
Chia-I Wu 15 年之前
父節點
當前提交
bdb9e202de
共有 1 個文件被更改,包括 21 次插入0 次删除
  1. 21
    0
      src/egl/main/egldriver.h

+ 21
- 0
src/egl/main/egldriver.h 查看文件

@@ -6,6 +6,27 @@
#include "eglapi.h"


/**
* Define an inline driver typecast function.
*/
#define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \
static INLINE struct drvtype *drvtype(const egltype *obj) \
{ return (struct drvtype *) code; }


/**
* Define the driver typecast functions for _EGLDriver, _EGLDisplay,
* _EGLContext, _EGLSurface, and _EGLConfig.
*/
#define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \
_EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \
/* note that this is not a direct cast */ \
_EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \
_EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \
_EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \
_EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj)


typedef _EGLDriver *(*_EGLMain_t)(const char *args);



Loading…
取消
儲存