コード例 #1
0
ファイル: Game.cpp プロジェクト: educastro/Dauphine
Game::Game() :
	isCutscene(false),
	isPaused(false),
	currentLine(0),
	transitionTo(LEVEL_ONE),
	window(nullptr),
	isRunning(false),
	pauseImage(nullptr),
	pauseSelector(nullptr),
	audioHandler(new AudioHandler()),
	inputHandler(new InputHandler()),
	resourceManager(new ResourceManager()),
	gameSave(new GameSave()),
	fadeScreen(nullptr),
	currentState(nullptr),
	statesMap(),
	passedTime(0.0),
	currentSelection(PSelection::RESUME),
	selectorXPositionLeft {550, 550},
	selectorYPositionLeft {400, 470},
	selectorXPositionRight {930, 930},
	selectorYPositionRight {400, 470}
{
	this->window = new Window(Configuration::getScreenWidth(),
		Configuration::getScreenHeight(), Configuration::getWindowTitle());

	assert(this->window != nullptr && "The window should not be null!");

	initializeStates();

	std::string path = "assets/images/Dialog/dialog";
	std::string extension = ".png";	

	for(int i = 0; i < numLines; i++){
		this->dialog[i] = nullptr;
		this->dialog[i] = getResources().get(path + Util::toString(i) + extension);
	
		if(this->dialog[i] == nullptr){
			Log(ERROR) << "Invalid dialog image.";
		}
	}

	this->pauseImage = getResources().get("assets/images/pause_overlay.png");
	this->pauseSelector = getResources().get("assets/images/cursor_regular.png");
	this->pauseSelector->setWidth(50);

	this->isRunning = true;
}
コード例 #2
0
ファイル: sceneresources.cpp プロジェクト: SaierMe/opentoonz
SceneResources::SceneResources(ToonzScene *scene, TXsheet *subXsheet)
    : m_scene(scene)
    , m_commitDone(false)
    , m_wasUntitled(scene->isUntitled())
    , m_subXsheet(subXsheet) {
  getResources();
}
コード例 #3
0
ファイル: serwer.c プロジェクト: Wookesh/SO2
void *clientThread(void *data)
{
	threadStart();
	pthread_t pthread_self();
	pid_t clientPid = *(pid_t *)data, secondClientPid = 0;
	int k = 0, n = 0, m = 0;
	long msgType = clientPid, secondMsgType = 0;
	getRequest(msgType, &k, &n);
	if (getPartner(clientPid, &secondClientPid, k, n, &m) == 1)
		sendErrorInfo(msgType);
	if (secondClientPid != clientPid) {
		secondMsgType = secondClientPid;
		if (getResources(clientPid, secondClientPid, k, n, m) == 0) {
			sendResources(msgType, secondClientPid);
			sendResources(secondMsgType, clientPid);
			getResourcesBack(msgType, secondMsgType, k, n + m);
		} else {
			sendErrorInfo(msgType);
			sendErrorInfo(secondMsgType);
		}
	}
	free(data);
	threadEnd();
	return 0;
}
コード例 #4
0
ファイル: TranslatorESSL.cpp プロジェクト: merckhung/libui
void TranslatorESSL::translate(TIntermNode *root, int) {
    TInfoSinkBase& sink = getInfoSink().obj;

    writePragma();

    // Write built-in extension behaviors.
    writeExtensionBehavior();

    bool precisionEmulation = getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;

    if (precisionEmulation)
    {
        EmulatePrecision emulatePrecision;
        root->traverse(&emulatePrecision);
        emulatePrecision.updateTree();
        emulatePrecision.writeEmulationHelpers(sink, SH_ESSL_OUTPUT);
    }

    // Write emulated built-in functions if needed.
    getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
        sink, getShaderType() == GL_FRAGMENT_SHADER);

    // Write array bounds clamping emulation if needed.
    getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);

    // Write translated shader.
    TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion(), precisionEmulation);
    root->traverse(&outputESSL);
}
コード例 #5
0
ファイル: ResourceManager.cpp プロジェクト: PH3NIX/CubicVR
ResourceManager::~ResourceManager()
{
	ResourceSet::iterator type_i;
	ResourceTypeSet::iterator set_i;
	
	for (type_i = getResources().begin(); type_i != getResources().end(); type_i++)
	{
		for (set_i = (*type_i).second.begin(); set_i != (*type_i).second.end(); set_i++)
		{
			delete (*set_i).second;
		}
	}
	
	delete mResources;
	delete mSubResources;
}
コード例 #6
0
TEST_F(PageSerializerTest, Frames)
{
    setBaseFolder("pageserializer/frames/");

    registerURL("simple_frames.html", "text/html");
    registerURL("simple_frames_top.html", "text/html");
    registerURL("simple_frames_1.html", "text/html");
    registerURL("simple_frames_3.html", "text/html");

    registerURL("frame_1.png", "image.png", "image/png");
    registerURL("frame_2.png", "image.png", "image/png");
    registerURL("frame_3.png", "image.png", "image/png");
    registerURL("frame_4.png", "image.png", "image/png");

    serialize("simple_frames.html");

    EXPECT_EQ(8U, getResources().size());

    EXPECT_TRUE(isSerialized("simple_frames.html", "text/html"));
    EXPECT_TRUE(isSerialized("simple_frames_top.html", "text/html"));
    EXPECT_TRUE(isSerialized("simple_frames_1.html", "text/html"));
    EXPECT_TRUE(isSerialized("simple_frames_3.html", "text/html"));

    EXPECT_TRUE(isSerialized("frame_1.png", "image/png"));
    EXPECT_TRUE(isSerialized("frame_2.png", "image/png"));
    EXPECT_TRUE(isSerialized("frame_3.png", "image/png"));
    EXPECT_TRUE(isSerialized("frame_4.png", "image/png"));
}
コード例 #7
0
NativeString*
AssetManagerGlue::getResourceName(int resid)
{
	ResTable::resource_name name;
	if (!getResources().getResourceName(resid, &name)) {
		return NULL;
	}

	String16 str;
	if (name.package != NULL) {
		str.setTo(name.package, name.packageLen);
	}
	if (name.type != NULL) {
		if (str.size() > 0) {
			char16_t div = ':';
			str.append(&div, 1);
		}
		str.append(name.type, name.typeLen);
	}
	if (name.name != NULL) {
		if (str.size() > 0) {
			char16_t div = '/';
			str.append(&div, 1);
		}
		str.append(name.name, name.nameLen);
	}

	return new NativeString(str);
}
コード例 #8
0
ファイル: TranslatorGLSL.cpp プロジェクト: cheekiatng/webkit
void TranslatorGLSL::translate(TIntermNode *root, int) {
    TInfoSinkBase& sink = getInfoSink().obj;

    // Write GLSL version.
    writeVersion(root);

    writePragma();

    // Write extension behaviour as needed
    writeExtensionBehavior();

    bool precisionEmulation = getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;

    if (precisionEmulation)
    {
        EmulatePrecision emulatePrecision;
        root->traverse(&emulatePrecision);
        emulatePrecision.updateTree();
        emulatePrecision.writeEmulationHelpers(sink, getOutputType());
    }

    // Write emulated built-in functions if needed.
    if (!getBuiltInFunctionEmulator().IsOutputEmpty())
    {
        sink << "// BEGIN: Generated code for built-in function emulation\n\n";
        sink << "#define webgl_emu_precision\n\n";
        getBuiltInFunctionEmulator().OutputEmulatedFunctions(sink);
        sink << "// END: Generated code for built-in function emulation\n\n";
    }

    // Write array bounds clamping emulation if needed.
    getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);

    // Declare gl_FragColor and glFragData as webgl_FragColor and webgl_FragData
    // if it's core profile shaders and they are used.
    if (getShaderType() == GL_FRAGMENT_SHADER && IsGLSL130OrNewer(getOutputType()))
    {
        TFragmentOutSearcher searcher;
        root->traverse(&searcher);
        ASSERT(!(searcher.usesGlFragData() && searcher.usesGlFragColor()));
        if (searcher.usesGlFragColor())
        {
            sink << "out vec4 webgl_FragColor;\n";
        }
        if (searcher.usesGlFragData())
        {
            sink << "out vec4 webgl_FragData[gl_MaxDrawBuffers];\n";
        }
    }

    // Write translated shader.
    TOutputGLSL outputGLSL(sink,
                           getArrayIndexClampingStrategy(),
                           getHashFunction(),
                           getNameMap(),
                           getSymbolTable(),
                           getShaderVersion(),
                           getOutputType());
    root->traverse(&outputGLSL);
}
コード例 #9
0
ファイル: UnitShared.cpp プロジェクト: oenayet/bwapi
 //------------------------------------- INITIAL INFORMATION FUNCTIONS --------------------------------------
 void UnitImpl::saveInitialState()
 {
   initialType      = getType();
   initialPosition  = getPosition();
   initialResources = getResources();
   initialHitPoints = getHitPoints();
 }
