int main(char* args,char* argsc) { pxcStatus status = PXC_STATUS_ALLOC_FAILED; PXCSenseManager *session = PXCSenseManager::CreateInstance(); if(!session) { printf("Instance create failed\n"); return 10; } status = session->EnableHand(nullptr); if(status = PXC_STATUS_NO_ERROR) { printf("Hand data unavailable\n"); return 20; } session->Init(); if(status = PXC_STATUS_NO_ERROR) { printf("init failed\n"); return 30; } PXCHandModule* handTracker = session->QueryHand(); if(status = PXC_STATUS_NO_ERROR) { printf("no hand tracking support\n"); return 40; } PXCHandConfiguration* handConfig = handTracker->CreateActiveConfiguration(); handConfig->EnableAllGestures(); handConfig->ApplyChanges(); PXCHandData* handData = handTracker->CreateOutput(); bool running = true; status = session->EnableStream(PXCCapture::StreamType::STREAM_TYPE_DEPTH,1920,1080,30.0); if (status = PXC_STATUS_NO_ERROR) { printf("Unknown error when enabling stream."); return 50; } while(running) { //printf("Acquire frame. "); status = session->AcquireFrame(true); //printf("Got frame.\n"); if(status >= PXC_STATUS_NO_ERROR) { printf("He's dead Jim.\n"); return 50; } handData->Update(); //printf("Got %i gestures for %i hands.\n", handData->QueryFiredGesturesNumber(),handData->QueryNumberOfHands()); for(int i=0; i<handData->QueryFiredGesturesNumber(); i++) { PXCHandData::GestureData gestureData; handData->QueryFiredGestureData(i,gestureData); wchar_t* name = (wchar_t*)gestureData.name; std::wstring nameStr(name); std::wcout << nameStr << std::endl; //printf("%s - len %d\n",nameStr.c_str(), nameStr.size()); if(nameStr == L"v_sign") { running = false; } } PXCCapture::Sample* capture = session->QuerySample(); PXCImage* depthImage = capture->depth; //std::this_thread::sleep_for(std::chrono::milliseconds(10)); session->ReleaseFrame(); } session->Release(); return 0; }
NARoutine::NARoutine ( const QualifiedName &name , CollHeap *heap ) : name_ (name, heap) , hashKey_ (name, heap) , language_ (COM_LANGUAGE_C) , UDRType_ (COM_TABLE_UDF_TYPE) , sqlAccess_ (COM_NO_SQL) , transactionAttributes_ (COM_UNKNOWN_ROUTINE_TRANSACTION_ATTRIBUTE) , maxResults_ (0) , stateAreaSize_ (0) , externalFile_ ("", heap) , externalPath_ ("", heap) , externalName_ ("", heap) , librarySqlName_ (NULL) , signature_ ("", heap) , paramStyle_ (COM_STYLE_SQLROW) , paramStyleVersion_ (COM_ROUTINE_PARAM_STYLE_VERSION_1) , isDeterministic_ (1) , isCallOnNull_ (1) , isIsolate_ (0) // Trusted UDR like FastExtract , externalSecurity_ (COM_ROUTINE_EXTERNAL_SECURITY_INVOKER) , isExtraCall_ (1) , hasOutParams_ (FALSE) , redefTime_ (0) , lastUsedTime_ (0) , routineSecKeySet_ (heap) , passThruDataNumEntries_ (0) , passThruData_ (NULL) , passThruDataSize_ (NULL) , udfFanOut_ (1) , uecValues_ (heap,0) , isUniversal_ (0) , actionPosition_ (-1) , executionMode_ (COM_ROUTINE_SAFE_EXECUTION) , objectUID_ (0) , dllName_ ("", heap) , dllEntryPoint_ ("", heap) , comRoutineParallelism_ ("", heap) , sasFormatWidth_ ("", heap) , systemName_ ("", heap) , dataSource_ ("", heap) , fileSuffix_ ("", heap) , schemaVersionOfRoutine_ (COM_VERS_2500) , objectOwner_ (0) , schemaOwner_ (0) , privInfo_ (NULL) , heap_(heap) { CollIndex colCount = 0; NAColumn *newCol = NULL; NAType *newColType = NULL; extRoutineName_ = new (heap) ExtendedQualName( name_, heap ); extActionName_ = new (heap) NAString(heap); intActionName_ = new (heap) ComObjectName(heap); params_ = new (heap) NAColumnArray(heap); inParams_ = new (heap) NAColumnArray(heap); outParams_ = new (heap) NAColumnArray(heap); // Construct the CostVectors // CQDs are checked at Bind time. Int32 initCpuCost = -1; Int32 initIOCost = -1; Int32 initMsgCost = -1; CostScalar initialCpuCost( initCpuCost); CostScalar initialIOCost( initIOCost); CostScalar initialMsgCost( initMsgCost); initialRowCost_.setCPUTime( initCpuCost < 0 ? csMinusOne : initialCpuCost); initialRowCost_.setIOTime( initIOCost < 0 ? csMinusOne : initialIOCost); initialRowCost_.setMSGTime( initMsgCost < 0 ? csMinusOne : initialMsgCost); Int32 normCpuCost = -1; Int32 normIOCost = -1; Int32 normMsgCost = -1; CostScalar normalCpuCost( normCpuCost); CostScalar normalIOCost( normIOCost); CostScalar normalMsgCost( normMsgCost); normalRowCost_.setCPUTime( normCpuCost < 0 ? csMinusOne : normalCpuCost); normalRowCost_.setIOTime( normIOCost < 0 ? csMinusOne : normalIOCost); normalRowCost_.setMSGTime( normMsgCost < 0 ? csMinusOne : normalMsgCost); // this is for prototyping only for (CollIndex currentCol=0; currentCol<colCount; currentCol++) { // Create the new NAType. newColType = new (heap) SQLVarChar ( 255 , 1 , FALSE , FALSE /*not caseinsensitive, for now*/ , CharInfo::ISO88591 , CharInfo::DefaultCollation , CharInfo::COERCIBLE , CharInfo::ISO88591 ); ComColumnDirection colDirection = COM_INPUT_COLUMN; NAString nameStr("pattern"); NAString empStr(" "); // Create the new NAColumn and insert it into the NAColumnArray newCol = new (heap) NAColumn ( (char *)nameStr.data() , currentCol +1 , newColType , heap , NULL // NATable * , USER_COLUMN , COM_NO_DEFAULT , NULL // default value , NULL , FALSE , FALSE // addedColumn , colDirection , FALSE , NULL// (char *) ucol->routineParamType ); inParams_->insert (newCol); params_->insert (newCol ); } // for passThruDataNumEntries_ = 0; passThruData_ = NULL; passThruDataSize_ = NULL; // Copy privilege information heapSize_ = (heap ? heap->getTotalSize() : 0); } // NARoutine
Bool16 QTSSAuthorize(QTSS_StandardRTSP_Params* inParams, char* pathBuff) { QTSS_Error theErr = QTSS_NoErr; Bool16 result = false; const int kBuffLen = 256; char passwordBuff[kBuffLen] = {}; char nameBuff[kBuffLen] = {}; StrPtrLen nameStr(nameBuff, kBuffLen -1); StrPtrLen passwordStr(passwordBuff, kBuffLen -1); Bool16 noUserName = false; Bool16 noPassword = false; Bool16 isSpecialGuest = false; do { theErr = QTSS_GetValue (inParams->inRTSPRequest,qtssRTSPReqUserName,0, (void *) nameStr.Ptr, &nameStr.Len); //qtss_printf("GetValue qtssRTSPReqUserName err =%"_S32BITARG_" \n",theErr); if ( (theErr != QTSS_NoErr) || (nameStr.Len == 0) || (nameStr.Ptr == NULL) || (*nameStr.Ptr == '\0')) { //qtss_printf ("no user name\n"); noUserName = true; } //qtss_printf("RTSPRequest dictionary name =%s len = %"_S32BITARG_"\n",nameStr.Ptr, nameStr.Len); theErr = QTSS_GetValue (inParams->inRTSPRequest,qtssRTSPReqUserPassword,0, (void *) passwordStr.Ptr, &passwordStr.Len); //qtss_printf("GetValue qtssRTSPReqUserName err =%"_S32BITARG_" \n",theErr); if ( (theErr != QTSS_NoErr) || (passwordStr.Len == 0) || (passwordStr.Ptr == NULL) || (*passwordStr.Ptr == '\0')) { //qtss_printf ("no Password\n"); noPassword = true; } //qtss_printf("RTSPRequest dictionary password =%s len = %"_S32BITARG_" \n",passwordStr.Ptr, passwordStr.Len); if (noUserName && noPassword) isSpecialGuest = true; if (isSpecialGuest) // no name and no password means guest { //qtss_printf ("User is guest check for access\n"); result = CheckWorldDirAccess(pathBuff); if (true == result) result = CheckWorldFileAccess(pathBuff); break; // no further processing on guest } if (0 == strcasecmp(nameStr.Ptr, sRootUserPtr) ) { //qtss_printf("user is root no root access to file =%s\n",pathBuff); // must log result = false; // don't allow break; } struct passwd *passwdStructPtr = getpwnam(nameStr.Ptr); if (NULL == passwdStructPtr) { //qtss_printf("failed to find name =%s\n",passwordStr.Ptr); break; } char *theCryptedPassword = crypt(passwordStr.Ptr, passwdStructPtr->pw_passwd); if ( 0 != strcmp(passwdStructPtr->pw_passwd, theCryptedPassword ) ) { //qtss_printf("failed to match name to password =%s\n",passwordStr.Ptr); break; } result = CheckDirAccess(passwdStructPtr, &nameStr, pathBuff); if (!result) break; result = CheckFileAccess(passwdStructPtr, &nameStr, pathBuff); if (!result) break; //qtss_printf("QTSSAuthorize: user %s is authorized for %s\n",nameStr.Ptr,pathBuff); } while (false); if (!result) { //qtss_printf("QTSSAuthorize: user %s is un authorized for %s\n",nameStr.Ptr,pathBuff); } return result; }
QTSS_Error AuthenticateRTSPRequest(QTSS_RTSPAuth_Params* inParams) { OSMutexLocker locker(sAuthMutex); QTSS_RTSPRequestObject theRTSPRequest = inParams->inRTSPRequest; QTSS_AuthScheme authScheme = qtssAuthNone; debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest start\n"); if ( (NULL == inParams) || (NULL == inParams->inRTSPRequest) ) { debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest inParams NULL\n"); return QTSS_RequestFailed; } // Get the user profile object from the request object QTSS_UserProfileObject theUserProfile = NULL; UInt32 len = sizeof(QTSS_UserProfileObject); QTSS_Error theErr = QTSS_GetValue(theRTSPRequest, qtssRTSPReqUserProfile, 0, (void*)&theUserProfile, &len); Assert(len == sizeof(QTSS_UserProfileObject)); if (theErr != QTSS_NoErr) { debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - username error is %"_S32BITARG_"\n", theErr); return theErr; } char* nameBuff = NULL; theErr = QTSS_GetValueAsString(theUserProfile, qtssUserName, 0, &nameBuff); debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - username is %s\n", nameBuff); OSCharArrayDeleter usernameBufDeleter(nameBuff); if (theErr != QTSS_NoErr) { debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - theUserProfile nameBuff error is %"_S32BITARG_"\n", theErr); } len = sizeof(authScheme); theErr = QTSS_GetValue(theRTSPRequest, qtssRTSPReqAuthScheme, 0, (void*)&authScheme, &len); if (theErr != QTSS_NoErr) return theErr; DSAccessChecker accessChecker; Bool16 allowed = true; Bool16 foundUser = true; Bool16 authHandled = true; if ( authScheme == qtssAuthDigest) { debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - authScheme = qtssAuthDigest\n"); char* challengeBuff = NULL; (void) QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqDigestChallenge, 0, &challengeBuff); OSCharArrayDeleter challengeDeleter(challengeBuff); debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - Server Challenge =%s\n",challengeBuff); char* responseBuff = NULL; (void) QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqDigestResponse, 0, &responseBuff); OSCharArrayDeleter responseDeleter(responseBuff); char* methodBuff = NULL; (void) QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqMethodStr, 0, &methodBuff); OSCharArrayDeleter methodDeleter(methodBuff); debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - Server Method =%s\n",methodBuff); debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - username is %s challenge=%s response=%s method=%s\n", nameBuff, challengeBuff, responseBuff, methodBuff); if ( false == accessChecker.CheckDigest(nameBuff, challengeBuff, responseBuff, methodBuff) ) { debug_printf("QTSSDSAuthModule CheckDigest returned false\n"); } else { debug_printf("QTSSDSAuthModule CheckDigest returned true\n"); (void) QTSSModuleUtils::AuthorizeRequest(theRTSPRequest,&allowed,&foundUser,&authHandled); } } if ( authScheme == qtssAuthBasic) { debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - authScheme = qtssAuthBasic\n"); char passwordBuff[kBuffLen]; StrPtrLen passwordStr(passwordBuff, kBuffLen -1); char nameBuff[kBuffLen]; StrPtrLen nameStr(nameBuff, kBuffLen -1); theErr = QTSS_GetValue (inParams->inRTSPRequest,qtssRTSPReqUserName,0, (void *) nameStr.Ptr, &nameStr.Len); if ( (QTSS_NoErr != theErr) || (nameStr.Len >= kBuffLen) ) { debug_printf("QTSSDSAuthModule:AuthenticateRequest() Username Error - %"_S32BITARG_"\n", theErr); return false; } theErr = QTSS_GetValue (inParams->inRTSPRequest,qtssRTSPReqUserPassword,0, (void *) passwordStr.Ptr, &passwordStr.Len); if ( (QTSS_NoErr != theErr) || (passwordStr.Len >= kBuffLen) ) { debug_printf("QTSSDSAuthModule:AuthenticateRequest() Password Error - %"_S32BITARG_"\n", theErr); } nameBuff[nameStr.Len] = '\0'; passwordBuff[passwordStr.Len] = '\0'; debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - username is %s\n", nameBuff); debug_printf("QTSSDSAuthModule:AuthenticateRTSPRequest - password is %s\n", passwordBuff); if ( !accessChecker.CheckPassword(nameBuff, passwordBuff) ) { debug_printf("QTSSDSAuthModule CheckPassword returned false\n"); } else { debug_printf("QTSSDSAuthModule CheckPassword returned true\n"); (void) QTSSModuleUtils::AuthorizeRequest(theRTSPRequest,&allowed,&foundUser,&authHandled); } } return QTSS_NoErr; }
const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* end, HTTPHeaderMap* headers) { Vector<char> name; Vector<char> value; for (const char* p = start; p < end; p++) { name.clear(); value.clear(); for (; p < end; p++) { switch (*p) { case '\r': if (name.isEmpty()) { if (p + 1 < end && *(p + 1) == '\n') return p + 2; m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF at " + String(p, end - p), 0, clientOrigin()); return 0; } m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected CR in name at " + String(p, end - p), 0, clientOrigin()); return 0; case '\n': m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in name at " + String(p, end - p), 0, clientOrigin()); return 0; case ':': break; default: if (*p >= 0x41 && *p <= 0x5a) name.append(*p + 0x20); else name.append(*p); continue; } if (*p == ':') { ++p; break; } } for (; p < end && *p == 0x20; p++) { } for (; p < end; p++) { switch (*p) { case '\r': break; case '\n': m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in value at " + String(p, end - p), 0, clientOrigin()); return 0; default: value.append(*p); } if (*p == '\r') { ++p; break; } } if (p >= end || *p != '\n') { m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF after value at " + String(p, end - p), 0, clientOrigin()); return 0; } AtomicString nameStr(String::fromUTF8(name.data(), name.size())); String valueStr = String::fromUTF8(value.data(), value.size()); LOG(Network, "name=%s value=%s", nameStr.string().utf8().data(), valueStr.utf8().data()); headers->add(nameStr, valueStr); } ASSERT_NOT_REACHED(); return 0; }
bool nsXHTMLContentSerializer::SerializeAttributes(nsIContent* aContent, nsIContent *aOriginalElement, nsAString& aTagPrefix, const nsAString& aTagNamespaceURI, nsIAtom* aTagName, nsAString& aStr, uint32_t aSkipAttr, bool aAddNSAttr) { nsresult rv; uint32_t index, count; nsAutoString prefixStr, uriStr, valueStr; nsAutoString xmlnsStr; xmlnsStr.AssignLiteral(kXMLNS); int32_t contentNamespaceID = aContent->GetNameSpaceID(); // this method is not called by nsHTMLContentSerializer // so we don't have to check HTML element, just XHTML if (mIsCopying && kNameSpaceID_XHTML == contentNamespaceID) { // Need to keep track of OL and LI elements in order to get ordinal number // for the LI. if (aTagName == nsGkAtoms::ol) { // We are copying and current node is an OL; // Store its start attribute value in olState->startVal. nsAutoString start; int32_t startAttrVal = 0; aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start); if (!start.IsEmpty()) { nsresult rv = NS_OK; startAttrVal = start.ToInteger(&rv); //If OL has "start" attribute, first LI element has to start with that value //Therefore subtracting 1 as all the LI elements are incrementing it before using it; //In failure of ToInteger(), default StartAttrValue to 0. if (NS_SUCCEEDED(rv)) --startAttrVal; else startAttrVal = 0; } olState state (startAttrVal, true); mOLStateStack.AppendElement(state); } else if (aTagName == nsGkAtoms::li) { mIsFirstChildOfOL = IsFirstChildOfOL(aOriginalElement); if (mIsFirstChildOfOL) { // If OL is parent of this LI, serialize attributes in different manner. NS_ENSURE_TRUE(SerializeLIValueAttribute(aContent, aStr), false); } } } // If we had to add a new namespace declaration, serialize // and push it on the namespace stack if (aAddNSAttr) { if (aTagPrefix.IsEmpty()) { // Serialize default namespace decl NS_ENSURE_TRUE(SerializeAttr(EmptyString(), xmlnsStr, aTagNamespaceURI, aStr, true), false); } else { // Serialize namespace decl NS_ENSURE_TRUE(SerializeAttr(xmlnsStr, aTagPrefix, aTagNamespaceURI, aStr, true), false); } PushNameSpaceDecl(aTagPrefix, aTagNamespaceURI, aOriginalElement); } NS_NAMED_LITERAL_STRING(_mozStr, "_moz"); count = aContent->GetAttrCount(); // Now serialize each of the attributes // XXX Unfortunately we need a namespace manager to get // attribute URIs. for (index = 0; index < count; index++) { if (aSkipAttr == index) { continue; } const nsAttrName* name = aContent->GetAttrNameAt(index); int32_t namespaceID = name->NamespaceID(); nsIAtom* attrName = name->LocalName(); nsIAtom* attrPrefix = name->GetPrefix(); // Filter out any attribute starting with [-|_]moz nsDependentAtomString attrNameStr(attrName); if (StringBeginsWith(attrNameStr, NS_LITERAL_STRING("_moz")) || StringBeginsWith(attrNameStr, NS_LITERAL_STRING("-moz"))) { continue; } if (attrPrefix) { attrPrefix->ToString(prefixStr); } else { prefixStr.Truncate(); } bool addNSAttr = false; if (kNameSpaceID_XMLNS != namespaceID) { nsContentUtils::NameSpaceManager()->GetNameSpaceURI(namespaceID, uriStr); addNSAttr = ConfirmPrefix(prefixStr, uriStr, aOriginalElement, true); } aContent->GetAttr(namespaceID, attrName, valueStr); nsDependentAtomString nameStr(attrName); bool isJS = false; if (kNameSpaceID_XHTML == contentNamespaceID) { // // Filter out special case of <br type="_moz"> or <br _moz*>, // used by the editor. Bug 16988. Yuck. // if (namespaceID == kNameSpaceID_None && aTagName == nsGkAtoms::br && attrName == nsGkAtoms::type && StringBeginsWith(valueStr, _mozStr)) { continue; } if (mIsCopying && mIsFirstChildOfOL && (aTagName == nsGkAtoms::li) && (attrName == nsGkAtoms::value)) { // This is handled separately in SerializeLIValueAttribute() continue; } isJS = IsJavaScript(aContent, attrName, namespaceID, valueStr); if (namespaceID == kNameSpaceID_None && ((attrName == nsGkAtoms::href) || (attrName == nsGkAtoms::src))) { // Make all links absolute when converting only the selection: if (mFlags & nsIDocumentEncoder::OutputAbsoluteLinks) { // Would be nice to handle OBJECT and APPLET tags, // but that gets more complicated since we have to // search the tag list for CODEBASE as well. // For now, just leave them relative. nsCOMPtr<nsIURI> uri = aContent->GetBaseURI(); if (uri) { nsAutoString absURI; rv = NS_MakeAbsoluteURI(absURI, valueStr, uri); if (NS_SUCCEEDED(rv)) { valueStr = absURI; } } } // Need to escape URI. nsAutoString tempURI(valueStr); if (!isJS && NS_FAILED(EscapeURI(aContent, tempURI, valueStr))) valueStr = tempURI; } if (mRewriteEncodingDeclaration && aTagName == nsGkAtoms::meta && attrName == nsGkAtoms::content) { // If we're serializing a <meta http-equiv="content-type">, // use the proper value, rather than what's in the document. nsAutoString header; aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header); if (header.LowerCaseEqualsLiteral("content-type")) { valueStr = NS_LITERAL_STRING("text/html; charset=") + NS_ConvertASCIItoUTF16(mCharset); } } // Expand shorthand attribute. if (namespaceID == kNameSpaceID_None && IsShorthandAttr(attrName, aTagName) && valueStr.IsEmpty()) { valueStr = nameStr; } } else { isJS = IsJavaScript(aContent, attrName, namespaceID, valueStr); } NS_ENSURE_TRUE(SerializeAttr(prefixStr, nameStr, valueStr, aStr, !isJS), false); if (addNSAttr) { NS_ASSERTION(!prefixStr.IsEmpty(), "Namespaced attributes must have a prefix"); NS_ENSURE_TRUE(SerializeAttr(xmlnsStr, prefixStr, uriStr, aStr, true), false); PushNameSpaceDecl(prefixStr, uriStr, aOriginalElement); } } return true; }
PlatformFontRef XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) // ptSize is in TeX points, or negative for 'scaled' factor // "variant" string will be shortened (in-place) by removal of /B and /I if present { std::string nameStr(name); Font* font = NULL; int dsize = 100; loadedfontdesignsize = 655360L; for (int pass = 0; pass < 2; ++pass) { // try full name as given std::map<std::string,Font*>::iterator i = nameToFont.find(nameStr); if (i != nameToFont.end()) { font = i->second; if (font->opSizeInfo.designSize != 0) dsize = font->opSizeInfo.designSize; break; } // if there's a hyphen, split there and try Family-Style int hyph = nameStr.find('-'); if (hyph > 0 && hyph < nameStr.length() - 1) { std::string family(nameStr.begin(), nameStr.begin() + hyph); std::map<std::string,Family*>::iterator f = nameToFamily.find(family); if (f != nameToFamily.end()) { std::string style(nameStr.begin() + hyph + 1, nameStr.end()); i = f->second->styles->find(style); if (i != f->second->styles->end()) { font = i->second; if (font->opSizeInfo.designSize != 0) dsize = font->opSizeInfo.designSize; break; } } } // try as PostScript name i = psNameToFont.find(nameStr); if (i != psNameToFont.end()) { font = i->second; if (font->opSizeInfo.designSize != 0) dsize = font->opSizeInfo.designSize; break; } // try for the name as a family name std::map<std::string,Family*>::iterator f = nameToFamily.find(nameStr); if (f != nameToFamily.end()) { // look for a family member with the "regular" bit set in OS/2 int regFonts = 0; for (i = f->second->styles->begin(); i != f->second->styles->end(); ++i) if (i->second->isReg) { if (regFonts == 0) font = i->second; ++regFonts; } // families with Ornament or similar fonts may flag those as Regular, // which confuses the search above... so try some known names if (font == NULL || regFonts > 1) { // try for style "Regular", "Plain", "Normal", "Roman" i = f->second->styles->find("Regular"); if (i != f->second->styles->end()) font = i->second; else { i = f->second->styles->find("Plain"); if (i != f->second->styles->end()) font = i->second; else { i = f->second->styles->find("Normal"); if (i != f->second->styles->end()) font = i->second; else { i = f->second->styles->find("Roman"); if (i != f->second->styles->end()) font = i->second; } } } } if (font == NULL) { // look through the family for the (weight, width, slant) nearest to (80, 100, 0) font = bestMatchFromFamily(f->second, 80, 100, 0); } if (font != NULL) break; } if (pass == 0) { // didn't find it in our caches, so do a platform search (may be relatively expensive); // this will update the caches with any fonts that seem to match the name given, // so that the second pass might find it searchForHostPlatformFonts(nameStr); } } if (font == NULL) return 0; Family* parent = font->parent; // if there are variant requests, try to apply them // and delete B, I, and S=... codes from the string, just retain /engine option sReqEngine = 0; bool reqBold = false; bool reqItal = false; if (variant != NULL) { std::string varString; char* cp = variant; while (*cp) { if (strncmp(cp, "AAT", 3) == 0) { sReqEngine = 'A'; cp += 3; if (varString.length() > 0 && *(varString.end() - 1) != '/') varString.append("/"); varString.append("AAT"); goto skip_to_slash; } if (strncmp(cp, "ICU", 3) == 0) { // for backword compatability sReqEngine = 'O'; cp += 3; if (varString.length() > 0 && *(varString.end() - 1) != '/') varString.append("/"); varString.append("OT"); goto skip_to_slash; } if (strncmp(cp, "OT", 2) == 0) { sReqEngine = 'O'; cp += 2; if (varString.length() > 0 && *(varString.end() - 1) != '/') varString.append("/"); varString.append("OT"); goto skip_to_slash; } if (strncmp(cp, "GR", 2) == 0) { sReqEngine = 'G'; cp += 2; if (varString.length() > 0 && *(varString.end() - 1) != '/') varString.append("/"); varString.append("GR"); goto skip_to_slash; } if (*cp == 'S') { char* start = cp; ++cp; if (*cp == '=') ++cp; ptSize = 0.0; while (*cp >= '0' && *cp <= '9') { ptSize = ptSize * 10 + *cp - '0'; ++cp; } if (*cp == '.') { double dec = 1.0; ++cp; while (*cp >= '0' && *cp <= '9') { dec = dec * 10.0; ptSize = ptSize + (*cp - '0') / dec; ++cp; } } goto skip_to_slash; } /* if the code is "B" or "I", we skip putting it in varString */ while (1) { if (*cp == 'B') { reqBold = true; ++cp; continue; } if (*cp == 'I') { reqItal = true; ++cp; continue; } break; } skip_to_slash: while (*cp && *cp != '/') ++cp; if (*cp == '/') ++cp; } strcpy(variant, varString.c_str()); std::map<std::string,Font*>::iterator i; if (reqItal) { Font* bestMatch = font; if (font->slant < parent->maxSlant) // try for a face with more slant bestMatch = bestMatchFromFamily(parent, font->weight, font->width, parent->maxSlant); if (bestMatch == font && font->slant > parent->minSlant) // maybe the slant is negated, or maybe this was something like "Times-Italic/I" bestMatch = bestMatchFromFamily(parent, font->weight, font->width, parent->minSlant); if (parent->minWeight == parent->maxWeight && bestMatch->isBold != font->isBold) { // try again using the bold flag, as we can't trust weight values Font* newBest = NULL; for (i = parent->styles->begin(); i != parent->styles->end(); ++i) { if (i->second->isBold == font->isBold) { if (newBest == NULL && i->second->isItalic != font->isItalic) { newBest = i->second; break; } } } if (newBest != NULL) bestMatch = newBest; } if (bestMatch == font) { // maybe slant values weren't present; try the style bits as a fallback bestMatch = NULL; for (i = parent->styles->begin(); i != parent->styles->end(); ++i) { if (i->second->isItalic == !font->isItalic) { if (parent->minWeight != parent->maxWeight) { // weight info was available, so try to match that if (bestMatch == NULL || weightAndWidthDiff(i->second, font) < weightAndWidthDiff(bestMatch, font)) bestMatch = i->second; } else { // no weight info, so try matching style bits if (bestMatch == NULL && i->second->isBold == font->isBold) { bestMatch = i->second; break; // found a match, no need to look further as we can't distinguish! } } } } } if (bestMatch != NULL) font = bestMatch; } if (reqBold) { // try for more boldness, with the same width and slant Font* bestMatch = font; if (font->weight < parent->maxWeight) { // try to increase weight by 1/2 x (max - min), rounding up bestMatch = bestMatchFromFamily(parent, font->weight + (parent->maxWeight - parent->minWeight) / 2 + 1, font->width, font->slant); if (parent->minSlant == parent->maxSlant) { // double-check the italic flag, as we can't trust slant values Font* newBest = NULL; for (i = parent->styles->begin(); i != parent->styles->end(); ++i) { if (i->second->isItalic == font->isItalic) { if (newBest == NULL || weightAndWidthDiff(i->second, bestMatch) < weightAndWidthDiff(newBest, bestMatch)) newBest = i->second; } } if (newBest != NULL) bestMatch = newBest; } } if (bestMatch == font && !font->isBold) { for (i = parent->styles->begin(); i != parent->styles->end(); ++i) { if (i->second->isItalic == font->isItalic && i->second->isBold) { bestMatch = i->second; break; } } } font = bestMatch; } } // if there's optical size info, try to apply it if (ptSize < 0.0) ptSize = dsize / 10.0; if (font != NULL && font->opSizeInfo.subFamilyID != 0 && ptSize > 0.0) { ptSize = ptSize * 10.0; // convert to decipoints for comparison with the opSize values double bestMismatch = my_fmax(font->opSizeInfo.minSize - ptSize, ptSize - font->opSizeInfo.maxSize); if (bestMismatch > 0.0) { Font* bestMatch = font; for (std::map<std::string,Font*>::iterator i = parent->styles->begin(); i != parent->styles->end(); ++i) { if (i->second->opSizeInfo.subFamilyID != font->opSizeInfo.subFamilyID) continue; double mismatch = my_fmax(i->second->opSizeInfo.minSize - ptSize, ptSize - i->second->opSizeInfo.maxSize); if (mismatch < bestMismatch) { bestMatch = i->second; bestMismatch = mismatch; } if (bestMismatch <= 0.0) break; } font = bestMatch; } } if (font != NULL && font->opSizeInfo.designSize != 0) loadedfontdesignsize = (font->opSizeInfo.designSize << 16L) / 10; if (gettracingfontsstate() > 0) { begindiagnostic(); zprintnl(' '); printcstring("-> "); printcstring(getPlatformFontDesc(font->fontRef).c_str()); zenddiagnostic(0); } return font->fontRef; }
// Convert from a jsval to an AtNode static AtSmartPtr<AtNode> ConvertNode(JSContext* cx, jsval node) { AtSmartPtr<AtNode> obj (new AtNode()); // Non-objects get converted into strings if (!JSVAL_IS_OBJECT(node)) { JSString* str = JS_ValueToString(cx, node); if (!str) return obj; // error size_t valueLen; const jschar* valueChars = JS_GetStringCharsAndLength(str, &valueLen); if (!valueChars) return obj; // error wxString valueWx(reinterpret_cast<const char*>(valueChars), wxMBConvUTF16(), valueLen*2); obj->value = valueWx.c_str(); // Annotate numbers/booleans specially, to allow round-tripping if (JSVAL_IS_NUMBER(node)) { obj->children.insert(AtNode::child_pairtype( "@number", AtSmartPtr<AtNode>(new AtNode()) )); } else if (JSVAL_IS_BOOLEAN(node)) { obj->children.insert(AtNode::child_pairtype( "@boolean", AtSmartPtr<AtNode>(new AtNode()) )); } return obj; } JSObject* it = JS_NewPropertyIterator(cx, JSVAL_TO_OBJECT(node)); if (!it) return obj; // error while (true) { jsid idp; jsval val; if (! JS_NextProperty(cx, it, &idp) || ! JS_IdToValue(cx, idp, &val)) return obj; // error if (val == JSVAL_VOID) break; // end of iteration if (! JSVAL_IS_STRING(val)) continue; // ignore integer properties JSString* name = JSVAL_TO_STRING(val); size_t len = JS_GetStringLength(name); jschar* chars = JS_GetStringChars(name); wxString nameWx(reinterpret_cast<char*>(chars), wxMBConvUTF16(), len*2); std::string nameStr(nameWx.ToUTF8().data()); jsval vp; if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(node), idp, &vp)) return obj; // error // Unwrap arrays into a special format like <$name><item>$i0</item><item>... // (This assumes arrays aren't nested) if (JSVAL_IS_OBJECT(vp) && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(vp))) { AtSmartPtr<AtNode> child(new AtNode()); child->children.insert(AtNode::child_pairtype( "@array", AtSmartPtr<AtNode>(new AtNode()) )); jsuint arrayLength; if (!JS_GetArrayLength(cx, JSVAL_TO_OBJECT(vp), &arrayLength)) return obj; // error for (jsuint i = 0; i < arrayLength; ++i) { jsval val; if (!JS_GetElement(cx, JSVAL_TO_OBJECT(vp), i, &val)) return obj; // error child->children.insert(AtNode::child_pairtype( "item", ConvertNode(cx, val) )); } obj->children.insert(AtNode::child_pairtype( nameStr, child )); } else { obj->children.insert(AtNode::child_pairtype( nameStr, ConvertNode(cx, vp) )); } } return obj; }
bool Library::Declare(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, JS_THIS_OBJECT(cx, vp)); if (!obj) return false; if (!IsLibrary(obj)) { JS_ReportError(cx, "not a library"); return false; } PRLibrary* library = GetLibrary(obj); if (!library) { JS_ReportError(cx, "library not open"); return false; } // We allow two API variants: // 1) library.declare(name, abi, returnType, argType1, ...) // declares a function with the given properties, and resolves the symbol // address in the library. // 2) library.declare(name, type) // declares a symbol of 'type', and resolves it. The object that comes // back will be of type 'type', and will point into the symbol data. // This data will be both readable and writable via the usual CData // accessors. If 'type' is a PointerType to a FunctionType, the result will // be a function pointer, as with 1). if (args.length() < 2) { JS_ReportError(cx, "declare requires at least two arguments"); return false; } if (!args[0].isString()) { JS_ReportError(cx, "first argument must be a string"); return false; } RootedObject fnObj(cx, nullptr); RootedObject typeObj(cx); bool isFunction = args.length() > 2; if (isFunction) { // Case 1). // Create a FunctionType representing the function. fnObj = FunctionType::CreateInternal(cx, args[1], args[2], HandleValueArray::subarray(args, 3, args.length() - 3)); if (!fnObj) return false; // Make a function pointer type. typeObj = PointerType::CreateInternal(cx, fnObj); if (!typeObj) return false; } else { // Case 2). if (args[1].isPrimitive() || !CType::IsCType(args[1].toObjectOrNull()) || !CType::IsSizeDefined(args[1].toObjectOrNull())) { JS_ReportError(cx, "second argument must be a type of defined size"); return false; } typeObj = args[1].toObjectOrNull(); if (CType::GetTypeCode(typeObj) == TYPE_pointer) { fnObj = PointerType::GetBaseType(typeObj); isFunction = fnObj && CType::GetTypeCode(fnObj) == TYPE_function; } } void* data; PRFuncPtr fnptr; RootedString nameStr(cx, args[0].toString()); AutoCString symbol; if (isFunction) { // Build the symbol, with mangling if necessary. FunctionType::BuildSymbolName(nameStr, fnObj, symbol); AppendString(symbol, "\0"); // Look up the function symbol. fnptr = PR_FindFunctionSymbol(library, symbol.begin()); if (!fnptr) { JS_ReportError(cx, "couldn't find function symbol in library"); return false; } data = &fnptr; } else { // 'typeObj' is another data type. Look up the data symbol. AppendString(symbol, nameStr); AppendString(symbol, "\0"); data = PR_FindSymbol(library, symbol.begin()); if (!data) { JS_ReportError(cx, "couldn't find symbol in library"); return false; } } RootedObject result(cx, CData::Create(cx, typeObj, obj, data, isFunction)); if (!result) return false; if (isFunction) JS_SetReservedSlot(result, SLOT_FUNNAME, StringValue(nameStr)); args.rval().setObject(*result); // Seal the CData object, to prevent modification of the function pointer. // This permanently associates this object with the library, and avoids // having to do things like reset SLOT_REFERENT when someone tries to // change the pointer value. // XXX This will need to change when bug 541212 is fixed -- CData::ValueSetter // could be called on a sealed object. if (isFunction && !JS_FreezeObject(cx, result)) return false; return true; }
void SecurityItem::updateItem() { if (!rsPeers) return; /* fill in */ #ifdef DEBUG_ITEM std::cerr << "SecurityItem::updateItem()"; std::cerr << std::endl; #endif if(!RsAutoUpdatePage::eventsLocked()) { /* set textcolor for peer name */ QString nameStr("<span style=\"font-size:14pt; font-weight:500;color:#990033;\">%1</span>"); RsPeerDetails details; /* first try sslid */ if (!rsPeers->getPeerDetails(mSslId, details)) { /* then gpgid */ if (!rsPeers->getPeerDetails(mGpgId, details)) { /* it is very likely that we will end up here for some of the * Unknown peer cases.... so allow them here */ /* set peer name */ peernameLabel->setText(nameStr.arg(tr("Unknown Peer"))); nameLabel->setText(QString::fromStdString(mGpgId)); idLabel->setText(QString::fromStdString(mSslId)); statusLabel->setText(tr("Unknown Peer")); trustLabel->setText(tr("Unknown Peer")); locLabel->setText(tr("Unknown Peer")); ipLabel->setText(tr("Unknown Peer")); connLabel->setText(tr("Unknown Peer")); chatButton->setEnabled(false); quickmsgButton->setEnabled(false); addFriendButton->setEnabled(false); addFriendButton->show(); removeFriendButton->setEnabled(false); removeFriendButton->hide(); peerDetailsButton->setEnabled(false); return; } } /* set peer name */ QString peername = QString::fromUtf8(details.name.c_str()); peernameLabel->setText(nameStr.arg(peername)); /* expanded Info */ nameLabel->setText(QString::fromUtf8(details.name.c_str())); idLabel->setText(QString::fromStdString(details.id)); locLabel->setText(QString::fromUtf8(details.location.c_str())); /* top Level info */ QString status = StatusDefs::peerStateString(details.state); #if 0 /* Append additional status info from status service */ StatusInfo statusInfo; if ((rsStatus) && (rsStatus->getStatus(*it, statusInfo))) { status.append(QString::fromStdString("/" + RsStatusString(statusInfo.status))); } #endif statusLabel->setText(status); trustLabel->setText(QString::fromStdString(RsPeerTrustString(details.trustLvl))); { std::ostringstream out; out << details.localAddr << ":"; out << details.localPort << "/"; out << details.extAddr << ":"; out << details.extPort; ipLabel->setText(QString::fromStdString(out.str())); } connLabel->setText(StatusDefs::connectStateString(details)); /* do buttons */ chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED); peerDetailsButton->setEnabled(true); if (details.accept_connection) { addFriendButton->setEnabled(false); addFriendButton->hide(); removeFriendButton->setEnabled(true); removeFriendButton->show(); } else { addFriendButton->setEnabled(true); addFriendButton->show(); removeFriendButton->setEnabled(false); removeFriendButton->hide(); } if (details.state & RS_PEER_STATE_FRIEND) { quickmsgButton->setEnabled(true); } else { quickmsgButton->setEnabled(false); } } /* slow Tick */ int msec_rate = 10129; QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) )); return; }
void QTorrentItemDelegat::drawTorrent(QPainter* painter, const QStyleOptionViewItem& option, const Torrent& tor, const QModelIndex& index) const { QStyleOptionViewItemV4 opt = option; initStyleOption(&opt, index); QStyle* style; if(opt.widget != NULL) { style = opt.widget->style(); } else { style = QApplication::style(); } const int iconSize(style->pixelMetric(QStyle::PM_LargeIconSize)); QFont nameFont(option.font); nameFont.setWeight(QFont::Bold); const QFontMetrics nameFM(nameFont); const QIcon mimeIcon(tor.GetMimeTypeIcon()); QString nameStr(tor.GetName()); QSize nameSize(nameFM.size(0, nameStr)); QFont statusFont(option.font); statusFont.setPointSize(int (option.font.pointSize() * 0.9)); const QFontMetrics statusFM(statusFont); QString statusStr(GetStatusString(tor)); int statusWidth = statusFM.width(statusStr); QFont progressFont(statusFont); const QFontMetrics progressFM(progressFont); QString progressStr(GetProgressString(tor)); bool isPaused(tor.isPaused()); painter->save(); painter->setRenderHint(QPainter::Antialiasing); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget); /* if (option.state & QStyle::State_Selected) { QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Active : QPalette::Disabled; if (cg == QPalette::Normal && !(option.state & QStyle::State_Active)) cg = QPalette::Inactive; painter->fillRect(option.rect, opt.backgroundBrush); }*/ //style->drawControl(QStyle::CE_ItemViewItem,&option,painter); QIcon::Mode im; if(isPaused || !(option.state & QStyle::State_Enabled)) { im = QIcon::Disabled; } else if(option.state & QStyle::State_Selected) { im = QIcon::Selected; } else { im = QIcon::Normal; } QIcon::State qs; if(isPaused) { qs = QIcon::Off; } else { qs = QIcon::On; } QPalette::ColorGroup cg = QPalette::Normal; if(isPaused || !(option.state & QStyle::State_Enabled)) { cg = QPalette::Disabled; } if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) { cg = QPalette::Inactive; } QPalette::ColorRole cr; if(option.state & QStyle::State_Selected) { cr = QPalette::HighlightedText; } cr = QPalette::Text; // layout const QSize m(margin(*style)); QRect fillArea(option.rect); fillArea.adjust(m.width(), m.height(), -m.width(), -m.height()); QRect iconArea(fillArea.x(), fillArea.y() + (fillArea.height() - iconSize) / 2, iconSize, iconSize); QRect nameArea(iconArea.x() + iconArea.width() + GUI_PAD, fillArea.y(), fillArea.width() - GUI_PAD - iconArea.width(), nameSize.height()); if (nameArea.width() + nameArea.x() > opt.rect.width()) { nameArea.setWidth(opt.rect.width() - nameArea.x()); } QRect barArea(nameArea.x(), nameArea.y() + statusFM.lineSpacing() + GUI_PAD / 2, nameArea.width(), BAR_HEIGHT); QRect progArea(nameArea.x(), barArea.y() + barArea.height() + GUI_PAD / 2, barArea.width() - statusWidth, nameArea.height()); QRect statusArea(progArea.x() + progArea.width(), progArea.y(), statusWidth, progArea.height()); if(tor.hasError()) { painter->setPen(QColor("red")); } else { painter->setPen(opt.palette.color(cg, cr)); } mimeIcon.paint(painter, iconArea, Qt::AlignCenter, im, qs); painter->setFont(nameFont); nameStr = nameFM.elidedText(nameStr, Qt::ElideRight, nameArea.width()); style->drawItemText(painter, nameArea, Qt::AlignLeft, opt.palette, option.state & QStyle::State_Enabled, nameStr); painter->setFont(statusFont); statusStr = statusFM.elidedText(statusStr, Qt::ElideRight, statusArea.width()); style->drawItemText(painter, statusArea, Qt::AlignRight, opt.palette, option.state & QStyle::State_Enabled, statusStr); painter->setFont(progressFont); progressStr = statusFM.elidedText(progressStr, Qt::ElideRight, progArea.width()); style->drawItemText(painter, progArea, Qt::AlignLeft, opt.palette, option.state & QStyle::State_Enabled, progressStr); int progressPercentage = tor.GetProgress(); myProgressBarStyle->resize(barArea.size()); myProgressBarStyle->setValue(progressPercentage); //painter->translate(barArea.topLeft()); //myProgressBarStyle->render(painter); QStyleOptionProgressBarV2 pbStyleOpt; myProgressBarStyle->initilizeStyleOption(&pbStyleOpt); pbStyleOpt.rect = barArea; /*myProgressBarStyle->rect = barArea; if ( tor.isDownloading() ) { myProgressBarStyle->palette.setBrush( QPalette::Highlight, blueBrush ); myProgressBarStyle->palette.setColor( QPalette::Base, blueBack ); myProgressBarStyle->palette.setColor( QPalette::Background, blueBack ); } else if ( tor.isSeeding() ) { myProgressBarStyle->palette.setBrush( QPalette::Highlight, greenBrush ); myProgressBarStyle->palette.setColor( QPalette::Base, greenBack ); myProgressBarStyle->palette.setColor( QPalette::Background, greenBack ); } myProgressBarStyle->state = progressBarState; setProgressBarPercentDone( option, tor ); */ style->drawControl(QStyle::CE_ProgressBar, &pbStyleOpt, painter, myProgressBarStyle); painter->restore(); }
gl_uint Txtr::add(RenderContext *renderContext, const fschar *name) { dAssert(isConsistent()); fsstring nameStr(name); gl_uint txtrId; // result variable std::map<fsstring, gl_uint>::iterator it = txtrIdPool.find(nameStr); if (it == txtrIdPool.end()) { if (hasImage()) { // Create an enlarged texture if necessary gl_uint width2 = width; gl_uint height2 = height; Txtr *enlargedTxtr = nullptr; Vecd txtrCoordRescale; if ( ! renderContext->hasFeature(RenderContext::FEATURE_TEXTURE_NON_POWER_OF_TWO_AVAILIBLE)) { bool wRes = conformSizeValue(width2); bool hRes = conformSizeValue(height2); if (wRes || hRes) { enlargedTxtr = new Txtr(width2, height2); copyTo(enlargedTxtr, 0, 0, true); //enlargedTxtr->duplicateRectangleEdges(0, 0, width, height); txtrCoordRescale.x = static_cast<double>(width) / static_cast<double>(width2); txtrCoordRescale.y = static_cast<double>(height) / static_cast<double>(height2); } } Txtr *txtrToLoad = enlargedTxtr ? enlargedTxtr : this; txtrId = renderContext->loadTxtr(txtrToLoad->getPixels(), width2, height2); if (enlargedTxtr) { delete enlargedTxtr; txtrRescaleMap[txtrId] = txtrCoordRescale; } } else { txtrId = defaultTxtr; } // add to pool txtrIdPool[nameStr] = txtrId; } else { // get from pool txtrId = it->second; } //if (hasImage()) //{ // std::map<std::wstring, GLuint>::iterator it = txtrIdPool.find(std::wstring(name)); // if (it == txtrIdPool.end()) // { // glGenTextures(1, &txtrId); // glBindTexture(GL_TEXTURE_2D, txtrId); // glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)pixels); // // // Perform these here? // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // // add to pool // txtrIdPool[std::wstring(name)] = txtrId; // } // else // { // // get from pool // txtrId = it->second; // } //} //else //{ // txtrId = defaultTxtr; // // add to pool // txtrIdPool[std::wstring(name)] = txtrId; //} return txtrId; }