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


C++ SurfacePtr类代码示例

本文整理汇总了C++中SurfacePtr的典型用法代码示例。如果您正苦于以下问题:C++ SurfacePtr类的具体用法?C++ SurfacePtr怎么用?C++ SurfacePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SurfacePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: new

void
Canvas::draw_surface_batch(const SurfacePtr& surface,
                           std::vector<Rectf> srcrects,
                           std::vector<Rectf> dstrects,
                           std::vector<float> angles,
                           const Color& color,
                           int layer)
{
  if (!surface) return;

  auto request = new(m_obst) TextureRequest();

  request->type = TEXTURE;
  request->layer = layer;
  request->flip = m_context.transform().flip ^ surface->get_flip();
  request->alpha = m_context.transform().alpha;
  request->color = color;

  request->srcrects = std::move(srcrects);
  request->dstrects = std::move(dstrects);
  request->angles = std::move(angles);

  for (auto& dstrect : request->dstrects)
  {
    dstrect = Rectf(apply_translate(dstrect.p1()), dstrect.get_size());
  }

  request->texture = surface->get_texture().get();
  request->displacement_texture = surface->get_displacement_texture().get();

  m_requests.push_back(request);
}
开发者ID:HybridDog,项目名称:supertux,代码行数:32,代码来源:canvas.cpp

示例2: assert

void
DrawingContext::draw_surface(SurfacePtr surface, const Vector& position,
                             float angle, const Color& color, const Blend& blend,
                             int layer)
{
  assert(surface != 0);

  DrawingRequest* request = new(obst) DrawingRequest();

  request->target = target;
  request->type = SURFACE;
  request->pos = transform.apply(position);

  if(request->pos.x >= SCREEN_WIDTH || request->pos.y >= SCREEN_HEIGHT
     || request->pos.x + surface->get_width() < 0
     || request->pos.y + surface->get_height() < 0)
    return;

  request->layer = layer;
  request->drawing_effect = transform.drawing_effect;
  request->alpha = transform.alpha;
  request->angle = angle;
  request->color = color;
  request->blend = blend;

  SurfaceRequest* surfacerequest = new(obst) SurfaceRequest();
  surfacerequest->surface = surface.get();
  request->request_data = surfacerequest;

  requests->push_back(request);
}
开发者ID:amigadave,项目名称:supertux,代码行数:31,代码来源:drawing_context.cpp

示例3: eglBindTexImage

// Retarget the current texture to the specified surface buffer.
EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
  EGL_API_ENTRY("%p, %p, %d", dpy, surface, buffer);
  EglDisplayImpl* display = EglDisplayImpl::GetDisplay(dpy);
  if (display == NULL || display->IsInitialized() == false) {
    SetError(EGL_BAD_DISPLAY);
    return EGL_FALSE;
  }
  SurfacePtr s = display->GetSurfaces().Get(surface);
  if (s == NULL) {
    SetError(EGL_BAD_SURFACE);
    return EGL_FALSE;
  }
  if (buffer != EGL_BACK_BUFFER) {
    SetError(EGL_BAD_PARAMETER);
    return EGL_FALSE;
  }
  if (s->GetTextureFormat() == EGL_NO_TEXTURE) {
    SetError(EGL_BAD_MATCH);
    return EGL_FALSE;
  }
  if (!(s->GetSurfaceType() & EGL_PBUFFER_BIT)) {
    SetError(EGL_BAD_SURFACE);
    return EGL_FALSE;
  }
  s->BindTexImage();
  return EGL_TRUE;
}
开发者ID:epowers,项目名称:arc,代码行数:28,代码来源:api_entries.cpp

示例4: eglGetCurrentSurface

EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) {
    if (!EglValidate::surfaceTarget(readdraw)) {
        return EGL_NO_SURFACE;
    }

    ThreadInfo* thread = getThreadInfo();
    EglDisplay* dpy    = static_cast<EglDisplay*>(thread->eglDisplay);
    ContextPtr  ctx    = thread->eglContext;

    if(dpy && ctx.Ptr()) {
        SurfacePtr surface = readdraw == EGL_READ ? ctx->read() : ctx->draw();
        if(surface.Ptr())
        {
            // This double check is required because a surface might still be
            // current after it is destroyed - in which case its handle should
            // be invalid, that is EGL_NO_SURFACE should be returned even
            // though the surface is current.
            EGLSurface s = (EGLSurface)SafePointerFromUInt(surface->getHndl());
            surface = dpy->getSurface(s);
            if(surface.Ptr())
            {
                return s;
            }
        }
    }
    return EGL_NO_SURFACE;
}
开发者ID:Dorahe,项目名称:platform_external_qemu,代码行数:27,代码来源:EglImp.cpp

示例5: SwapBuffers

EGLint EglDisplayImpl::SwapBuffers(EGLSurface egl_surface) {
  SurfacePtr sfc = surfaces_.Get(egl_surface);
  if (sfc == NULL) {
    return EGL_BAD_SURFACE;
  } else if (sfc->SwapBuffers()) {
    return EGL_SUCCESS;
  } else {
    return EGL_CONTEXT_LOST;
  }
}
开发者ID:epowers,项目名称:arc,代码行数:10,代码来源:egl_display_impl.cpp

示例6: eglDestroySurface

EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay display, EGLSurface surface) {
    VALIDATE_DISPLAY(display);
    SurfacePtr srfc = dpy->getSurface(surface);
    if(!srfc.Ptr()) {
        RETURN_ERROR(EGL_FALSE,EGL_BAD_SURFACE);
    }

    dpy->removeSurface(surface);
    return EGL_TRUE;
}
开发者ID:Dorahe,项目名称:platform_external_qemu,代码行数:10,代码来源:EglImp.cpp

示例7: eglBeginFrame

// Set the timestamp for the specified surface.
void eglBeginFrame(EGLDisplay dpy, EGLSurface surface) {
  EGL_API_ENTRY("%p, %p", dpy, surface);
  EglDisplayImpl* display = EglDisplayImpl::GetDisplay(dpy);
  if (display == NULL || display->IsInitialized() == false) {
    SetError(EGL_BAD_DISPLAY);
    return;
  }
  SurfacePtr s = display->GetSurfaces().Get(surface);
  if (s == NULL) {
    SetError(EGL_BAD_SURFACE);
    return;
  }
  const int64_t timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
  s->SetTimestamp(timestamp);
}
开发者ID:epowers,项目名称:arc,代码行数:16,代码来源:api_entries.cpp

示例8:

void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
	int i;
	int16 mouseX;
	int16 mouseY;
	MouseButtons buttons;
	SurfacePtr surface;
	SoundDesc samples[4];
	int16 comp[5] = { 0, 1, 2, 3, -1 };
	static const char *const sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"};

	surface = _vm->_video->initSurfDesc(320, 200);
	_vm->_video->drawPackedSprite("2ille.ims", *surface);
	_vm->_draw->_frontSurface->blit(*surface, 0, 0, 319, 199, 0, 0);
	_vm->_video->drawPackedSprite("2ille4.ims", *surface);
	_vm->_draw->_frontSurface->blit(*surface, 0, 0, 319, 199, 320, 0);
	_vm->_util->setScrollOffset(320, 0);
	_vm->_video->dirtyRectsAll();
	_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
	_vm->_util->longDelay(1000);
	for (i = 320; i >= 0; i--) {
		_vm->_util->setScrollOffset(i, 0);
		_vm->_video->dirtyRectsAll();
		if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) ||
				_vm->shouldQuit()) {
			_vm->_palAnim->fade(0, -2, 0);
			_vm->_draw->_frontSurface->clear();
			memset((char *)_vm->_draw->_vgaPalette, 0, 768);
			WRITE_VAR(4, buttons);
			WRITE_VAR(0, kKeyEscape);
			WRITE_VAR(57, (uint32) -1);
			break;
		}
	}
	if (!_vm->shouldQuit()) {
		_vm->_util->setScrollOffset(0, 0);
		_vm->_video->dirtyRectsAll();
	}
	surface.reset();
	if (VAR(57) == ((uint32) -1))
		return;

	for (i = 0; i < 4; i++)
		_vm->_sound->sampleLoad(&samples[i], SOUND_SND, sndFiles[i]);
	_vm->_sound->blasterPlayComposition(comp, 0, samples, 4);
	_vm->_sound->blasterWaitEndPlay(true, false);
	_vm->_palAnim->fade(0, 0, 0);
	_vm->_draw->_frontSurface->clear();
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:48,代码来源:inter_bargon.cpp

