Exemplo n.º 1
0
IImageProvider * ImagesProvider::create(const QString & source)
{
	if (PathIsDirectoryA(source.toStdString().c_str()) || IsSupported(source))
		return new ImagesProvider(source);
			
	return nullptr;
}
Exemplo n.º 2
0
/// Decode
///
/// @param archive Archive
///
bool Cef_first::Decode(CArcFile* archive)
{
	if (!IsSupported(archive))
		return false;

	return CPaz::Decode(archive);
}
TEST_F(TaggedControlOptionsTest, IsSupportedFalse) {
  bool supported = false;
  uint8_t value = 3;
  EXPECT_CALL(*mock_options_, IsSupported(value)).WillOnce(Return(supported));
  PrepareDUT();
  ASSERT_EQ(dut_->IsSupported(value), supported);
}
Exemplo n.º 4
0
ULONGLONG CGetCompressedFileSizeApi::GetCompressedFileSize(LPCTSTR lpFileName)
{
	ASSERT(IsSupported());
	ULARGE_INTEGER ret;
	ret.LowPart = (*m_GetCompressedFileSize)(lpFileName, &ret.HighPart);
	return ret.QuadPart;
}
Exemplo n.º 5
0
/**
 * Unbinds the framebuffer and deletes it
 */
FBO::~FBO()
{
	if (!IsSupported()) return;

	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
	for (std::vector<GLuint>::iterator ri=myRBOs.begin(); ri!=myRBOs.end(); ++ri) {
		glDeleteRenderbuffersEXT(1, &(*ri));
	}

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
	if (fboId)
		glDeleteFramebuffersEXT(1, &fboId);

	for (std::vector<FBO*>::iterator fi=fboList.begin(); fi!=fboList.end(); ++fi) {
		if (*fi==this) {
			fboList.erase(fi);
			break;
		}
	}

	// seems the application exits and we are the last fbo left
	// so we delete the remaining alloc'ed stuff
	if (fboList.empty()) {
		for (std::map<GLuint,FBO::TexData*>::iterator ti=texBuf.begin(); ti!=texBuf.end(); ++ti) {
			FBO::TexData* tex = ti->second;
			delete[] tex->pixels;
			delete tex;
		}
		texBuf.clear();
	}
}
Exemplo n.º 6
0
/**
 * @brief GLContextReinit
 */
