本文整理汇总了C++中SurfacePtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfacePtr::reset方法的具体用法?C++ SurfacePtr::reset怎么用?C++ SurfacePtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfacePtr
的用法示例。
在下文中一共展示了SurfacePtr::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSurface
SurfacePtr VaapiEncoderBase::createSurface(VideoEncRawBuffer* inBuffer)
{
SurfacePtr surface = createSurface();
if (!surface)
return surface;
VaapiImage* image = surface->getDerivedImage();
if (!image) {
ERROR("surface->getDerivedImage() failed");
surface.reset();
return surface;
}
VaapiImageRaw* raw = image->map();
if (!raw) {
ERROR("image->map() failed");
surface.reset();
return surface;
}
assert(inBuffer->size == raw->width * raw->height * 3 / 2);
uint8_t* src = inBuffer->data;
uint8_t* dest = raw->pixels[0];
for (int i = 0; i < raw->height; i++) {
memcpy(dest, src, raw->width);
dest += raw->strides[0];
src += raw->width;
}
dest = raw->pixels[1];
for (int i = 0; i < raw->height/2; i++) {
memcpy(dest, src, raw->width);
dest += raw->strides[1];
src += raw->width;
}
return surface;
}
示例2:
void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) {
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();
}
示例3: createSprite
SurfacePtr TempSpriteHandler::createSprite(int16 dataVar, int32 size, int32 offset) {
SurfacePtr sprt;
// Sprite requested?
if (!isSprite(size))
return sprt;
// Index sane?
int index = getIndex(size);
if ((index < 0) || (index >= Draw::kSpriteCount))
return sprt;
// Sprite exists?
if (!(sprt = _vm->_draw->_spritesArray[index]))
return sprt;
if (!create(sprt->getWidth(), sprt->getHeight(), sprt->getBPP() > 1))
sprt.reset();
return sprt;
}
示例4: create
SurfacePtr VaapiSurface::create(const DisplayPtr& display,
VaapiChromaType chromaType,
uint32_t width,
uint32_t height,
void *surfAttribArray,
uint32_t surfAttribNum)
{
VAStatus status;
uint32_t format, i;
VASurfaceAttrib *surfAttribs = (VASurfaceAttrib *) surfAttribArray;
SurfacePtr surface;
VASurfaceID id;
assert((surfAttribs && surfAttribNum)
|| (!surfAttribs && !surfAttribNum));
format = vaapiChromaToVaChroma(chromaType);
uint32_t externalBufHandle = 0;
status = vaCreateSurfaces(display->getID(), format, width, height,
&id, 1, surfAttribs, surfAttribNum);
if (!checkVaapiStatus(status, "vaCreateSurfacesWithAttribute()"))
return surface;
for (int i = 0; i < surfAttribNum; i++) {
if (surfAttribs[i].type == VASurfaceAttribExternalBufferDescriptor) {
VASurfaceAttribExternalBuffers *surfAttribExtBuf
=
(VASurfaceAttribExternalBuffers *) surfAttribs[i].value.
value.p;
externalBufHandle = surfAttribExtBuf->buffers[0];
break;
}
}
surface.reset(new VaapiSurface(display, id, chromaType,
width, height,externalBufHandle));
return surface;
}
示例5: acquireWithWait
SurfacePtr VaapiDecSurfacePool::acquireWithWait()
{
SurfacePtr surface;
AutoLock lock(m_lock);
if (m_flushing) {
ERROR("uppper layer bug, only support flush in decode thread");
return surface;
}
while (m_freed.empty())
m_cond.wait();
if (m_flushing) {
ERROR("uppper layer bug, only support flush in decode thread");
return surface;
}
assert(!m_freed.empty());
VASurfaceID id = m_freed.front();
m_freed.pop_front();
m_allocated[id] = SURFACE_DECODING;
VaapiSurface* s = m_surfaceMap[id];
surface.reset(s, SurfaceRecycler(shared_from_this()));
return surface;
}