bool DrmPlane::initProps() { m_propsNames = { QByteArrayLiteral("type"), QByteArrayLiteral("SRC_X"), QByteArrayLiteral("SRC_Y"), QByteArrayLiteral("SRC_W"), QByteArrayLiteral("SRC_H"), QByteArrayLiteral("CRTC_X"), QByteArrayLiteral("CRTC_Y"), QByteArrayLiteral("CRTC_W"), QByteArrayLiteral("CRTC_H"), QByteArrayLiteral("FB_ID"), QByteArrayLiteral("CRTC_ID"), }; QVector<QByteArray> typeNames = { QByteArrayLiteral("Primary"), QByteArrayLiteral("Cursor"), QByteArrayLiteral("Overlay"), }; drmModeObjectProperties *properties = drmModeObjectGetProperties(m_fd, m_id, DRM_MODE_OBJECT_PLANE); if (!properties){ qCWarning(KWIN_DRM) << "Failed to get properties for plane " << m_id ; return false; } int propCount = int(PropertyIndex::Count); for (int j = 0; j < propCount; ++j) { if (j == int(PropertyIndex::Type)) { initProp(j, properties, typeNames); } else { initProp(j, properties); } } drmModeFreeObjectProperties(properties); return true; }
void FiniteStrainHyperElasticViscoPlastic::initUOVariables() { initNumUserObjects(_flow_rate_uo_names, _num_flow_rate_uos); initNumUserObjects(_strength_uo_names, _num_strength_uos); initNumUserObjects(_int_var_uo_names, _num_int_var_uos); initNumUserObjects(_int_var_rate_uo_names, _num_int_var_rate_uos); initProp(_flow_rate_uo_names, _num_flow_rate_uos, _flow_rate_prop); initProp(_strength_uo_names, _num_strength_uos, _strength_prop); initProp(_int_var_uo_names, _num_int_var_uos, _int_var_stateful_prop); initProp(_int_var_rate_uo_names, _num_int_var_rate_uos, _int_var_rate_prop); initPropOld(_int_var_uo_names, _num_int_var_uos, _int_var_stateful_prop_old); initUserObjects(_flow_rate_uo_names, _num_flow_rate_uos, _flow_rate_uo); initUserObjects(_strength_uo_names, _num_strength_uos, _strength_uo); initUserObjects(_int_var_uo_names, _num_int_var_uos, _int_var_uo); initUserObjects(_int_var_rate_uo_names, _num_int_var_rate_uos, _int_var_rate_uo); _int_var_old.resize(_num_int_var_uos, 0.0); }
void MediaAnalyticsItem::growProps(int increment) { if (increment <= 0) { increment = kGrowProps; } int nsize = mPropSize + increment; Prop *ni = (Prop *)realloc(mProps, sizeof(Prop) * nsize); if (ni != NULL) { for (int i = mPropSize; i < nsize; i++) { initProp(&ni[i]); } mProps = ni; mPropSize = nsize; } }
// remove any keys NOT in the provided list // return value is # keys removed int32_t MediaAnalyticsItem::filterNot(int n, MediaAnalyticsItem::Attr attrs[]) { int zapped = 0; if (attrs == NULL || n <= 0) { return -1; } for (ssize_t i = mPropCount-1 ; i >=0 ; i--) { Prop *prop = &mProps[i]; for (ssize_t j = 0; j < n ; j++) { if (strcmp(prop->mName, attrs[j]) == 0) { clearProp(prop); zapped++; if (i != (ssize_t)(mPropCount-1)) { *prop = mProps[mPropCount-1]; } initProp(&mProps[mPropCount-1]); mPropCount--; break; } } } return zapped; }