void FBO::GLContextReinit()
{
	if (!IsSupported()) return;

	for (std::map<GLuint,FBO::TexData*>::iterator ti=texBuf.begin(); ti!=texBuf.end(); ++ti) {
		FBO::TexData* tex = ti->second;

		if (glIsTexture(tex->id)) {
			glBindTexture(tex->target,tex->id);
			//todo: regen mipmaps?
			switch (tex->target) {
				case GL_TEXTURE_3D:
					//glTexSubImage3D(tex->target, 0, 0,0,0, tex->xsize, tex->ysize, tex->zsize, /*FIXME?*/GL_RGBA, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
					glTexImage3D(tex->target, 0, tex->format, tex->xsize, tex->ysize, tex->zsize, 0, /*FIXME?*/GL_RGBA, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
					break;
				case GL_TEXTURE_1D:
					//glTexSubImage1D(tex->target, 0, 0, tex->xsize, /*FIXME?*/GL_RGBA, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
					glTexImage1D(tex->target, 0, tex->format, tex->xsize, /*FIXME?*/GL_RGBA, 0, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
					break;
				default: //GL_TEXTURE_2D & GL_TEXTURE_RECTANGLE
					//glTexSubImage2D(tex->target, 0, 0,0, tex->xsize, tex->ysize, /*FIXME?*/GL_RGBA, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
					glTexImage2D(tex->target, 0, tex->format, tex->xsize, tex->ysize, 0, /*FIXME?*/GL_RGBA, /*FIXME?*/GL_UNSIGNED_BYTE, tex->pixels);
			}
		}else if (glIsRenderbufferEXT(tex->id)) {
			//FIXME
		}

		delete[] tex->pixels;
		delete tex;
	}
	texBuf.clear();
}
Exemplo n.º 7
0
	void Init()
	{
		// New game, clean slate.
		spamProtectionCount = 0;
		logOnceUsed.clear();
		everUnsupported = false;
		currentSupported = IsSupported();
	}
Exemplo n.º 8
0
	bool IsEnabled()
	{
		if (g_Config.sReportHost.empty() || !IsSupported())
			return false;
		// Disabled by default for now.
		if (g_Config.sReportHost.compare("default") == 0)
			return false;
		return true;
	}
Exemplo n.º 9
0
	void Enable(bool flag, std::string host)
	{
		if (IsSupported() && IsEnabled() != flag)
		{
			// "" means explicitly disabled.  Don't ever turn on by default.
			// "default" means it's okay to turn it on by default.
			g_Config.sReportHost = flag ? host : "";
		}
	}
Exemplo n.º 10
0
/// Mount
///
/// @param archive Archive
///
bool Cef_first::Mount(CArcFile* archive)
{
	if (!IsSupported(archive))
		return false;

	// Skip 32 bytes
	archive->Seek(32, FILE_BEGIN);

	return CPaz::Mount(archive);
}
Exemplo n.º 11
0
void LIB_EDIT_FRAME::OnPasteDuplicatePart( wxCommandEvent& aEvent )
{
    int dummyUnit;
    LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
    wxString lib = libId.GetLibNickname();

    if( !m_libMgr->LibraryExists( lib ) )
        return;

    LIB_PART* srcPart = nullptr;
    LIB_PART* newPart = nullptr;

    if( aEvent.GetId() == ID_LIBEDIT_DUPLICATE_PART )
    {
        srcPart = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
        newPart = new LIB_PART( *srcPart );
    }
    else if( aEvent.GetId() == ID_LIBEDIT_PASTE_PART )
    {
        auto clipboard = wxTheClipboard;
        wxClipboardLocker clipboardLock( clipboard );

        if( !clipboardLock || ! clipboard->IsSupported( wxDF_TEXT ) )
            return;

        wxTextDataObject data;
        clipboard->GetData( data );
        wxString partSource = data.GetText();

        STRING_LINE_READER reader( TO_UTF8( partSource ), "Clipboard" );

        try
        {
            reader.ReadLine();
            newPart = SCH_LEGACY_PLUGIN::ParsePart( reader );
        }
        catch( IO_ERROR& e )
        {
            wxLogError( wxString::Format( "Malformed clipboard: %s" ), GetChars( e.What() ) );
            return;
        }
    }
    else
        wxFAIL;

    if( !newPart )
        return;

    fixDuplicateAliases( newPart, lib );
    m_libMgr->UpdatePart( newPart, lib );
    SyncLibraries( false );
    m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newPart->GetName() ) );

    delete newPart;
}
	virtual void ShutdownModule() override
	{
		if (IsSupported())
		{
			IMediaModule* MediaModule = FModuleManager::GetModulePtr<IMediaModule>("Media");
			if (nullptr != MediaModule)
			{
				MediaModule->UnregisterPlayerFactory(*this);
			}
		}
	}
	virtual TSharedPtr<IMediaPlayer> CreatePlayer() override
	{
		if (IsSupported())
		{
			return MakeShareable(new FAndroidMediaPlayer());
		}
		else
		{
			return nullptr;
		}
	}
