int main() { string str1; string str2; cout << "Enter string 1: "; getline(cin, str1); cout << "Enter string 2: "; getline(cin, str2); string result = (isRotated(str1, str2) == true) ? " is " : " is not "; cout << "String 1: " << str1 << result << "a rotation of String 2: " << str2; return 0; }
int ExynosMPP::srcYOffsetAlign(hwc_layer_1_t &layer) { private_handle_t *handle = private_handle_t::dynamicCast(layer.handle); switch (handle->format) { case HAL_PIXEL_FORMAT_RGBX_8888: case HAL_PIXEL_FORMAT_RGB_565: case HAL_PIXEL_FORMAT_EXYNOS_YV12_M: case HAL_PIXEL_FORMAT_YV12: case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M: case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M: case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL: case HAL_PIXEL_FORMAT_YCrCb_420_SP: case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M: return 1; case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED: default: return isRotated(layer) ? 4 : 1; } }
bool ExynosMPP::isProcessingSupported(hwc_layer_1_t &layer, int format, bool local_path, int loc_out_downscale) { if (local_path && loc_out_downscale == 0) return false; if (isUsingMSC() && local_path) return false; private_handle_t *handle = private_handle_t::dynamicCast(layer.handle); int max_w = maxWidth(layer); int max_h = maxHeight(layer); int min_w = minWidth(layer); int min_h = minHeight(layer); int crop_max_w = 0; int crop_max_h = 0; if (isUsingMSC()) { crop_max_w = 8192; crop_max_h = 8192; } else { crop_max_w = isRotated(layer) ? 2016 : 4800; crop_max_h = isRotated(layer) ? 2016 : 3344; } int crop_min_w = isRotated(layer) ? 32: 64; int crop_min_h = isRotated(layer) ? 64: 32; int srcAlign = sourceAlign(handle->format); int dstAlign; if (local_path) dstAlign = destinationAlign(HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M); else dstAlign = destinationAlign(HAL_PIXEL_FORMAT_BGRA_8888); int maxDstWidth; int maxDstHeight; bool rot90or270 = !!(layer.transform & HAL_TRANSFORM_ROT_90); // n.b.: HAL_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_90 | // HAL_TRANSFORM_ROT_180 int src_w = WIDTH(layer.sourceCropf), src_h = HEIGHT(layer.sourceCropf); int dest_w, dest_h; if (rot90or270) { dest_w = HEIGHT(layer.displayFrame); dest_h = WIDTH(layer.displayFrame); } else { dest_w = WIDTH(layer.displayFrame); dest_h = HEIGHT(layer.displayFrame); } if (getDrmMode(handle->flags) != NO_DRM) alignCropAndCenter(dest_w, dest_h, NULL, GSC_DST_CROP_W_ALIGNMENT_RGB888); int max_downscale = local_path ? loc_out_downscale : 16; maxDstWidth = 2560; maxDstHeight = 1600; int max_upscale = 8; /* check whether GSC can handle with local path */ if (local_path) { /* GSC OTF can't handle rot90 or rot270 */ if (!rotationSupported(rot90or270)) return 0; /* * if display co-ordinates are out of the lcd resolution, * skip that scenario to OpenGL. * GSC OTF can't handle such scenarios. */ if (layer.displayFrame.left < 0 || layer.displayFrame.top < 0 || layer.displayFrame.right > mDisplay->mXres || layer.displayFrame.bottom > mDisplay->mYres) return 0; /* GSC OTF can't handle GRALLOC_USAGE_PROTECTED layer */ if (getDrmMode(handle->flags) != NO_DRM) return 0; return isFormatSupportedByGsc(format) && isFormatSupportedByGscOtf(format) && mDisplay->mHwc->mS3DMode == S3D_MODE_DISABLED && paritySupported(dest_w, dest_h) && handle->stride <= max_w && src_w <= dest_w * max_downscale && dest_w <= maxDstWidth && dest_w <= src_w * max_upscale && handle->vstride <= max_h && src_h <= dest_h * max_downscale && dest_h <= maxDstHeight && dest_h <= src_h * max_upscale && src_w <= crop_max_w && src_h <= crop_max_h && src_w >= crop_min_w && src_h >= crop_min_h; } bool need_gsc_op_twice = false; if (getDrmMode(handle->flags) != NO_DRM) { need_gsc_op_twice = ((dest_w > src_w * max_upscale) || (dest_h > src_h * max_upscale)) ? true : false; if (need_gsc_op_twice) max_upscale = 8 * 8; } else { if (!mDisplay->mHasDrmSurface) { need_gsc_op_twice = false; max_upscale = 8; } } if (getDrmMode(handle->flags) != NO_DRM) { /* make even for gscaler */ layer.sourceCropf.top = (unsigned int)layer.sourceCropf.top & ~1; layer.sourceCropf.left = (unsigned int)layer.sourceCropf.left & ~1; layer.sourceCropf.bottom = (unsigned int)layer.sourceCropf.bottom & ~1; layer.sourceCropf.right = (unsigned int)layer.sourceCropf.right & ~1; } /* check whether GSC can handle with M2M */ return isFormatSupportedByGsc(format) && src_w >= min_w && src_h >= min_h && isDstCropWidthAligned(dest_w) && handle->stride <= max_w && handle->stride % srcAlign == 0 && src_w < dest_w * max_downscale && dest_w <= src_w * max_upscale && handle->vstride <= max_h && handle->vstride % srcAlign == 0 && src_h < dest_h * max_downscale && dest_h <= src_h * max_upscale && // per 46.2 (!rot90or270 || (unsigned int)layer.sourceCropf.top % 2 == 0) && (!rot90or270 || (unsigned int)layer.sourceCropf.left % 2 == 0) && src_w <= crop_max_w && src_h <= crop_max_h && src_w >= crop_min_w && src_h >= crop_min_h; // per 46.3.1.6 }
//===================================== // XTouchScreen slotTopOk... //------------------------------------- void XTouchScreen::slotTopOk (void) { // log (L_INFO,"XTouchScreen::slotTopOk() called\n"); // ... // this function is called if you click onto the OK // button in the setup toplevel window // --- mFrame -> enterEvent ( 0 ); bool newToucher = false; switch (mState) { case TOUCHER_NEW: if ( ! mIndexList.isEmpty()) { mWorkingIndex = *mIndexList.at ( touchList->count()-1 ); mWorkingIndex+= 2; } else { mWorkingIndex = 1; } newToucher = true; break; case TOUCHER_SETUP: mWorkingIndex = *mIndexList.at ( mSelected ); newToucher = false; break; } // ... // get the mFiles pointer wrapper from the Intro // object which has read all the data files // --- QDict<XFile>* mFilePtr = mIntro->getFiles(); XWrapFile < QDict<XFile> > mFiles (mFilePtr); // ... // get the workingToucher pointer wrapper. If a new toucher // should be added use addDevice to create a new object // otherwhise get the device according to the selection // made in touchList and clear the contents // --- XWrapPointer<XData> workingToucher; if (newToucher) { while (mFiles["sys_INPUT"]->getDevice (mWorkingIndex)) { mWorkingIndex+= 2; } workingToucher.init ( mFiles["sys_INPUT"]->addDevice (mWorkingIndex) ); } else { workingToucher.init ( mFiles["sys_INPUT"]->getDevice (mWorkingIndex) ); } // ... / // set the selection data from the CDB if the user requested // a new toucher from the list. The data set here may be overwritten // from the manual setup made after the vendor/name selection // ----- // NOTE: // ----- // At the time there are not other controls which can influence // the CDB selection. This means all the configuration data is // obtained from the CDB files // --- // check first if the selection differs from // the current settings // --- bool changeRequest = false; QString* toucherName = new QString(); toucherName -> sprintf ("%s;%s", mVendor->currentText().ascii(),mName->currentText().ascii() ); if (! newToucher) { if (*toucherName != QString(workingToucher["Name"])) { changeRequest = true; } } else { changeRequest = true; } QDict<char>* spec = NULL; XDb* pCDB = mFiles["cdb_TOUCHER"]->cdbGetSpec ( mVendor->currentText(),mName->currentText() ); if ((pCDB) && (changeRequest)) { spec = pCDB -> getHash(); // ... // clear the working toucher contents... // --- workingToucher.clear(); // ... // set base items for the touchscreen... // --- QString* ident = new QString; ident -> sprintf ("Mouse[%d]",mWorkingIndex); workingToucher.setPair ("InputFashion","Touchpanel"); workingToucher.setPair ("Identifier",ident->ascii()); workingToucher.setPair ("Name", toucherName->ascii()); // ... // set CDB data information... // --- QDictIterator<char> it (*spec); for (; it.current(); ++it) { QString* key = new QString (it.currentKey()); QString* val = new QString; val->sprintf("%s",it.current()); if (val->isEmpty()) { continue; } if (*key == "Load") { // ... // The load key/value pair must go to the module // section. Therefore the data record is loaded now // --- QString* moduleList = new QString(); XData* workingPath = mFiles["sys_PATH"]->getDevice (0); moduleList -> sprintf ("%s,%s", workingPath->operator[]("ModuleLoad"), val->ascii() ); workingPath -> setPair ("ModuleLoad", moduleList->ascii() ); } else { workingToucher.setPair ( key->ascii(),val->ascii() ); } } // ... // check if the card is rotated... // --- int rotate = isRotated(); if (rotate > 0) { QString* degree = new QString(); degree->sprintf("%d",rotate); workingToucher.setPair ( "Rotation",degree->ascii() ); } } // ... // add an entry to touchList if a new touchscreen // should be added to the system. Otherwhise update // the current entry of the touchList if changed // --- if (newToucher) { if (pCDB) { QString topic; XData* sysData = mFiles["sys_INPUT"] -> getDevice(mWorkingIndex); if (sysData) { QDict<char> touchInfo = sysData -> getData(); topic.sprintf ("%s %s", mVendor->currentText().ascii(),mName->currentText().ascii() ); int* newIndex = (int*) malloc(sizeof(int)); *newIndex = mWorkingIndex; mIndexList.append (newIndex); touchList -> insertItem ( QPixmap(PIXINTROTOUCH),topic ); mSelected = mIndexList.find ( newIndex ); touchList -> setSelected ( mSelected,true ); touchList -> setCurrentItem ( mSelected ); mDel -> setDisabled ( false ); mSetup -> setDisabled ( false ); } } } else { if ((changeRequest) && (pCDB)) { QString topic; topic.sprintf ("%s %s", mVendor->currentText().ascii(),mName->currentText().ascii() ); touchList -> changeItem ( QPixmap(PIXINTROTOUCH),topic,mSelected ); } } }