示例9: txt

    void TtFontAsset::RenderText( SurfacePtr dest, int& x, int& y, const char* text, const pei::Color& color /*= pei::XColor(255,255,255)*/ )
    {
        //     assert ( pFont );
        if (!m_TtFont || dest.get() == NULL ) {
            return;
        }
#ifdef _HAS_SDL_TTF_
        SDL_Surface *text_surface = NULL;
        // this is a hack! We swap r & g and correct the color format manually
        // SDL_ttf renders ARGB, but we need ABGR (or LE RGBA) to match RGBA texture format - performace reasons!
        SDL_Color c = { color.b, color.g, color.r, color.a };
        if ( (text_surface = TTF_RenderText_Blended( (TTF_Font*)m_TtFont->GetFontHandle(), text, c )) != NULL )
        {
            // swap r&g in the format description
            text_surface->format->Rmask = 0x000000ff; text_surface->format->Rshift = 0;
            text_surface->format->Bmask = 0x00ff0000; text_surface->format->Bshift = 16;

        	pei::SurfacePtr txt( new pei::SDL::SurfaceWrapper(text_surface));
            pei::Blitter blitter(pei::PixOpPtr(new PixOpAlphaBlitSrcAlpha(txt->GetFormat(),dest->GetFormat()) ) );
            blitter.Blit( txt, dest, x, y, txt->GetWidth(), txt->GetHeight(), 0, 0 );

            int tw, th;
            TTF_SizeText( (TTF_Font*)m_TtFont->GetFontHandle(), text, &tw, &th);

            Uint32 font_height = TTF_FontHeight((TTF_Font*)m_TtFont->GetFontHandle()); // - a - 2*d;
            y += font_height;
            x += tw;
        }
#endif
    }
开发者ID:juergen0815,项目名称:PEngIneLite,代码行数:30,代码来源:tt_font_asset.cpp

示例10: eglPresentationTimeANDROID

EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface surface,
                                      EGLnsecsANDROID time) {
  EGL_API_ENTRY("%p, %p, %lld", dpy, surface, time);
  EglDisplayImpl* display = EglDisplayImpl::GetDisplay(dpy);
  if (display == NULL || display->IsInitialized() == false) {
    SetError(EGL_BAD_DISPLAY);
    return EGL_FALSE;
  }
  SurfacePtr s = display->GetSurfaces().Get(surface);
  if (s == NULL) {
    SetError(EGL_BAD_SURFACE);
    return EGL_FALSE;
  }
  s->SetTimestamp(time);
  return EGL_TRUE;
}
开发者ID:epowers,项目名称:arc,代码行数:16,代码来源:api_entries.cpp

示例11: eglGetCurrentSurface

// Get the surface associated with the current rendering context.
EGLSurface eglGetCurrentSurface(EGLint readdraw) {
  EGL_API_ENTRY("0x%x", readdraw);
  if (readdraw != EGL_READ && readdraw != EGL_DRAW) {
    SetError(EGL_BAD_PARAMETER);
    return EGL_NO_SURFACE;
  }
  ContextPtr context = GetContext();
  if (context == NULL) {
    return EGL_NO_SURFACE;
  }
  SurfacePtr surface = context->GetSurface();
  if (surface == NULL) {
    return EGL_NO_SURFACE;
  }
  return surface->GetKey();
}
开发者ID:epowers,项目名称:arc,代码行数:17,代码来源:api_entries.cpp