Exemplo n.º 14
0
void
GLContext::InitFeatures()
{
    for (size_t featureId = 0; featureId < size_t(GLFeature::EnumMax); featureId++) {
        GLFeature feature = GLFeature(featureId);

        if (IsFeaturePartOfProfileVersion(feature, mProfile, mVersion)) {
            mAvailableFeatures[featureId] = true;
            continue;
        }

        mAvailableFeatures[featureId] = false;

        const FeatureInfo& featureInfo = GetFeatureInfo(feature);

        if (IsExtensionSupported(featureInfo.mARBExtensionWithoutARBSuffix)) {
            mAvailableFeatures[featureId] = true;
            continue;
        }

        for (size_t j = 0; true; j++) {
            MOZ_ASSERT(j < kMAX_EXTENSION_GROUP_SIZE,
                       "kMAX_EXTENSION_GROUP_SIZE too small");

            if (featureInfo.mExtensions[j] == GLContext::Extensions_End)
                break;

            if (IsExtensionSupported(featureInfo.mExtensions[j])) {
                mAvailableFeatures[featureId] = true;
                break;
            }
        }
    }

    if (ShouldDumpExts()) {
        for (size_t featureId = 0; featureId < size_t(GLFeature::EnumMax); featureId++) {
            GLFeature feature = GLFeature(featureId);
            printf_stderr("[%s] Feature::%s\n",
                          IsSupported(feature) ? "enabled" : "disabled",
                          GetFeatureName(feature));
        }
    }

    if (WorkAroundDriverBugs()) {
#ifdef XP_MACOSX
        // MacOSX 10.6 reports to support EXT_framebuffer_sRGB and EXT_texture_sRGB but
        // fails to convert from sRGB to linear when reading from an sRGB texture attached
        // to an FBO. (bug 843668)
        if (!nsCocoaFeatures::OnLionOrLater())
            MarkUnsupported(GLFeature::sRGB_framebuffer);
#endif // XP_MACOSX
    }
}
Exemplo n.º 15
0
static int
win8_provider_dictionary_exists (EnchantProvider *provider, const char *const tag)
{
	auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
	wchar_t *wtag = utf8_to_utf16 (tag, -1, TRUE);

	BOOL is_supported = FALSE;
	factory->IsSupported (wtag, &is_supported);

	g_free (wtag);
	return is_supported;
}
Exemplo n.º 16
0
	virtual void OnSourceModShutdown()
	{
		if (!IsSupported())
		{
			return;
		}

		delete [] m_PlayerHuds;
		handlesys->RemoveType(m_hHudSyncObj, g_pCoreIdent);

		g_Players.RemoveClientListener(this);
	}
Exemplo n.º 17
0
/**
 * Tests for support of the EXT_framebuffer_object
 * extension, and generates a framebuffer if supported
 */
FBO::FBO() : fboId(0), reloadOnAltTab(false)
{
	if (!IsSupported()) return;

	glGenFramebuffersEXT(1,&fboId);

	// we need to bind it once, else it isn't valid
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);

	//GML_STDMUTEX_LOCK(fbo);
	fboList.push_back(this);
}
Exemplo n.º 18
0
ImagesProvider::ImagesProvider(const QString & source)
{
	_pos = 0;
	QDirIterator it(source, QDir::Files, QDirIterator::Subdirectories);
	while (it.hasNext())
	{
		it.next();
		FImage image = { false,it.filePath() };
		if ( IsSupported( image.name ))
			_images.push_back(image);
	}
}
Exemplo n.º 19
0
void CRadioStyle::OnSourceModLevelChange(const char *mapName)
{
	if (g_bRadioInit)
	{
		return;
	}

	g_bRadioInit = true;

	// Always register the style. Use IsSupported() to check for validity before use.
	g_Menus.AddStyle(this);

	const char *msg = g_pGameConf->GetKeyValue("HudRadioMenuMsg");
	if (!msg || msg[0] == '\0')
	{
		return;
	}

	g_ShowMenuId = g_UserMsgs.GetMessageIndex(msg);

	if (!IsSupported())
	{
		return;
	}

	const char *val = g_pGameConf->GetKeyValue("RadioMenuTimeout");
	if (val != NULL)
	{
		g_RadioMenuTimeout = atoi(val);
	}
	else
	{
		g_RadioMenuTimeout = 0;
	}

	const char *items = g_pGameConf->GetKeyValue("RadioMenuMaxPageItems");
	if (items != NULL)
	{
		int value = atoi(items);

		// Only override the mostly-safe default if it's a sane value
		if (value > MAX_PAGINATION_OPTIONS && value <= MAX_MENUSLOT_KEYS)
		{
			s_RadioMaxPageItems = value;
		}
	}

	g_Menus.SetDefaultStyle(this);

	g_UserMsgs.HookUserMessage(g_ShowMenuId, this, false);
}
Exemplo n.º 20
0
PBO::PBO() : pboId(0)
{
	bound = false;
	mapped = false;
	data = NULL;
	size = 0;

	if (IsSupported()) {
		glGenBuffers(1, &pboId);
		PBOused = true;
	} else {
		PBOused = false;
	}
}
CAlfPerfAppAvkonTestCase* CAlfPerfAppAvkonTestCase::NewL( TInt aCaseId, TInt aSequenceIndex )
    {
    if ( !IsSupported( aCaseId ) )
        {
        User::Leave( KErrNotSupported );
        }

    CAlfPerfAppAvkonTestCase* self = 
        new (ELeave) CAlfPerfAppAvkonTestCase( aCaseId, aSequenceIndex );
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );
    return self;
    }
	virtual void StartupModule() override
	{
		if (IsSupported())
		{
			IMediaModule* MediaModule = FModuleManager::LoadModulePtr<IMediaModule>("Media");
			if (nullptr != MediaModule)
			{
				SupportedFileTypes.Add(TEXT("3gpp"), LOCTEXT("Format3gpp", "3GPP Multimedia File"));
				SupportedFileTypes.Add(TEXT("aac"), LOCTEXT("FormatAac", "MPEG-2 Advanced Audio Coding File"));
				SupportedFileTypes.Add(TEXT("mp4"), LOCTEXT("FormatMp4", "MPEG-4 Movie"));
				MediaModule->RegisterPlayerFactory(*this);
			}
		}
	}
