本文整理汇总了C++中IDirectFBSurface::Unlock方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::Unlock方法的具体用法?C++ IDirectFBSurface::Unlock怎么用?C++ IDirectFBSurface::Unlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::Unlock方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static int
DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch)
{
Uint32 sdl_format;
unsigned char* laypixels;
int laypitch;
DFBSurfacePixelFormat dfb_format;
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
IDirectFBSurface *winsurf = data->target;
DirectFB_ActivateRenderer(renderer);
winsurf->GetPixelFormat(winsurf, &dfb_format);
sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch);
laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
SDL_ConvertPixels(rect->w, rect->h,
sdl_format, laypixels, laypitch,
format, pixels, pitch);
winsurf->Unlock(winsurf);
return 0;
}
示例2: Display
static void Display(vout_display_t *vd, picture_t *picture)
{
vout_display_sys_t *sys = vd->sys;
IDirectFBSurface *primary = sys->primary;
void *pixels;
int pitch;
if (primary->Lock(primary, DSLF_WRITE, &pixels, &pitch) == DFB_OK) {
picture_resource_t rsc;
memset(&rsc, 0, sizeof(rsc));
rsc.p[0].p_pixels = pixels;
rsc.p[0].i_lines = sys->height;
rsc.p[0].i_pitch = pitch;
picture_t *direct = picture_NewFromResource(&vd->fmt, &rsc);
if (direct) {
picture_Copy(direct, picture);
picture_Release(direct);
}
if (primary->Unlock(primary) == DFB_OK)
primary->Flip(primary, NULL, 0);
}
picture_Release(picture);
}
示例3: DirectFB_UnlockYUVOverlay
void DirectFB_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay)
{
IDirectFBSurface *surface = overlay->hwdata->surface;
overlay->pixels[0] = overlay->pixels[1] = overlay->pixels[2] = NULL;
surface->Unlock (surface);
}
示例4:
static void
directfb_commit_strip (struct bitmap *bmp, int top, int lines)
{
IDirectFBSurface *surface = bmp->flags;
surface->Unlock (surface);
bmp->data = NULL;
}
示例5: surface_unlock
static mrb_value surface_unlock(mrb_state *mrb, mrb_value self)
{
IDirectFBSurface* surface = mrb_directfb_surface(mrb, self);
DFBResult ret = -1;
if (surface != NULL) {
ret = surface->Unlock(surface);
}
return mrb_fixnum_value(ret);
}
示例6: 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;
}
示例7: unlockSurface
void QDirectFBPaintDevice::unlockSurface()
{
if (QDirectFBScreen::instance() && lockFlgs) {
#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *surface = subSurface;
#else
IDirectFBSurface *surface = dfbSurface;
#endif
if (surface) {
surface->Unlock(surface);
lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
mem = 0;
}
}
}
示例8: 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
}
示例9: print_usage
//.........这里部分代码省略.........
dest->GetPixelFormat( dest, &desc.pixelformat );
D_INFO( "DFBTest/PreAlloc: Destination is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a preallocated surface. */
desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS | DSDESC_PREALLOCATED;
desc.width = 100;
desc.height = 100;
desc.pixelformat = DSPF_ARGB;
desc.caps = static_caps;
desc.preallocated[0].data = pixel_buffer;
desc.preallocated[0].pitch = 100 * 4;
ret = dfb->CreateSurface( dfb, &desc, &source );
if (ret) {
D_DERROR( ret, "DFBTest/PreAlloc: IDirectFB::CreateSurface() for the preallocated source failed!\n" );
goto out;
}
/* Before any other operation the pixel data can be written to without locking */
gen_pixels( pixel_buffer, 100 * 4, 100 );
while (!quit) {
void *ptr;
int pitch;
/* Lock source surface for writing before making updates to the pixel buffer */
source->Lock( source, DSLF_WRITE, &ptr, &pitch );
if (ptr == pixel_buffer)
D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave original preallocated pixel buffer :-)\n" );
else {
if (static_caps)
D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave different pixel buffer, ERROR with static alloc!\n" );
else
D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave different pixel buffer, but OK (no static alloc)\n" );
}
update_pixels( ptr, pitch, 100 );
/* Unlock source surface after writing, before making further Blits,
to have the buffer be transfered to master again */
source->Unlock( source );
dest->Clear( dest, 0, 0, 0, 0xff );
/* First Blit from preallocated source, data will be transfered to master */
dest->Blit( dest, source, NULL, 50, 50 );
/* Second Blit from preallocated source, data is already master */
dest->Blit( dest, source, NULL, 150, 150 );
dest->Flip( dest, NULL, DSFLIP_NONE );
/* This will upload again the preallocated buffer to the master, where it is
modified and outdates the preallocated buffer. Now it depends on the static
alloc flag whether the next Lock will directly go into the shared memory
allocation or the preallocated buffer again (with a transfer back from master
to us). */
source->FillRectangle( source, 0, 0, 10, 10 );
/* Process keybuffer */
while (keybuffer->GetEvent( keybuffer, DFB_EVENT(&evt)) == DFB_OK)
{
if (evt.type == DIET_KEYPRESS) {
switch (DFB_LOWER_CASE(evt.key_symbol)) {
case DIKS_ESCAPE:
case DIKS_SMALL_Q:
case DIKS_BACK:
case DIKS_STOP:
case DIKS_EXIT:
/* Quit main loop & test thread */
quit = true;
break;
default:
break;
}
}
}
if (!quit)
sleep( 5 );
}
out:
if (source)
source->Release( source );
if (dest)
dest->Release( dest );
keybuffer->Release( keybuffer );
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}