示例12: Rectf

void
Canvas::draw_surface_scaled(const SurfacePtr& surface, const Rectf& dstrect,
                            int layer, const PaintStyle& style)
{
  draw_surface_part(surface, Rectf(0.0f, 0.0f, static_cast<float>(surface->get_width()), static_cast<float>(surface->get_height())),
                    dstrect, layer, style);
}
开发者ID:HybridDog,项目名称:supertux,代码行数:7,代码来源:canvas.cpp

示例13: derive

ImagePtr VaapiImage::derive(const SurfacePtr& surface)
{
    ImagePtr image;
    if (!surface)
        return image;

    DisplayPtr display = surface->getDisplay();
    VAImagePtr vaImage(new VAImage);

    VAStatus status = vaDeriveImage(display->getID(), surface->getID(), vaImage.get());
    if (!checkVaapiStatus(status, "vaDeriveImage()")) {
        return image;
    }
    image.reset(new VaapiImage(display, surface, vaImage));
    return image;

}
开发者ID:TangXinT,项目名称:libyami,代码行数:17,代码来源:vaapiimage.cpp

示例14: warning

void Inter_v7::o7_loadImage() {
	Common::String file = _vm->_game->_script->evalString();
	if (!file.contains('.'))
		file += ".TGA";

	int16 spriteIndex = _vm->_game->_script->readValExpr();
	int16 left        = _vm->_game->_script->readValExpr();
	int16 top         = _vm->_game->_script->readValExpr();
	int16 width       = _vm->_game->_script->readValExpr();
	int16 height      = _vm->_game->_script->readValExpr();
	int16 x           = _vm->_game->_script->readValExpr();
	int16 y           = _vm->_game->_script->readValExpr();
	int16 transp      = _vm->_game->_script->readValExpr();

	if (spriteIndex > 100)
		spriteIndex -= 80;

	if ((spriteIndex < 0) || (spriteIndex >= Draw::kSpriteCount)) {
		warning("o7_loadImage(): Sprite %d out of range", spriteIndex);
		return;
	}

	SurfacePtr destSprite = _vm->_draw->_spritesArray[spriteIndex];
	if (!destSprite) {
		warning("o7_loadImage(): Sprite %d does not exist", spriteIndex);
		return;
	}

	Common::SeekableReadStream *imageFile = _vm->_dataIO->getFile(file);
	if (!imageFile) {
		warning("o7_loadImage(): No such file \"%s\"", file.c_str());
		return;
	}

	SurfacePtr image = _vm->_video->initSurfDesc(1, 1);
	if (!image->loadImage(*imageFile)) {
		warning("o7_loadImage(): Failed to load image \"%s\"", file.c_str());
		return;
	}

	int16 right  = left + width  - 1;
	int16 bottom = top  + height - 1;
	destSprite->blit(*image, left, top, right, bottom, x, y, transp);
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:44,代码来源:inter_v7.cpp

示例15: createPicture

bool VaapiDecoderVP8::allocNewPicture()
{
    m_currentPicture = createPicture(m_currentPTS);

    if (!m_currentPicture)
        return false;

    SurfacePtr surface = m_currentPicture->getSurface();
    ASSERT(m_frameWidth && m_frameHeight);
    if (!surface->resize(m_frameWidth, m_frameHeight)) {
        ASSERT(0 && "frame size is bigger than internal surface resolution");
        return false;
    }

    DEBUG ("alloc new picture: %p with surface ID: %x",
         m_currentPicture.get(), m_currentPicture->getSurfaceID());

    return true;
}
开发者ID:01org,项目名称:libyami,代码行数:19,代码来源:vaapidecoder_vp8.cpp


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