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


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

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

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


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