本文整理汇总了C++中IDirectFBSurface::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::Write方法的具体用法?C++ IDirectFBSurface::Write怎么用?C++ IDirectFBSurface::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
static void *
TestThread( DirectThread *thread,
void *arg )
{
DFBResult ret;
IDirectFBSurface *surface = arg;
DFBRectangle rect = { 0, 0, 500, 1 };
while (!quit) {
void *data;
int pitch;
ret = surface->Lock( surface, DSLF_WRITE, &data, &pitch );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: Lock() failed!\n" );
return NULL;
}
if (!data) {
D_DERROR( ret, "DFBTest/Resize:invalid pointer!\n" );
return NULL;
}
memset( data, 0, pitch * 400 );
surface->Unlock( surface );
data = malloc( pitch );
ret = surface->Read( surface, &rect, data, pitch );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: Read() failed!\n" );
free (data);
return NULL;
}
ret = surface->Write( surface, &rect, data, pitch );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: Write() failed!\n" );
free(data);
return NULL;
}
free(data);
}
return NULL;
}
示例2: glTexImage2D
//Hardcore translateion
void glTexImage2D (GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, const GLvoid *pixels)
{
#ifdef DEBUG
printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
#endif
IDirectFBSurface * surface = NULL;
EGLSurface egl_surface = NULL;
DFBResult err = 0;
DFBSurfaceDescription dsc;
CoreSurfaceBufferLock lock;
dsc.flags = (DFBSurfaceDescriptionFlags) (DSDESC_WIDTH | DSDESC_HEIGHT |
DSDESC_PIXELFORMAT | DSDESC_CAPS);
dsc.caps = DSCAPS_PREMULTIPLIED;
dsc.width = width;
dsc.height = height;
dsc.pixelformat = DSPF_ARGB;
m_dfb->CreateSurface(
m_dfb,
&dsc,
&surface);
#if 0
surface->Lock (surface, DSLF_WRITE, &lock.addr, &lock.pitch);
memcpy(lock.addr, pixels, width*height*4);
surface->Unlock (surface);
#else
DFBRectangle rect;
rect.x = 0;
rect.y = 0;
rect.w = width;
rect.h = height;
surface->Write(surface, &rect, pixels, 4*width);
#endif
egl_textures[m_bound_texture].surface = surface;
#ifdef DEBUG
printf("%s:%s[%d] ---------------- texture=%d (%p)\n", __FILE__, __func__, __LINE__, texturesCurrent, egl_textures[texturesCurrent].surface);
#endif
}