Exemplo n.º 23
0
Arquivo: Global.cpp Projeto: kg/Fury2
Export int Initialize() {
  if (!EnableOverrides) {
    if (IsSupported()) {
      InstallTrampolines();
      VRegInitialize();
      EnableOverrides = true;
      OutputDebugStringA("Initialize()=1\n");
      return Success;
    }
    OutputDebugStringA("Initialize()=0\n");
    return Failure;
  } else {
    return Failure;
  }
}
Exemplo n.º 24
0
bool CFrameBufferObject::Initialize()
{
  if (!IsSupported())
    return false;

  Cleanup();

  glGenFramebuffersEXT(1, &m_fbo);
  VerifyGLState();

  if (!m_fbo)
    return false;

  m_valid = true;
  return true;
}
Exemplo n.º 25
0
/*****************************************************************************
 * OpenFilter:
 *****************************************************************************/
static int OpenFilter( vlc_object_t *p_this )
{
    filter_t *p_filter = (filter_t *)p_this;

    audio_format_t fmt_in  = p_filter->fmt_in.audio;
    audio_format_t fmt_out = p_filter->fmt_out.audio;

    fmt_in.i_format = p_filter->fmt_in.i_codec;
    fmt_out.i_format = p_filter->fmt_out.i_codec;

    if( !IsSupported( &fmt_in, &fmt_out ) )
        return -1;

    p_filter->pf_audio_filter = Filter;

    return 0;
}
Exemplo n.º 26
0
VBO::VBO(GLenum _defTarget) : vboId(0)
{
	bound = false;
	mapped = false;
	data = NULL;
	size = 0;
	curBoundTarget = _defTarget;
	defTarget = _defTarget;
	usage = GL_STREAM_DRAW;
	nullSizeMapped = false;

	VBOused = IsSupported();

	// With GML the ctor can be called by a non-render thread
	// so delay the buffer generation to the first usage
	//if (VBOused) glGenBuffers(1, &vboId);
}
Exemplo n.º 27
0
bool wxClipboard::IsSupported( const wxDataFormat& format )
{
    /* reentrance problems */
    if (m_waiting) return FALSE;

    /* store requested format to be asked for by callbacks */
    m_targetRequested = format;

    wxLogTrace( TRACE_CLIPBOARD,
                wxT("wxClipboard:IsSupported: requested format: %s"),
                format.GetId().c_str() );

    wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );

    m_formatSupported = FALSE;

    /* perform query. this will set m_formatSupported to
       TRUE if m_targetRequested is supported.
       also, we have to wait for the "answer" from the
       clipboard owner which is an asynchronous process.
       therefore we set m_waiting = TRUE here and wait
       until the callback "targets_selection_received"
       sets it to FALSE */

    m_waiting = TRUE;

    gtk_selection_convert( m_targetsWidget,
                           m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
                                        : g_clipboardAtom,
                           g_targetsAtom,
                           (guint32) GDK_CURRENT_TIME );

    while (m_waiting) gtk_main_iteration();

