本文整理汇总了C++中SDL_VideoDevice::CheckHWBlit方法的典型用法代码示例。如果您正苦于以下问题:C++ SDL_VideoDevice::CheckHWBlit方法的具体用法?C++ SDL_VideoDevice::CheckHWBlit怎么用?C++ SDL_VideoDevice::CheckHWBlit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SDL_VideoDevice
的用法示例。
在下文中一共展示了SDL_VideoDevice::CheckHWBlit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDL_CalculateBlit
/* Figure out which of many blit routines to set up on a surface */
int SDL_CalculateBlit(SDL_Surface *surface)
{
int blit_index;
/* Clean everything out to start */
if ( (surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL ) {
SDL_UnRLESurface(surface, 1);
}
surface->map->sw_blit = NULL;
/* Figure out if an accelerated hardware blit is possible */
surface->flags &= ~SDL_HWACCEL;
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_CalculateBlit(): identity %d src hw %d dst hw %d video hw %d", (int)surface->map->identity, (int)(surface->flags & SDL_HWSURFACE), (int)(surface->map->dst->flags & SDL_HWSURFACE), (int)(current_video->info.blit_hw));
if ( surface->map->identity ) {
int hw_blit_ok;
if ( (surface->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
/* We only support accelerated blitting to hardware */
if ( surface->map->dst->flags & SDL_HWSURFACE ) {
hw_blit_ok = current_video->info.blit_hw;
} else {
hw_blit_ok = 0;
}
if (hw_blit_ok && (surface->flags & SDL_SRCCOLORKEY)) {
hw_blit_ok = current_video->info.blit_hw_CC;
}
if ( hw_blit_ok && (surface->flags & SDL_SRCALPHA) ) {
hw_blit_ok = current_video->info.blit_hw_A;
}
} else {
/* We only support accelerated blitting to hardware */
if ( surface->map->dst->flags & SDL_HWSURFACE ) {
hw_blit_ok = current_video->info.blit_sw;
} else {
hw_blit_ok = 0;
}
if (hw_blit_ok && (surface->flags & SDL_SRCCOLORKEY)) {
hw_blit_ok = current_video->info.blit_sw_CC;
}
if ( hw_blit_ok && (surface->flags & SDL_SRCALPHA) ) {
hw_blit_ok = current_video->info.blit_sw_A;
}
}
if ( hw_blit_ok ) {
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
video->CheckHWBlit(this, surface, surface->map->dst);
}
}
/* if an alpha pixel format is specified, we can accelerate alpha blits */
if (((surface->flags & SDL_HWSURFACE) == SDL_HWSURFACE )&&(current_video->displayformatalphapixel))
{
if ( (surface->flags & SDL_SRCALPHA) )
if ( current_video->info.blit_hw_A ) {
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
video->CheckHWBlit(this, surface, surface->map->dst);
}
}
/* Get the blit function index, based on surface mode */
/* { 0 = nothing, 1 = colorkey, 2 = alpha, 3 = colorkey+alpha } */
blit_index = 0;
blit_index |= (!!(surface->flags & SDL_SRCCOLORKEY)) << 0;
if ( surface->flags & SDL_SRCALPHA
&& (surface->format->alpha != SDL_ALPHA_OPAQUE
|| surface->format->Amask) ) {
blit_index |= 2;
}
/* Check for special "identity" case -- copy blit */
if ( surface->map->identity && blit_index == 0 ) {
surface->map->sw_data->blit = SDL_BlitCopy;
/* Handle overlapping blits on the same surface */
if ( surface == surface->map->dst ) {
surface->map->sw_data->blit = SDL_BlitCopyOverlap;
}
} else {
if ( surface->format->BitsPerPixel < 8 ) {
surface->map->sw_data->blit =
SDL_CalculateBlit0(surface, blit_index);
} else {
switch ( surface->format->BytesPerPixel ) {
case 1:
surface->map->sw_data->blit =
SDL_CalculateBlit1(surface, blit_index);
break;
case 2:
case 3:
case 4:
surface->map->sw_data->blit =
SDL_CalculateBlitN(surface, blit_index);
break;
default:
surface->map->sw_data->blit = NULL;
break;
}
//.........这里部分代码省略.........