void test_serde() { // dynamic create message. MessageHelper helper; FileDescriptorProto file_proto; file_proto.set_name("test.proo"); DescriptorProto *message_proto = file_proto.add_message_type(); message_proto->set_name("Pair"); auto field = message_proto->add_field(); field->set_name("key"); field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED); field->set_type(FieldDescriptorProto_Type_TYPE_STRING); field->set_number(1); field = message_proto->add_field(); field->set_name("value"); field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED); field->set_type(FieldDescriptorProto_Type_TYPE_BYTES); field->set_number(2); helper.registerDynamicMessage(file_proto); auto src = helper.createMessage("Pair"); auto ref = src->GetReflection(); string key("scott"); string value("tiger"); ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("key"), key); ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("value"), value); // test serde check_serde_str(src.get(), helper.createMessage("Pair").get()); check_serde_array(src.get(), helper.createMessage("Pair").get()); check_serstr_dearray(src.get(), helper.createMessage("Pair").get()); check_serarray_destr(src.get(), helper.createMessage("Pair").get()); }
void XHCIDevice::GetDeviceStringDesc(upan::string& desc, int descIndex) { desc = "Unknown"; if(_usLangID == 0) return; unsigned short usDescValue = (0x3 << 8); char* buffer = new char[8]; GetDescriptor(usDescValue | descIndex, _usLangID, -1, KERNEL_REAL_ADDRESS(buffer)); int iLen = reinterpret_cast<USBStringDescZero*>(buffer)->bLength ; if(iLen == 0) return; delete buffer; buffer = new char[iLen]; GetDescriptor(usDescValue | descIndex, _usLangID, iLen, KERNEL_REAL_ADDRESS(buffer)); int j, k; for(j = 0, k = 0; j < (iLen - 2); k++, j += 2) { //TODO: Ignoring Unicode 2nd byte for the time. buffer[k] = buffer[j + 2]; } buffer[k] = '\0'; desc = buffer; delete[] buffer; }
// 接收消息事件 virtual void on_message(network::NetMessage &message) override { if (client_life_.expired()) { close(); return; } auto response = ProtubufCodec::Decode(message); if (response == nullptr) { assert(false); return; } if (!is_logged_) { if (response->GetDescriptor() != com::PongRsp::descriptor()) { if (response->GetDescriptor() == dbproxy::LoginRsp::descriptor()) { is_logged_ = true; counter_ = heartbeat_interval_ = static_cast<dbproxy::LoginRsp*>(response.get())->heartbeat_interval(); } else { assert(false); } } } else if (response->GetDescriptor() != com::PongRsp::descriptor()) { client_->on_message(this, response.get()); } }
void EHCIDevice::GetDeviceStringDesc(upan::string& desc, int descIndex) { desc = "Unknown"; if(_usLangID == 0) return; unsigned short usDescValue = (0x3 << 8); char szPart[ 8 ]; if(!GetDescriptor(usDescValue | descIndex, _usLangID, -1, szPart)) return; int iLen = ((USBStringDescZero*)&szPart)->bLength ; // printf("\n String Index: %u, String Desc Size: %d", descIndex, iLen) ; if(iLen == 0) return; char* strDesc = new char[iLen]; if(!GetDescriptor(usDescValue | descIndex, _usLangID, iLen, strDesc)) { delete[] strDesc; return; } int j, k; for(j = 0, k = 0; j < (iLen - 2); k++, j += 2) { //TODO: Ignoring Unicode 2nd byte for the time. strDesc[k] = strDesc[j + 2]; } strDesc[k] = '\0'; desc = strDesc; delete[] strDesc; }
bool EHCIDevice::GetStringDescriptorZero() { unsigned short usDescValue = (0x3 << 8) ; char szPart[ 8 ]; if(!GetDescriptor(usDescValue, 0, -1, szPart)) return false; int iLen = ((USBStringDescZero*)&szPart)->bLength ; printf("\n String Desc Zero Len: %d", iLen) ; byte* pStringDescZero = (byte*)DMM_AllocateForKernel(iLen) ; if(!GetDescriptor(usDescValue, 0, iLen, pStringDescZero)) { DMM_DeAllocateForKernel((unsigned)pStringDescZero) ; return false; } _pStrDescZero = (USBStringDescZero*)DMM_AllocateForKernel(sizeof(USBStringDescZero)) ; USBDataHandler_CopyStrDescZero(_pStrDescZero, pStringDescZero) ; USBDataHandler_DisplayStrDescZero(_pStrDescZero); DMM_DeAllocateForKernel((unsigned)pStringDescZero) ; return true; }
void DefaultDetail::Load(wxString& filename) { FileMatrix fm(filename); if ( fm.GetSize() < 3 ) { throw wxString("Invalid data file [" + filename + "] detail section. Must have minimum three lines."); } Vector& names = fm.GetVector(2); int maxrows = fm.GetSize(); int maxcols = names.GetSize(); if ( maxrows > 3 ) { Vector& values = fm.GetVector(3); if ( maxcols != GetDescriptor()->GetSize() ) { throw wxString("Invalid data file [" + filename + "] detail section. Data & config mismatch."); } if ( maxcols != values.GetSize() ) { throw wxString("Invalid data file [" + filename + "] detail section. Names & values mismatch."); } wxProgressDialog dialog(GRID_OPEN_PROGRESS_TITLE, GRID_OPEN_PROGRESS_MESSAGE, maxrows, GetView(), wxPD_AUTO_HIDE | wxPD_APP_MODAL ); ::wxSetCursor(*wxHOURGLASS_CURSOR); for (int i=3; i<maxrows; i++) { Vector& values = fm.GetVector(i); wxList* row = new wxList(); for (int j=0; j<maxcols; j++) { if ( GetDescriptor()->GetElementDescriptor(j)->IsEnabled() ) { wxString* val = new wxString(); *val = values.GetDataAt(j); row->Append((wxObject*)val); } } GetData()->Add(row); if ( (i % 10) == 0 ){ dialog.Update(i); } } dialog.Update(maxrows); ::wxSetCursor(*wxHOURGLASS_CURSOR); if ( GetView() ) { wxGridTableMessage msg(this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, maxrows-3); GetView()->ProcessTableMessage(msg); } ::wxSetCursor(*wxSTANDARD_CURSOR); } }
RddResultCode SsbQ1_1Transformer::transform(TransformerContext* ctx, const BaseRddPartition* input, PairRddPartition* output) { auto param = ctx->getParamRdds().at(0); if (input->empty() || param->empty()) { return RRC_SUCCESS; } auto op = ctx->getRddOperator(); auto paramOp = op->paramOperators.at(0); auto exprCtx = ctx->getExpressionContext(); auto keyTemplate = param->getKeyTemplate(); auto valueTemplate = param->getValueTemplate(); auto dateDes = keyTemplate->GetDescriptor(); auto dateRef = keyTemplate->GetReflection(); auto dateField = dateDes->FindFieldByName("d_datekey"); set<uint64_t> marchedDate; param->foreach([&marchedDate, paramOp, &exprCtx, dateRef, dateField] (const PbMessagePtr& key, const PbMessagePtr& value) { idgs::actor::PbMessagePtr outkey, outvalue; exprCtx->setKeyValue(&key, &value); exprCtx->setOutputKeyValue(&outkey, &outvalue); if (paramOp->evaluate(exprCtx)) { marchedDate.insert(dateRef->GetUInt64(* key, dateField)); } }); valueTemplate = input->getValueTemplate(); auto orderDes = valueTemplate->GetDescriptor(); auto orderRef = valueTemplate->GetReflection(); auto orderDateField = orderDes->FindFieldByName("lo_orderdate"); input->foreach([marchedDate, output, op, &exprCtx, orderRef, orderDateField] (const PbMessagePtr& key, const PbMessagePtr& value) { idgs::actor::PbMessagePtr outkey, outvalue; exprCtx->setKeyValue(&key, &value); exprCtx->setOutputKeyValue(&outkey, &outvalue); if (op->evaluate(exprCtx)) { uint64_t orderdate = orderRef->GetUInt64(* value, orderDateField); if(marchedDate.find(orderdate) != marchedDate.end()) { output->put(key, value); } } }); return RRC_SUCCESS; }
RddResultCode SsbQ1_1Transformer::transform(const ActorMessagePtr& msg, const std::vector<BaseRddPartition*>& input, RddPartition* output) { if (input.size() != 2) { return RRC_INVALID_RDD_INPUT; } if (input[0]->empty() || input[1]->empty()) { return RRC_SUCCESS; } auto orderExp = output->getFilterExpression(0); auto dateExp = output->getFilterExpression(1); auto valueTemplate = input[0]->getValueTemplate(); auto orderDes = valueTemplate->GetDescriptor(); auto orderRef = valueTemplate->GetReflection(); auto orderDateField = orderDes->FindFieldByName("lo_orderdate"); auto keyTemplate = input[1]->getKeyTemplate(); valueTemplate = input[1]->getValueTemplate(); auto dateDes = keyTemplate->GetDescriptor(); auto dateRef = keyTemplate->GetReflection(); auto dateField = dateDes->FindFieldByName("d_datekey"); set<uint64_t> marchedDate; ExpressionContext ctx; input[1]->foreach( [&marchedDate, dateExp, dateRef, dateField, &ctx] (const PbMessagePtr& key, const PbMessagePtr& value) { ctx.setKeyValue(&key, &value); if ((bool) dateExp->evaluate(&ctx)) { marchedDate.insert(dateRef->GetUInt64(*key, dateField)); } }); input[0]->foreach( [marchedDate, output, orderExp, orderRef, orderDateField, dateRef, dateField, &ctx] (const PbMessagePtr& key, const PbMessagePtr& value) { ctx.setKeyValue(&key, &value); if ((bool) orderExp->evaluate(&ctx)) { uint64_t orderdate = orderRef->GetUInt64(* value, orderDateField); if(marchedDate.find(orderdate) != marchedDate.end()) { output->putLocal(key, value); } } }); return RRC_SUCCESS; }
void MaterialLegacy::Apply() { glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT); if (!vertexColors) glColor4f(diffuse.r, diffuse.g, diffuse.b, diffuse.a); if (unlit) { glDisable(GL_LIGHTING); } else { glEnable(GL_LIGHTING); glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, &diffuse[0]); glMaterialfv (GL_FRONT, GL_SPECULAR, &specular[0]); glMaterialfv (GL_FRONT, GL_EMISSION, &emissive[0]); glMaterialf (GL_FRONT, GL_SHININESS, shininess); } if (twoSided) { glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glDisable(GL_CULL_FACE); } if (GetDescriptor().alphaTest) glEnable(GL_ALPHA_TEST); if (texture0) static_cast<TextureGL*>(texture0)->Bind(); }
void XHCIDevice::GetDeviceDescriptor() { //the buffer has to be on kernel heap - a mem area that is 1-1 mapped b/w virtual (page) and physical //as it's used by XHCI controller to transfer data GetDescriptor(0x100, 0, sizeof(USBStandardDeviceDesc), KERNEL_REAL_ADDRESS(&_deviceDesc)); _deviceDesc.DebugPrint(); }
void TextureGL::SetSampleMode(TextureSampleMode mode) { GLenum magFilter, minFilter; const bool mipmaps = GetDescriptor().generateMipmaps; switch (mode) { default: // safe default will fall through to LINEAR_CLAMP when run in release builds without assert assert(0); case LINEAR_CLAMP: magFilter = GL_LINEAR; minFilter = mipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; case NEAREST_CLAMP: magFilter = GL_NEAREST; minFilter = mipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST; break; case LINEAR_REPEAT: magFilter = GL_LINEAR; minFilter = mipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; case NEAREST_REPEAT: magFilter = GL_NEAREST; minFilter =mipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST; break; } glBindTexture(m_target, m_texture); glTexParameteri(m_target, GL_TEXTURE_MAG_FILTER, magFilter); glTexParameteri(m_target, GL_TEXTURE_MIN_FILTER, minFilter); glBindTexture(m_target, 0); }
uint8_t Usb_t::StdReqHandler(uint8_t **Ptr, uint32_t *PLen) { uint8_t Recipient = SetupReq.bmRequestType & USB_RTYPE_RECIPIENT_MASK; *Ptr = NULL; *PLen = 0; if(Recipient == USB_RTYPE_RECIPIENT_DEVICE) { //Uart.Printf("Dev\r\n"); switch(SetupReq.bRequest) { case USB_REQ_GET_STATUS: // Just return the current status word Uart.Printf("GetStatus\r\n"); *Ptr = (uint8_t*)ZeroStatus; // Remote wakeup = 0, selfpowered = 0 *PLen = 2; return OK; break; case USB_REQ_SET_ADDRESS: Uart.Printf("SetAddr\r\n"); SetAddress(SetupReq.wValue); return OK; break; case USB_REQ_GET_DESCRIPTOR: // Uart.Printf("GetDesc\r\n"); *PLen = GetDescriptor(SetupReq.Buf[3], SetupReq.Buf[2], (const uint8_t**)Ptr); if(*PLen != 0) return OK; break; case USB_REQ_GET_CONFIGURATION: Uart.Printf("GetCnf\r\n"); *Ptr = &Configuration; *PLen = 1; return OK; break; case USB_REQ_SET_CONFIGURATION: Uart.Printf("SetCnf\r\n"); Configuration = SetupReq.wValue; //if(Configuration == 0)USB_SELECTED else USB_ACTIVE return OK; break; default: break; } // switch } else if(Recipient == USB_RTYPE_RECIPIENT_INTERFACE) { if(SetupReq.bRequest == USB_REQ_GET_STATUS) { Uart.Printf("InterfGetSta\r\n"); *Ptr = (uint8_t*)ZeroStatus; *PLen = 2; return OK; } } else if(Recipient == USB_RTYPE_RECIPIENT_ENDPOINT) { Uart.Printf("Ep\r\n"); switch(SetupReq.bRequest) { case USB_REQ_SYNCH_FRAME: *Ptr = (uint8_t*)ZeroStatus; *PLen = 2; return OK; break; case USB_REQ_GET_STATUS: break; } } return FAILURE; }
void BaseEntity::SerializeProperties(IPropertyContainer *container, SerializableNodeObject *parent) { int count = container->GetNumProperties(); auto props = container->GetProperties(); SerializableNodeArray* nPropContainer = new SerializableNodeArray("properties"); for (int i = 0; i < count; ++i) { auto p = props[i]; PropertyDescriptor* desc = p->GetDescriptor(); if (desc->CanSerialize) { auto propObject = new SerializableNodeObject(); desc->Serialize(propObject); propObject->AddChild(new SerializableProperty("Value", p->GetString().c_str())); nPropContainer->AddChild(propObject); } } parent->AddChild(nPropContainer); }
void DefaultDetail::Store(wxString& filename) { wxFile file(filename, wxFile::write); wxString names, values; Descriptor* descriptor = GetDescriptor(); int k; for (size_t n=0; n<descriptor->GetSize(); n++) { names += descriptor->GetElementDescriptor(n)->GetName(); names += DEFAULT_COLUMN_SEPARATOR; } file.Write(names + DEFAULT_LINE_SEPARATOR); for (int i=0; i<GetNumberRows(); i++) { k = 0; values = ""; for (size_t j=0; j<descriptor->GetSize(); j++) { ElementDescriptor* ed = descriptor->GetElementDescriptor(j); if ( ed->IsEnabled() ) { values += GetValue(i, k++); } else { values += ed->GetDefaultValue(); } values += DEFAULT_COLUMN_SEPARATOR; } file.Write(values + DEFAULT_LINE_SEPARATOR); } file.Close(); }
BufferStatus_t BufferManager_Generic_c::CreatePool( BufferPool_t *Pool, BufferType_t Type, unsigned int NumberOfBuffers, unsigned int Size, void *MemoryPool[3], void *ArrayOfMemoryBlocks[][3], char *DeviceMemoryPartitionName) { BufferStatus_t Status; BufferDataDescriptor_t *Descriptor; BufferPool_Generic_t NewPool; // // Initialize the return parameter // *Pool = NULL; // // Get the descriptor // Status = GetDescriptor(Type, BufferDataTypeBase, &Descriptor); if (Status != BufferNoError) return Status; // // Perform simple parameter checks // if (Pool == NULL) { report(severity_error, "BufferManager_Generic_c::CreatePool - Null supplied as place to return Pool pointer.\n"); return BufferError; } if (Descriptor->AllocateOnPoolCreation && (NumberOfBuffers == NOT_SPECIFIED)) { report(severity_error, "BufferManager_Generic_c::CreatePool - Unable to allocate on creation, NumberOfBuffers not specified.\n"); return BufferParametersIncompatibleWithAllocationSource; } // // Perform the creation // NewPool = new BufferPool_Generic_c(this, Descriptor, NumberOfBuffers, Size, MemoryPool, ArrayOfMemoryBlocks, DeviceMemoryPartitionName); if ((NewPool == NULL) || (NewPool->InitializationStatus != BufferNoError)) { BufferStatus_t Status; Status = BufferInsufficientMemoryForPool; if (NewPool != NULL) Status = NewPool->InitializationStatus; report(severity_error, "BufferManager_Generic_c::CreatePool - Failed to create pool (%08x).\n", Status); return Status; } // // Insert the pool into our list // OS_LockMutex(&Lock); NewPool->Next = ListOfBufferPools; ListOfBufferPools = NewPool; OS_UnLockMutex(&Lock); // *Pool = NewPool; return BufferNoError; }
void MaterialLegacy::Apply() { glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT); if (!vertexColors) glColor4f(diffuse.r, diffuse.g, diffuse.b, diffuse.a); if (unlit) { glDisable(GL_LIGHTING); } else { glEnable(GL_LIGHTING); glMaterialfv (GL_FRONT, GL_DIFFUSE, &diffuse[0]); //todo: the rest } if (twoSided) { glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glDisable(GL_CULL_FACE); } if (GetDescriptor().alphaTest) glEnable(GL_ALPHA_TEST); if (texture0) static_cast<TextureGL*>(texture0)->Bind(); }
QPixmap GetPixmapFromImageNode(const mitk::DataNode* dataNode, int height) { if (nullptr == dataNode) { return QPixmap(); } const mitk::Image* image = dynamic_cast<const mitk::Image*>(dataNode->GetData()); if ((nullptr == image || !image->IsInitialized()) || // -> must be an image (image->GetPixelType().GetNumberOfComponents() != 1)) // -> for now only single component are allowed { auto descManager = QmitkNodeDescriptorManager::GetInstance(); auto desc = descManager->GetDescriptor(dataNode); auto icon = desc->GetIcon(dataNode); auto fallBackMap = icon.pixmap(height, height); return fallBackMap; } mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New(); int sliceNumber = image->GetDimension(2) / 2; planeGeometry->InitializeStandardPlane(image->GetGeometry(), mitk::PlaneGeometry::Axial, sliceNumber); mitk::ExtractSliceFilter::Pointer extractSliceFilter = mitk::ExtractSliceFilter::New(); extractSliceFilter->SetInput(image); extractSliceFilter->SetInterpolationMode(mitk::ExtractSliceFilter::RESLICE_CUBIC); extractSliceFilter->SetResliceTransformByGeometry(image->GetGeometry()); extractSliceFilter->SetWorldGeometry(planeGeometry); extractSliceFilter->SetOutputDimensionality(2); extractSliceFilter->SetVtkOutputRequest(true); extractSliceFilter->Update(); vtkImageData* imageData = extractSliceFilter->GetVtkOutput(); mitk::LevelWindow levelWindow; dataNode->GetLevelWindow(levelWindow); vtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New(); lookupTable->SetRange(levelWindow.GetLowerWindowBound(), levelWindow.GetUpperWindowBound()); lookupTable->SetSaturationRange(0.0, 0.0); lookupTable->SetValueRange(0.0, 1.0); lookupTable->SetHueRange(0.0, 0.0); lookupTable->SetRampToLinear(); vtkSmartPointer<vtkMitkLevelWindowFilter> levelWindowFilter = vtkSmartPointer<vtkMitkLevelWindowFilter>::New(); levelWindowFilter->SetLookupTable(lookupTable); levelWindowFilter->SetInputData(imageData); levelWindowFilter->SetMinOpacity(0.0); levelWindowFilter->SetMaxOpacity(1.0); int dims[3]; imageData->GetDimensions(dims); double clippingBounds[] = { 0.0, static_cast<double>(dims[0]), 0.0, static_cast<double>(dims[1]) }; levelWindowFilter->SetClippingBounds(clippingBounds); levelWindowFilter->Update(); imageData = levelWindowFilter->GetOutput(); QImage thumbnailImage(reinterpret_cast<const unsigned char*>(imageData->GetScalarPointer()), dims[0], dims[1], QImage::Format_ARGB32); thumbnailImage = thumbnailImage.scaledToHeight(height,Qt::SmoothTransformation).rgbSwapped(); return QPixmap::fromImage(thumbnailImage); }
bool EHCIDevice::GetDeviceDescriptor(USBStandardDeviceDesc* pDevDesc) { USBDataHandler_InitDevDesc(pDevDesc) ; if(!GetDescriptor(0x100, 0, -1, pDevDesc)) return false; byte len = pDevDesc->bLength ; if(len >= sizeof(USBStandardDeviceDesc)) len = sizeof(USBStandardDeviceDesc) ; if(!GetDescriptor(0x100, 0, len, pDevDesc)) return false; return true; }
int HasCADesc( uint8_t *pData, int nBytes ) { uint8_t* desc_ptr; int desc_len; if ( ( desc_ptr = GetDescriptor( pData, nBytes, CA_DESCRIPTOR, &desc_len ) )!= NULL && desc_len > 0 ) return 1; return 0; }
// 接收消息 void SessionHandle::on_message(network::NetMessage &message) { // 处理请求 auto request = ProtubufCodec::Decode(message); if (request == nullptr) { return db_proxy_.send_error_code(this, 0, com::kInvalidProtocol, message); } // 通信前必须登录 if (!logged_on_) { if (request->GetDescriptor() != com::PingReq::descriptor()) { if (request->GetDescriptor() != dbproxy::LoginReq::descriptor()) { db_proxy_.send_error_code(this, 0, com::kNotLoggedOn, message); } else { // 登录成功 message.clear(); logged_on_ = true; dbproxy::LoginRsp response; response.set_heartbeat_interval(ServerConfig::GetInstance()->get_heartbeat_interval()); ProtubufCodec::Encode(&response, message); send(message); } } } // 处理心跳包 else if (request->GetDescriptor() == com::PingReq::descriptor()) { message.clear(); com::PongRsp response; ProtubufCodec::Encode(&response, message); send(message); } else { db_proxy_.on_message(this, request.get(), message); } }
void TextureGL::Update(const TextureCubeData &data, const vector2f &dataSize, TextureFormat format, const unsigned int numMips) { assert(m_target == GL_TEXTURE_CUBE_MAP); glBindTexture(m_target, m_texture); switch (m_target) { case GL_TEXTURE_CUBE_MAP: if (!IsCompressed(format)) { glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.posX); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.negX); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.posY); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.negY); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.posZ); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, dataSize.x, dataSize.y, GLImageFormat(format), GLImageType(format), data.negZ); } else { const GLint oglInternalFormat = GLImageFormat(format); size_t Offset = 0; size_t Width = dataSize.x; size_t Height = dataSize.y; size_t bufSize = ((Width + 3) / 4) * ((Height + 3) / 4) * GetMinSize(format); const unsigned char *pData_px = static_cast<const unsigned char*>(data.posX); const unsigned char *pData_nx = static_cast<const unsigned char*>(data.negX); const unsigned char *pData_py = static_cast<const unsigned char*>(data.posY); const unsigned char *pData_ny = static_cast<const unsigned char*>(data.negY); const unsigned char *pData_pz = static_cast<const unsigned char*>(data.posZ); const unsigned char *pData_nz = static_cast<const unsigned char*>(data.negZ); for( unsigned int i = 0; i < numMips; ++i ) { glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_px[Offset]); glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_nx[Offset]); glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_py[Offset]); glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_ny[Offset]); glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_pz[Offset]); glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, i, 0, 0, Width, Height, oglInternalFormat, bufSize, &pData_nz[Offset]); if( Width<=MIN_COMPRESSED_TEXTURE_DIMENSION || Height<=MIN_COMPRESSED_TEXTURE_DIMENSION ) { break; } Offset += bufSize; bufSize /= 4; Width /= 2; Height /= 2; } } break; default: assert(0); } if (GetDescriptor().generateMipmaps) glGenerateMipmap(m_target); glBindTexture(m_target, 0); }
BOOL IsSegSize32( WORD seg ) { WORD desc[4]; if( WDebug386 ) { GetDescriptor( seg, desc ); if( desc[3] & 0x40 ) { return( TRUE ); } } return( FALSE ); }
DWORD CUsbIo::GetDeviceDescriptor(USB_DEVICE_DESCRIPTOR* Desc) { DWORD ByteCount = sizeof(USB_DEVICE_DESCRIPTOR); return GetDescriptor( Desc, ByteCount, RecipientDevice, USB_DEVICE_DESCRIPTOR_TYPE, 0, 0 ); }
void XHCIDevice::GetStringDescriptorZero() { unsigned short usDescValue = (0x3 << 8) ; byte* buffer = new byte[8]; GetDescriptor(usDescValue, 0, -1, KERNEL_REAL_ADDRESS(buffer)); int iLen = reinterpret_cast<USBStringDescZero*>(buffer)->bLength ; printf("\n String Desc Zero Len: %d", iLen) ; delete[] buffer; buffer = new byte[iLen]; GetDescriptor(usDescValue, 0, iLen, KERNEL_REAL_ADDRESS(buffer)); _pStrDescZero = new USBStringDescZero(); USBDataHandler_CopyStrDescZero(_pStrDescZero, buffer); USBDataHandler_DisplayStrDescZero(_pStrDescZero); delete[] buffer; }
void behaviac::CTagObject::GetMethodParams(const behaviac::CStringID& name, CTagMethodParams& out_param) { const CTagObjectDescriptor& descriptor = GetDescriptor(); for (size_t i = 0; i < descriptor.ms_methods.size(); i++) { behaviac::CMethodBase* method = descriptor.ms_methods[i]; if (method->GetID() == name) { method->GetParams(out_param); return; } } }
void behaviac::CTagObject::vCallOld(const behaviac::CStringID& name, const CTagMethodParams& params) { const CTagObjectDescriptor& descriptor = GetDescriptor(); for (size_t i = 0; i < descriptor.ms_methods.size(); i++) { behaviac::CMethodBase* method = descriptor.ms_methods[i]; if (method->GetID() == name) { method->vCallOld(this, params); return; } } }
DWORD CUsbIo::GetConfigurationDescriptor( USB_CONFIGURATION_DESCRIPTOR* Desc, DWORD& ByteCount, UCHAR Index/*=0*/ ) { return GetDescriptor( Desc, ByteCount, RecipientDevice, USB_CONFIGURATION_DESCRIPTOR_TYPE, Index, 0 ); }
void ttt::AJSegmentationDijkstraFilter<TInputAJGraph,TPlatenessImage, TVertexnessImage,TOutputAJGraph>::InitDefGraph() { typename OutputAJGraphType::Pointer outputajgraph = this->GetOutput(); typename InputAJGraphType::ConstPointer inputajgraph = this->GetInputAJGraph(); for (auto ajvertexIt = inputajgraph->VerticesBegin(); ajvertexIt != inputajgraph->VerticesEnd(); ++ajvertexIt) { auto inputAJVertex = inputajgraph->GetAJVertex(*ajvertexIt); auto outputAJVertex = OutputAJGraphType::AJVertexType::New(); outputAJVertex->SetPosition(inputAJVertex->GetPosition()); outputAJVertex->SetDescriptor(inputAJVertex->GetDescriptor()); outputajgraph->AddAJVertex(outputAJVertex); } }
DWORD CUsbIo::GetStringDescriptor( USB_STRING_DESCRIPTOR* Desc, DWORD& ByteCount, UCHAR Index/*=0*/, USHORT LanguageId/*=0*/ ) { return GetDescriptor( Desc, ByteCount, RecipientDevice, USB_STRING_DESCRIPTOR_TYPE, Index, LanguageId ); }
int SecureSocketImpl::Connect(const char *host, unsigned short port) { int ret = PlainSocketImpl::Connect(host, port); if (ret != 0) return ret; m_pimpl->ssl = SSL_new(s_sslContext); if (m_pimpl->ssl == 0) throw SSLError("Could not initialize socket SSL context"); SSL_set_fd(m_pimpl->ssl, static_cast<int>(GetDescriptor())); ret = SSL_connect(m_pimpl->ssl); if (ret < 1) throw SSLError("Could not establish a secure connection"); return 0; }