コード例 #10
0
ファイル: map.c プロジェクト: algking/mmoserver
int main()
{
	int i = 0;
	int index = 0;
	int numResources = 0;
	char *resources;

	loadTiles();
	loadResourceList();
	
	while(1)
	{
		printf("\nIndex: ");
		scanf("%d", &index);
		
		resources = getResources(index);
		numResources = resources[0];
		
		printf("Tile: %d\n", getTileType(index));  
		printf("Resources: ");
		printf("%d", resources[0]);
		
		for(i = 0; i < numResources; i++)
		{
			printf("%d", resources[i * 2 + 1] );
			printf("%d", resources[(i * 2) + 2]);
		}
	}
	return 0;
}
コード例 #11
0
ファイル: ResourceLoader.cpp プロジェクト: Jereq/PongOut
ResourceLoader::ErrorCode ResourceLoader::getResources(std::vector<Resource>& _ret, const boost::filesystem::path& _resourceDir, const std::string& _type)
{
	if (_type.empty())
	{
		return ErrorCode::INVALID_ARGUMENT;
	}

	std::vector<Resource> result;
	ErrorCode res = getResources(result, _resourceDir);

	if (res != ErrorCode::SUCCESS)
	{
		return res;
	}

	for (auto val : result)
	{
		if (val.type == _type)
		{
			_ret.push_back(val);
		}
	}

	return ErrorCode::SUCCESS;
}
コード例 #12
0
 NVDrawBuffersTest() : MatchOutputCodeTest(GL_FRAGMENT_SHADER, 0, SH_ESSL_OUTPUT)
 {
     ShBuiltInResources *resources = getResources();
     resources->MaxDrawBuffers     = 8;
     resources->EXT_draw_buffers   = 1;
     resources->NV_draw_buffers    = 1;
 }
