Пример #1
0
 Vector<Index>::Vector(const Vector<Index>& rhs)
 : _maxIndex(rhs._maxIndex),
   _distribution(detail::cloneAndConvert<Vector<Index>>(rhs.distribution()))
 {
   LOG_DEBUG_INFO("Created new IndexVector object (", this, ") by copying (",
                  &rhs, ") with ", getDebugInfo());
 }
Пример #2
0
 Vector<Index>::Vector(const value_type size)//,
                       //const detail::Distribution<Vector<Index>>& distribution)
 : _maxIndex(size-1),
   //_distribution(detail::cloneAndConvert<Index>(distribution))
   _distribution(new skelcl::detail::Distribution < Vector < Index >> ())
 {
   LOG_DEBUG_INFO("Created new IndexVector object (", this, ") with ",
                  getDebugInfo());
 }
MINT32
Hal3A::CCTOPAFCaliOperation(
    MVOID *a_pAFCaliData,
    MUINT32 *a_pOutLen
)
{
    ACDK_AF_CALI_DATA_T *pAFCaliData = (ACDK_AF_CALI_DATA_T *)a_pAFCaliData;
    AAA_DEBUG_INFO_T *p_r3ADebugInfo;
    MUINT32 aaaDebugSize;
    MINT32 i4TimeOutCnt = 0;

    AAA_CCTOP_LOG("[ACDK_CCT_V2_OP_AF_CALI_OPERATION]\n");

    m_pmtk3A->send3ACmd(LIB3A_AF_CMD_ID_SET_AF_MODE, LIB3A_AF_MODE_AFS);

    usleep(500000);	// 500ms

    m_pmtk3A->send3ACmd(LIB3A_AF_CMD_ID_SET_AF_MODE, LIB3A_AF_MODE_CALIBRATION);

    while(!isAFFinish()) {
        usleep(10000); // 10ms
        i4TimeOutCnt++;

        if (i4TimeOutCnt > 2000) {
             break;
        }
    }

    getDebugInfo((void **) &p_r3ADebugInfo, &aaaDebugSize);

    pAFCaliData->i4Gap = (MINT32)p_r3ADebugInfo->rAFDebugInfo.Tag[2].u4FieldValue;

    for (MINT32 i = 0; i < 512; i++) {
        if (p_r3ADebugInfo->rAFDebugInfo.Tag[i+2].u4FieldValue != 0) {
            pAFCaliData->u4Vlu[i] = p_r3ADebugInfo->rAFDebugInfo.Tag[i+3].u4FieldValue;
            pAFCaliData->i4Num = i+1;
        }
        else {
            break;
        }
    }

    pAFCaliData->i4BestPos = getAFBestPos();

    AAA_CCTOP_LOG("[AFCaliData] Num = %d\n", pAFCaliData->i4Num);
    AAA_CCTOP_LOG("[AFCaliData] Gap = %d\n", pAFCaliData->i4Gap);
    AAA_CCTOP_LOG("[AFCaliData] Pos = %d\n", pAFCaliData->i4BestPos);

    m_pmtk3A->send3ACmd(LIB3A_AF_CMD_ID_SET_AF_MODE, LIB3A_AF_MODE_AFS);

    *a_pOutLen = sizeof(MINT32);

    return MHAL_NO_ERROR;
}
Пример #4
0
 void
 Vector<Index>::setDistribution(
                                std::unique_ptr<detail::Distribution<Vector<Index>>>&&
                                newDistribution) const
 {
   ASSERT(newDistribution != nullptr);
   ASSERT(newDistribution->isValid());
   
   _distribution = std::move(newDistribution);
   ASSERT(_distribution->isValid());
   
   LOG_DEBUG_INFO("IndexVector object (", this,
                  ") assigned new distribution, now with ", getDebugInfo());
 }
Пример #5
0
 Vector<Index>::~Vector()
 {
   LOG_DEBUG_INFO("IndexVector object (", this, ") with ", getDebugInfo(),
                  " destroyed");
 }
