当前位置: 首页>>代码示例>>C++>>正文


C++ IDirectFBSurface::Unlock方法代码示例

本文整理汇总了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;
}
开发者ID:mgerhardy,项目名称:caveexpress,代码行数:26,代码来源:SDL_DirectFB_render.c

示例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);
}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:27,代码来源:directfb.c

示例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);
}
开发者ID:3bu1,项目名称:crossbridge,代码行数:8,代码来源:SDL_DirectFB_yuv.c

示例4:

static void
directfb_commit_strip (struct bitmap *bmp, int top, int lines)
{
  IDirectFBSurface *surface = bmp->flags;

  surface->Unlock (surface);
  bmp->data = NULL;
}
开发者ID:Gingar,项目名称:port,代码行数:8,代码来源:directfb.c

示例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);
}
开发者ID:uwitty,项目名称:mruby-directfb,代码行数:9,代码来源:surface.c

示例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;
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:50,代码来源:dfbtest_resize.c

示例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;
        }
    }
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:15,代码来源:qdirectfbpaintdevice.cpp

示例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
}
开发者ID:Audioniek,项目名称:Fortis-4G,代码行数:47,代码来源:glcore.c

示例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;
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:101,代码来源:dfbtest_prealloc.c


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