#if defined(__WXGTK20__) && wxUSE_UNICODE
    if (!m_formatSupported && format == wxDataFormat(wxDF_UNICODETEXT))
    {
        // Another try with plain STRING format
        extern GdkAtom g_altTextAtom;
        return IsSupported(g_altTextAtom);
    }
#endif

    return m_formatSupported;
}
Exemplo n.º 28
0
// 左下のテキスト情報
int STDCALL GetFileInfoText1(const char* pSrc, unsigned int dwSize, char** pDst)
{
	// サイズの大きいファイルを無駄に読み込むのは動作速度が遅くなるので、
	// ここでIsSupportedしておく
	if(IsSupported(pSrc, dwSize)==0)	return RPI_NOT_SUPPORT;

	// メモリ入力
	if(dwSize){
		return GetFileInfoTextEx(1, pSrc, dwSize, pDst);
	}
	// ファイル入力
	else{
		smart_array< char > buf;
		if(File2Memory(pSrc, buf)){
			return GetFileInfoTextEx(1, buf.GetPtr(), buf.GetSize(), pDst, pSrc);
		}
		return RPI_FILE_READ_ERROR;
	}
}
Exemplo n.º 29
0
IGeometryChecker::ReturnVal FlippedFacesChecker::GeometryCheck(TimeValue t,INode *nodeToCheck, IGeometryChecker::OutputVal &val)
{
	val.mIndex.ZeroCount();
	if(IsSupported(nodeToCheck))
	{
		ObjectState os  = nodeToCheck->EvalWorldState(t);
		Object *obj = os.obj;
	
		if(os.obj->IsSubClassOf(triObjectClassID))
		{
			TriObject *tri = dynamic_cast<TriObject *>(os.obj);
			if(tri&&tri->mesh.numFaces>0)
			{
				tri->mesh.checkNormals(TRUE);
				for(int i=0;i<tri->mesh.numFaces;++i)
				{
					val.mIndex.Append(1,&i);
				}
				return TypeReturned();
			}
			else return IGeometryChecker::eFail;
		}
		else if(os.obj->IsSubClassOf(polyObjectClassID))
		{
			PolyObject *poly = dynamic_cast<PolyObject *>(os.obj);
			if(poly&&poly->GetMesh().numf>0)
			{
				IGeometryChecker::ReturnVal returnval=IGeometryChecker::eFail;
				MNMesh &mnMesh = poly->GetMesh();
				for(int i=0;i<mnMesh.numf;++i)
				{
					val.mIndex.Append(1,&i);
				}
				return TypeReturned();
			}
			else return IGeometryChecker::eFail;
		}
		
		return TypeReturned();
	}
	return IGeometryChecker::eFail;
}
WebGLExtensionColorBufferFloat::WebGLExtensionColorBufferFloat(WebGLContext* webgl)
    : WebGLExtensionBase(webgl)
{
    MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");

    auto& fua = webgl->mFormatUsage;

    auto fnUpdateUsage = [&fua](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
        auto usage = fua->EditUsage(effFormat);
        usage->SetRenderable();
        fua->AllowRBFormat(sizedFormat, usage);
    };

#define FOO(x) fnUpdateUsage(LOCAL_GL_ ## x, webgl::EffectiveFormat::x)

    // The extension doesn't actually add RGB32F; only RGBA32F.
    FOO(RGBA32F);

#undef FOO
}