bool MyDirectDrawSw::presentInternal(int xdest,
                                     int ydest,
                                     int width,
                                     int height,
                                     int xsrc,
                                     int ysrc,
                                     const MyDirectDrawSurfaceSw* surf)
{
    LOG_FUNCTION();
    ++mFramesCount;
    const auto newTime = clock::now();
    if(std::chrono::duration_cast<seconds>(newTime - mPrevFrameTime).count() >= 1)
    {
        const auto dur = std::chrono::duration_cast<microseconds>(newTime - mPrevFrameTime);
        mFrameTime = (decltype(mFrameTime))dur.count() /
                (decltype(mFrameTime))mFramesCount / 1000000.0f;
        mFramesCount = 0;
        mPrevFrameTime = newTime;
    }

    int xoff = 0;
    int yoff = 0;
    if(mSettings->drawOnScreen())
    {
        const auto off = getWindowPos(true);
        xoff = off.first;
        yoff = off.second;
    }
    xdest += xoff;
    ydest += yoff;
    const auto bpp = surf->bpp();
    const void* data = surf->GetBufferPtr();

    struct
    {
        BITMAPINFO bmi;
        RGBQUAD data[255];
    } s;
    s.bmi.bmiHeader.biSize = sizeof(s.bmi.bmiHeader);
    s.bmi.bmiHeader.biWidth = width;
    s.bmi.bmiHeader.biHeight = -height;
    s.bmi.bmiHeader.biPlanes = 1;
    s.bmi.bmiHeader.biBitCount = bpp;
    s.bmi.bmiHeader.biCompression = BI_RGB;
    s.bmi.bmiHeader.biSizeImage = 0;
    s.bmi.bmiHeader.biXPelsPerMeter = 0;
    s.bmi.bmiHeader.biYPelsPerMeter = 0;
    s.bmi.bmiHeader.biClrUsed = 0;
    s.bmi.bmiHeader.biClrImportant = 0;
    if(bpp <= 8)
    {
        const auto palette = surf->getPaletteInternal();
        if(nullptr != palette)
        {
            int i = 0;
            std::generate_n(s.bmi.bmiColors, palette->count(),[&]()
            {
                const auto& e = palette->entry(i++);
                RGBQUAD ret;
                ret.rgbBlue  = e.peBlue;
                ret.rgbGreen = e.peGreen,
                ret.rgbRed   = e.peRed;
                return ret;
            });
        }
        else
        {
            memset(&s.bmi.bmiColors, 0, sizeof(RGBQUAD) * 256);
        }
    }
    else if(bpp < 32)
    {
        s.bmi.bmiHeader.biCompression = BI_BITFIELDS;
        auto masks = reinterpret_cast<DWORD*>(s.bmi.bmiColors);
        surf->getColorMask(masks[0], masks[1], masks[2]);
    }

    const bool result = (0 != ::SetDIBitsToDevice(mHDC,
                                                  xdest,
                                                  ydest,
                                                  width,
                                                  height,
                                                  xsrc,
                                                  ysrc,
                                                  0,
                                                  height,
                                                  data,
                                                  &s.bmi,
                                                  DIB_RGB_COLORS));
    if(!result)
    {
        LOG_ERROR() << "SetDIBitsToDevice failed: " << getWinError();
    }

    if(mSettings->showDebugInfo())
    {
        RECT textRc = {xoff,yoff,mDispMode.width + xoff,mDispMode.height + yoff};
        ::DrawText(mHDC, getDebugInfo().c_str(), -1, &textRc, DT_LEFT | DT_TOP);
    }

    return result;
}
Пример #7
0
FileInfo::FileInfo(const QString &path, const bool isContainer)
    : m_container(QFileInfo())
    , m_image(QFileInfo())
    , m_zipPath("")
    , m_zipImageFileName("")
    , m_hasValidContainer(false)
    , m_fileExists(false)
    , m_isInArchive(false)
{
#ifdef DEBUG_FILE_INFO
    DEBUGOUT << "called with path: " << path;
#endif
    if (path.isEmpty())
    {
        return;
    }

    const QFileInfo fi(path);

    if (fi.isDir())
    {
        // If path is path to directory
        m_container = fi;
        m_hasValidContainer = true;

#ifdef DEBUG_FILE_INFO
        DEBUGOUT << "path is path to directory" << getDebugInfo();
#endif
        return;
    }


    if (Helper::isArchiveFile(fi))
    {
        // If path is path to zip file
        m_container = fi;
        m_hasValidContainer = true;

        if (isContainer)
        {
            m_isInArchive = true;
        }
#ifdef DEBUG_FILE_INFO
        DEBUGOUT << "path is path to zip file" << getDebugInfo();
#endif
        return;
    }


    if (fi.exists())
    {
        if (!Helper::isImageFile(fi))
            return;

        // If path is image
        m_container = QFileInfo(fi.canonicalPath());
        m_hasValidContainer = true;

        m_image = fi;
        m_fileExists = true;

#ifdef DEBUG_FILE_INFO
        DEBUGOUT << "path is image\n\t" << getDebugInfo();
#endif
        return;
    }


    // If path is image in archive

    const QString editedPath = QDir::fromNativeSeparators(path);
    QString tempContainerPath = editedPath;
    int indexOfContainerSlash = -1;
    do
    {
        indexOfContainerSlash = tempContainerPath.lastIndexOf('/');

//#ifdef DEBUG_FILE_INFO
//        DEBUGOUT << "index of /" << indexOfContainerSlash << "path" << temppath;
//#endif
        tempContainerPath.truncate(indexOfContainerSlash);
        const QFileInfo tempFileInfo = QFileInfo(tempContainerPath);
        if (tempFileInfo.exists() && !tempFileInfo.isDir())
        {
            m_container = tempFileInfo;
            m_hasValidContainer = true;
            m_isInArchive = true;

            const QString zipAbsoluteFilePath =
                    editedPath.right(editedPath.size()
                                     - tempContainerPath.size() - 1);

            if (!zipAbsoluteFilePath.isEmpty())
            {
                int indexOfZipSlash = zipAbsoluteFilePath.lastIndexOf('/');

                if (indexOfZipSlash != -1)
                {
                    m_zipPath = zipAbsoluteFilePath.left(indexOfZipSlash + 1);
                }

                if (indexOfZipSlash != zipAbsoluteFilePath.size() - 1)
                {
                    m_zipImageFileName = zipAbsoluteFilePath.right(
                                zipAbsoluteFilePath.size()
                                - indexOfZipSlash - 1);
                    m_fileExists = true;
                }
            }

#ifdef DEBUG_FILE_INFO
            DEBUGOUT << "path is image in archive\n\t" << getDebugInfo();
#endif
            return;
        }
    }
    while (indexOfContainerSlash != -1);
}