コード例 #13
0
bool AssetBrowser::resourceInput(const char* label, const char* str_id, char* buf, int max_size, Lumix::uint32 type)
{
	float item_w = ImGui::CalcItemWidth();
	auto& style = ImGui::GetStyle();
	float text_width = Lumix::Math::maximum(
		50.0f, item_w - ImGui::CalcTextSize("...View").x - style.FramePadding.x * 4 - style.ItemSpacing.x * 2);

	char* c = buf + Lumix::stringLength(buf);
	while (c > buf && *c != '/' && *c != '\\') --c;
	if (*c == '/' || *c == '\\') ++c;
	
	auto pos = ImGui::GetCursorPos();
	pos.x += text_width;
	ImGui::AlignFirstTextHeightToWidgets();
	ImGui::PushTextWrapPos(text_width);
	ImGui::Text("%s", c);
	ImGui::PopTextWrapPos();
	ImGui::SameLine();
	ImGui::SetCursorPos(pos);
	Lumix::StaticString<50> popup_name("pu", str_id);
	if (ImGui::Button(Lumix::StaticString<30>("...###browse", str_id)))
	{
		ImGui::OpenPopup(popup_name);
	}
	ImGui::SameLine();
	if (ImGui::Button(Lumix::StaticString<30>("View###go", str_id)))
	{
		m_is_focus_requested = true;
		m_is_opened = true;
		m_wanted_resource = buf;
	}
	ImGui::SameLine();
	ImGui::Text("%s", label);

	if (ImGui::BeginResizablePopup(popup_name, ImVec2(300, 300)))
	{
		static char filter[128] = "";
		ImGui::InputText("Filter", filter, sizeof(filter));

		ImGui::BeginChild("Resources", ImVec2(0, 0));
		for (auto unv : getResources(getTypeIndexFromManagerType(type)))
		{
			if (filter[0] != '\0' && strstr(unv.c_str(), filter) == nullptr) continue;

			if (ImGui::Selectable(unv.c_str(), false))
			{
				Lumix::copyString(buf, max_size, unv.c_str());
				ImGui::EndChild();
				ImGui::EndPopup();
				return true;
			}
		}

		ImGui::EndChild();
		ImGui::EndPopup();
	}

	return false;
}
コード例 #14
0
void TranslatorHLSL::translate(TIntermNode *root)
{
    TParseContext& parseContext = *GetGlobalParseContext();
    sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);

    outputHLSL.output();
    mActiveUniforms = outputHLSL.getUniforms();
}
コード例 #15
0
void TranslatorESSL::translate(TIntermNode *root, int) {
    TInfoSinkBase& sink = getInfoSink().obj;

    int shaderVer = getShaderVersion();
    if (shaderVer > 100)
    {
        sink << "#version " << shaderVer << " es\n";
    }

    writePragma();

    // Write built-in extension behaviors.
    writeExtensionBehavior();

    bool precisionEmulation = getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;

    if (precisionEmulation)
    {
        EmulatePrecision emulatePrecision(getSymbolTable(), shaderVer);
        root->traverse(&emulatePrecision);
        emulatePrecision.updateTree();
        emulatePrecision.writeEmulationHelpers(sink, SH_ESSL_OUTPUT);
    }

    unsigned int temporaryIndex = 0;

    RecordConstantPrecision(root, &temporaryIndex);

    // Write emulated built-in functions if needed.
    if (!getBuiltInFunctionEmulator().IsOutputEmpty())
    {
        sink << "// BEGIN: Generated code for built-in function emulation\n\n";
        if (getShaderType() == GL_FRAGMENT_SHADER)
        {
            sink << "#if defined(GL_FRAGMENT_PRECISION_HIGH)\n"
                 << "#define webgl_emu_precision highp\n"
                 << "#else\n"
                 << "#define webgl_emu_precision mediump\n"
                 << "#endif\n\n";
        }
        else
        {
            sink << "#define webgl_emu_precision highp\n";
        }

        getBuiltInFunctionEmulator().OutputEmulatedFunctions(sink);
        sink << "// END: Generated code for built-in function emulation\n\n";
    }

    // Write array bounds clamping emulation if needed.
    getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);

    // Write translated shader.
    TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(),
                           getSymbolTable(), shaderVer, precisionEmulation);
    root->traverse(&outputESSL);
}
コード例 #16
0
ファイル: TranslatorESSL.cpp プロジェクト: 70599/Waterfox
void TranslatorESSL::writeExtensionBehavior() {
    TInfoSinkBase& sink = getInfoSink().obj;
    const TExtensionBehavior& extBehavior = getExtensionBehavior();
    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
         iter != extBehavior.end(); ++iter) {
        if (iter->second != EBhUndefined) {
            if (getResources().NV_shader_framebuffer_fetch && iter->first == "GL_EXT_shader_framebuffer_fetch") {
                sink << "#extension GL_NV_shader_framebuffer_fetch : "
                     << getBehaviorString(iter->second) << "\n";
            } else if (getResources().NV_draw_buffers && iter->first == "GL_EXT_draw_buffers") {
                sink << "#extension GL_NV_draw_buffers : "
                     << getBehaviorString(iter->second) << "\n";
            } else {
                sink << "#extension " << iter->first << " : "
                     << getBehaviorString(iter->second) << "\n";
            }
        }
    }
}
コード例 #17
0
int
AssetManagerGlue::getResourceIdentifier(const NativeString& name, const NativeString* defType,
					const NativeString* defPackage)
{
	return getResources().identifierForName(name.ptr(0, name.length()), name.length(),
						defType ? defType->ptr(0, defType->length()) : NULL,
						defType ? defType->length() : 0,
						defPackage ? defPackage->ptr(0, defPackage->length()) : NULL,
						defPackage ? defPackage->length() : 0);
}
コード例 #18
0
TEST_F(PageSerializerTest, DataURIMorphing)
{
    setBaseFolder("pageserializer/datauri/");

    registerURL("page_with_morphing_data.html", "text/html");

    serialize("page_with_morphing_data.html");

    EXPECT_EQ(2U, getResources().size());
    EXPECT_TRUE(isSerialized("page_with_morphing_data.html", "text/html"));
}
コード例 #19
0
TEST_F(PageSerializerTest, NamespaceElementsDontCrash)
{
    setBaseFolder("pageserializer/namespace/");

    registerURL("namespace_element.html", "text/html");

    serialize("namespace_element.html");

    EXPECT_EQ(1U, getResources().size());
    EXPECT_TRUE(isSerialized("namespace_element.html", "text/html"));
    EXPECT_GT(getSerializedData("namespace_element.html", "text/html").length(), 0U);
}
コード例 #20
0
TEST_F(PageSerializerTest, CSS)
{
    setBaseFolder("pageserializer/css/");

    registerURL("css_test_page.html", "text/html");
    registerURL("link_styles.css", "text/css");
    registerURL("encoding.css", "text/css");
    registerURL("import_style_from_link.css", "text/css");
    registerURL("import_styles.css", "text/css");
    registerURL("do_not_serialize.png", "image.png", "image/png");
    registerURL("red_background.png", "image.png", "image/png");
    registerURL("orange_background.png", "image.png", "image/png");
    registerURL("yellow_background.png", "image.png", "image/png");
    registerURL("green_background.png", "image.png", "image/png");
    registerURL("blue_background.png", "image.png", "image/png");
    registerURL("purple_background.png", "image.png", "image/png");
    registerURL("pink_background.png", "image.png", "image/png");
    registerURL("brown_background.png", "image.png", "image/png");
    registerURL("ul-dot.png", "image.png", "image/png");
    registerURL("ol-dot.png", "image.png", "image/png");

    serialize("css_test_page.html");

    EXPECT_EQ(15U, getResources().size());

    EXPECT_FALSE(isSerialized("do_not_serialize.png", "image/png"));

    EXPECT_TRUE(isSerialized("css_test_page.html", "text/html"));
    EXPECT_TRUE(isSerialized("link_styles.css", "text/css"));
    EXPECT_TRUE(isSerialized("encoding.css", "text/css"));
    EXPECT_TRUE(isSerialized("import_styles.css", "text/css"));
    EXPECT_TRUE(isSerialized("import_style_from_link.css", "text/css"));
    EXPECT_TRUE(isSerialized("red_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("orange_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("yellow_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("green_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("blue_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("purple_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("pink_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("brown_background.png", "image/png"));
    EXPECT_TRUE(isSerialized("ul-dot.png", "image/png"));
    EXPECT_TRUE(isSerialized("ol-dot.png", "image/png"));

    // Ensure encodings are specified.
    EXPECT_TRUE(getSerializedData("link_styles.css", "text/css").startsWith("@charset"));
    EXPECT_TRUE(getSerializedData("import_styles.css", "text/css").startsWith("@charset"));
    EXPECT_TRUE(getSerializedData("import_style_from_link.css", "text/css").startsWith("@charset"));
    EXPECT_TRUE(getSerializedData("encoding.css", "text/css").startsWith("@charset \"euc-kr\";"));

    // Ensure that stylesheet contents are not NFC-normalized before encoding.
    EXPECT_TRUE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xD1\xE2"));
    EXPECT_FALSE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xE4\xC5"));
}
コード例 #21
0
TEST_F(PageSerializerTest, DontIncludeErrorImage)
{
    setBaseFolder("pageserializer/image/");

    registerURL("page_with_img_error.html", "text/html");
    registerURL("error_image.png", "image/png");

    serialize("page_with_img_error.html");

    EXPECT_EQ(1U, getResources().size());
    EXPECT_TRUE(isSerialized("page_with_img_error.html", "text/html"));
    EXPECT_FALSE(isSerialized("error_image.png", "image/png"));
}
コード例 #22
0
void TranslatorHLSL::translate(TIntermNode *root)
{
    TParseContext& parseContext = *GetGlobalParseContext();
    sh::OutputHLSL outputHLSL(parseContext, getResources(), getOutputType());

    outputHLSL.output();

    mActiveUniforms         = outputHLSL.getUniforms();
    mActiveInterfaceBlocks  = outputHLSL.getInterfaceBlocks();
    mActiveOutputVariables  = outputHLSL.getOutputVariables();
    mActiveAttributes       = outputHLSL.getAttributes();
    mActiveVaryings         = outputHLSL.getVaryings();
}
コード例 #23
0
ファイル: TranslatorHLSL.cpp プロジェクト: merckhung/libui
void TranslatorHLSL::translate(TIntermNode *root, int compileOptions)
{
    const ShBuiltInResources &resources = getResources();
    int numRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;

    sh::OutputHLSL outputHLSL(getShaderType(), getShaderVersion(), getExtensionBehavior(),
        getSourcePath(), getOutputType(), numRenderTargets, getUniforms(), compileOptions);

    outputHLSL.output(root, getInfoSink().obj);

    mInterfaceBlockRegisterMap = outputHLSL.getInterfaceBlockRegisterMap();
    mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
}
コード例 #24
0
ファイル: asset_browser.cpp プロジェクト: ylyking/LumixEngine
bool AssetBrowser::resourceInput(const char* label, const char* str_id, char* buf, int max_size, Lumix::uint32 type)
{
	float item_w = ImGui::CalcItemWidth();
	auto& style = ImGui::GetStyle();
	ImGui::PushItemWidth(item_w - ImGui::CalcTextSize("...View").x - style.FramePadding.x * 4 -
						 style.ItemSpacing.x * 2);

	if (ImGui::InputText(Lumix::StaticString<30>("###", str_id), buf, max_size)) return true;

	ImGui::SameLine();
	Lumix::StaticString<50> popup_name("pu", str_id);
	if (ImGui::Button(Lumix::StaticString<30>("...###browse", str_id)))
	{
		ImGui::OpenPopup(popup_name);
	}
	ImGui::SameLine();
	if (ImGui::Button(Lumix::StaticString<30>("View###go", str_id)))
	{
		m_is_focus_requested = true;
		m_is_opened = true;
		m_wanted_resource = buf;
	}
	ImGui::SameLine();
	ImGui::Text("%s", label);
	ImGui::PopItemWidth();

	if (ImGui::BeginResizablePopup(popup_name, ImVec2(300, 300)))
	{
		static char filter[128] = "";
		ImGui::InputText("Filter", filter, sizeof(filter));

		ImGui::BeginChild("Resources", ImVec2(0, 0));
		for (auto unv : getResources(getTypeIndexFromManagerType(type)))
		{
			if (filter[0] != '\0' && strstr(unv.c_str(), filter) == nullptr) continue;

			if (ImGui::Selectable(unv.c_str(), false))
			{
				Lumix::copyString(buf, max_size, unv.c_str());
				ImGui::EndChild();
				ImGui::EndPopup();
				return true;
			}
		}

		ImGui::EndChild();
		ImGui::EndPopup();
	}

	return false;
}
コード例 #25
0
NativeString*
AssetManagerGlue::getResourceEntryName(int resid)
{
	ResTable::resource_name name;
	if (!getResources().getResourceName(resid, &name)) {
		return NULL;
	}

	if (name.name != NULL) {
		return new NativeString(name.nameLen, name.name);
	}

	return NULL;
}
コード例 #26
0
// Test that we don't regress https://bugs.webkit.org/show_bug.cgi?id=99105
TEST_F(PageSerializerTest, SVGImageDontCrash)
{
    setBaseFolder("pageserializer/svg/");

    registerURL("page_with_svg_image.html", "text/html");
    registerURL("green_rectangle.svg", "image/svg+xml");

    serialize("page_with_svg_image.html");

    EXPECT_EQ(2U, getResources().size());

    EXPECT_TRUE(isSerialized("green_rectangle.svg", "image/svg+xml"));
    EXPECT_GT(getSerializedData("green_rectangle.svg", "image/svg+xml").length(), 250U);
}
コード例 #27
0
TEST_F(PageSerializerTest, RewriteLinksSimple)
{
    setBaseFolder("pageserializer/rewritelinks/");
    setRewriteURLFolder("folder");

    registerURL("rewritelinks_simple.html", "text/html");
    registerURL("absolute.png", "image.png", "image/png");
    registerURL("relative.png", "image.png", "image/png");
    registerRewriteURL("http://www.test.com/absolute.png", "a.png");
    registerRewriteURL("http://www.test.com/relative.png", "b.png");

    serialize("rewritelinks_simple.html");

    EXPECT_EQ(3U, getResources().size());
    EXPECT_NE(getSerializedData("rewritelinks_simple.html", "text/html").find("\"folder/a.png\""), kNotFound);
    EXPECT_NE(getSerializedData("rewritelinks_simple.html", "text/html").find("\"folder/b.png\""), kNotFound);
}
コード例 #28
0
AlertTonePreview::AlertTonePreview (const QString &fname) :
       QObject (0),
       m_gstPipeline (NULL),
       m_gstFilesrc (NULL),
       m_gstVolume (NULL),
       m_profileVolume (QString (ALERT_TONE_VOLUME_VOLUME_KEY)),
       m_Filename (fname)
{
#ifdef HAVE_LIBRESOURCEQT
    getResources ();
#endif

    gstInit ();

#ifndef HAVE_LIBRESOURCEQT
    audioResourceAcquired ();
#endif
}
コード例 #29
0
TEST_F(PageSerializerTest, RewriteLinksBase)
{
    setBaseFolder("pageserializer/rewritelinks/");
    setRewriteURLFolder("folder");

    registerURL("rewritelinks_base.html", "text/html");
    registerURL("images/here/image.png", "image.png", "image/png");
    registerURL("images/here/or/in/here/image.png", "image.png", "image/png");
    registerURL("or/absolute.png", "image.png", "image/png");
    registerRewriteURL("http://www.test.com/images/here/image.png", "a.png");
    registerRewriteURL("http://www.test.com/images/here/or/in/here/image.png", "b.png");
    registerRewriteURL("http://www.test.com/or/absolute.png", "c.png");

    serialize("rewritelinks_base.html");

    EXPECT_EQ(4U, getResources().size());
    EXPECT_NE(getSerializedData("rewritelinks_base.html", "text/html").find("\"folder/a.png\""), kNotFound);
    EXPECT_NE(getSerializedData("rewritelinks_base.html", "text/html").find("\"folder/b.png\""), kNotFound);
    EXPECT_NE(getSerializedData("rewritelinks_base.html", "text/html").find("\"folder/c.png\""), kNotFound);
}
コード例 #30
0
bool AssetBrowser::resourceList(char* buf, int max_size, Lumix::uint32 type, float height)
{
	static char filter[128] = "";
	ImGui::FilterInput("Filter", filter, sizeof(filter));

	ImGui::BeginChild("Resources", ImVec2(0, height));
	for (auto& unv : getResources(getTypeIndexFromManagerType(type)))
	{
		if (filter[0] != '\0' && strstr(unv.c_str(), filter) == nullptr) continue;

		if (ImGui::Selectable(unv.c_str(), false))
		{
			Lumix::copyString(buf, max_size, unv.c_str());
			ImGui::EndChild();
			return true;
		}
	}
	ImGui::EndChild();
	return false;
}