亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? winutil.cpp

?? 用DirectX制作高級動畫-[Advanced.Animation.with.DirectX]
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
    if (pRequest->cbPrefix > 0) {
        return E_INVALIDARG;
    }

    pRequest->cbBuffer = pVideoInfo->bmiHeader.biSizeImage;
    return NOERROR;
}


// Agree the number of media sample buffers and their sizes. The base class
// this allocator is derived from allows samples to be aligned only on byte
// boundaries NOTE the buffers are not allocated until the Commit call

STDMETHODIMP CImageAllocator::SetProperties(
    ALLOCATOR_PROPERTIES * pRequest,
    ALLOCATOR_PROPERTIES * pActual)
{
    ALLOCATOR_PROPERTIES Adjusted = *pRequest;

    // Check the parameters fit with the current connection

    HRESULT hr = CheckSizes(&Adjusted);
    if (FAILED(hr)) {
        return hr;
    }
    return CBaseAllocator::SetProperties(&Adjusted, pActual);
}


// Commit the memory by allocating the agreed number of media samples. For
// each sample we are committed to creating we have a CImageSample object
// that we use to manage it's resources. This is initialised with a DIBDATA
// structure that contains amongst other things the GDI DIBSECTION handle
// We will access the renderer media type during this so we must have locked
// (to prevent the format changing for example). The class overrides Commit
// and Decommit to do this locking (base class Commit in turn calls Alloc)

HRESULT CImageAllocator::Alloc(void)
{
    ASSERT(m_pMediaType);
    CImageSample *pSample;
    DIBDATA DibData;

    // Check the base allocator says it's ok to continue

    HRESULT hr = CBaseAllocator::Alloc();
    if (FAILED(hr)) {
        return hr;
    }

    // We create a new memory mapped object although we don't map it into our
    // address space because GDI does that in CreateDIBSection. It is possible
    // that we run out of resources before creating all the samples in which
    // case the available sample list is left with those already created

    ASSERT(m_lAllocated == 0);
    while (m_lAllocated < m_lCount) {

        // Create and initialise a shared memory GDI buffer

        HRESULT hr = CreateDIB(m_lSize,DibData);
        if (FAILED(hr)) {
            return hr;
        }

        // Create the sample object and pass it the DIBDATA

        pSample = CreateImageSample(DibData.pBase,m_lSize);
        if (pSample == NULL) {
            EXECUTE_ASSERT(DeleteObject(DibData.hBitmap));
            EXECUTE_ASSERT(CloseHandle(DibData.hMapping));
            return E_OUTOFMEMORY;
        }

        // Add the completed sample to the available list

        pSample->SetDIBData(&DibData);
        m_lFree.Add(pSample);
        m_lAllocated++;
    }
    return NOERROR;
}


// We have a virtual method that allocates the samples so that a derived class
// may override it and allocate more specialised sample objects. So long as it
// derives its samples from CImageSample then all this code will still work ok

CImageSample *CImageAllocator::CreateImageSample(LPBYTE pData,LONG Length)
{
    HRESULT hr = NOERROR;
    CImageSample *pSample;

    // Allocate the new sample and check the return codes

    pSample = new CImageSample((CBaseAllocator *) this,   // Base class
                               NAME("Video sample"),      // DEBUG name
                               (HRESULT *) &hr,           // Return code
                               (LPBYTE) pData,            // DIB address
                               (LONG) Length);            // Size of DIB

    if (pSample == NULL || FAILED(hr)) {
        delete pSample;
        return NULL;
    }
    return pSample;
}


// This function allocates a shared memory block for use by the source filter
// generating DIBs for us to render. The memory block is created in shared
// memory so that GDI doesn't have to copy the memory when we do a BitBlt

HRESULT CImageAllocator::CreateDIB(LONG InSize,DIBDATA &DibData)
{
    BITMAPINFO *pbmi;       // Format information for pin
    BYTE *pBase;            // Pointer to the actual image
    HANDLE hMapping;        // Handle to mapped object
    HBITMAP hBitmap;        // DIB section bitmap handle

    // Create a file mapping object and map into our address space

    hMapping = CreateFileMapping(hMEMORY,         // Use system page file
                                 NULL,            // No security attributes
                                 PAGE_READWRITE,  // Full access to memory
                                 (DWORD) 0,       // Less than 4Gb in size
                                 InSize,          // Size of buffer
                                 NULL);           // No name to section
    if (hMapping == NULL) {
        DWORD Error = GetLastError();
        return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error);
    }

    // NOTE We always create a DIB section with the source format type which
    // may contain a source palette. When we do the BitBlt drawing operation
    // the target display device may contain a different palette (we may not
    // have the focus) in which case GDI will do after the palette mapping

    pbmi = (BITMAPINFO *) HEADER(m_pMediaType->Format());
    if (m_pMediaType == NULL) {
        DbgBreak("Invalid media type");
    }

    hBitmap = CreateDIBSection((HDC) NULL,          // NO device context
                               pbmi,                // Format information
                               DIB_RGB_COLORS,      // Use the palette
                               (VOID **) &pBase,    // Pointer to image data
                               hMapping,            // Mapped memory handle
                               (DWORD) 0);          // Offset into memory

    if (hBitmap == NULL || pBase == NULL) {
        EXECUTE_ASSERT(CloseHandle(hMapping));
        DWORD Error = GetLastError();
        return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error);
    }

    // Initialise the DIB information structure

    DibData.hBitmap = hBitmap;
    DibData.hMapping = hMapping;
    DibData.pBase = pBase;
    DibData.PaletteVersion = PALETTE_VERSION;
    GetObject(hBitmap,sizeof(DIBSECTION),(VOID *)&DibData.DibSection);

    return NOERROR;
}


// We use the media type during the DIBSECTION creation

void CImageAllocator::NotifyMediaType(CMediaType *pMediaType)
{
    m_pMediaType = pMediaType;
}


// Overriden to increment the owning object's reference count

STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingAddRef()
{
    return m_pFilter->AddRef();
}


// Overriden to decrement the owning object's reference count

STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingRelease()
{
    return m_pFilter->Release();
}


// If you derive a class from CMediaSample that has to transport specialised
// member variables and entry points then there are three alternate solutions
// The first is to create a memory buffer larger than actually required by the
// sample and store your information either at the beginning of it or at the
// end, the former being moderately safer allowing for misbehaving transform
// filters. You then adjust the buffer address when you create the base media
// sample. This has the disadvantage of breaking up the memory allocated to
// the samples into separate blocks. The second solution is to implement a
// class derived from CMediaSample and support additional interface(s) that
// convey your private data. This means defining a custom interface. The final
// alternative is to create a class that inherits from CMediaSample and adds
// the private data structures, when you get an IMediaSample in your Receive()
// call check to see if your allocator is being used, and if it is then cast
// the IMediaSample into one of your objects. Additional checks can be made
// to ensure the sample's this pointer is known to be one of your own objects

CImageSample::CImageSample(CBaseAllocator *pAllocator,
                           TCHAR *pName,
                           HRESULT *phr,
                           LPBYTE pBuffer,
                           LONG length) :
    CMediaSample(pName,pAllocator,phr,pBuffer,length),
    m_bInit(FALSE)
{
    ASSERT(pAllocator);
    ASSERT(pBuffer);
}


// Set the shared memory DIB information

void CImageSample::SetDIBData(DIBDATA *pDibData)
{
    ASSERT(pDibData);
    m_DibData = *pDibData;
    m_bInit = TRUE;
}


// Retrieve the shared memory DIB data

DIBDATA *CImageSample::GetDIBData()
{
    ASSERT(m_bInit == TRUE);
    return &m_DibData;
}


// This class handles the creation of a palette. It is fairly specialist and
// is intended to simplify palette management for video renderer filters. It
// is for this reason that the constructor requires three other objects with
// which it interacts, namely a base media filter, a base window and a base
// drawing object although the base window or the draw object may be NULL to
// ignore that part of us. We try not to create and install palettes unless
// absolutely necessary as they typically require WM_PALETTECHANGED messages
// to be sent to every window thread in the system which is very expensive

CImagePalette::CImagePalette(CBaseFilter *pBaseFilter,
                             CBaseWindow *pBaseWindow,
                             CDrawImage *pDrawImage) :
    m_pBaseWindow(pBaseWindow),
    m_pFilter(pBaseFilter),
    m_pDrawImage(pDrawImage),
    m_hPalette(NULL)
{
    ASSERT(m_pFilter);
}


// Destructor

#ifdef DEBUG
CImagePalette::~CImagePalette()
{
    ASSERT(m_hPalette == NULL);
}
#endif


// We allow dynamic format changes of the palette but rather than change the
// palette every time we call this to work out whether an update is required.
// If the original type didn't use a palette and the new one does (or vica
// versa) then we return TRUE. If neither formats use a palette we'll return
// FALSE. If both formats use a palette we compare their colours and return
// FALSE if they match. This therefore short circuits palette creation unless
// absolutely necessary since installing palettes is an expensive operation

BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,
                                 const VIDEOINFOHEADER *pOldInfo)
{
    // We may not have a current format yet

    if (pOldInfo == NULL) {
        return TRUE;
    }

    // Do both formats not require a palette

    if (ContainsPalette(pNewInfo) == FALSE) {
        if (ContainsPalette(pOldInfo) == FALSE) {
            return FALSE;
        }
    }

    // Compare the colours to see if they match

    DWORD VideoEntries = pNewInfo->bmiHeader.biClrUsed;
    if (ContainsPalette(pNewInfo) == TRUE)
        if (ContainsPalette(pOldInfo) == TRUE)
            if (pOldInfo->bmiHeader.biClrUsed == VideoEntries)
                if (pOldInfo->bmiHeader.biClrUsed > 0)
                    if (memcmp((PVOID) GetBitmapPalette(pNewInfo),
                               (PVOID) GetBitmapPalette(pOldInfo),
                               VideoEntries * sizeof(RGBQUAD)) == 0) {

                        return FALSE;
                    }
    return TRUE;
}


// This is normally called when the input pin type is set to install a palette
// We will typically be called from two different places. The first is when we
// have negotiated a palettised media type after connection, the other is when
// we receive a new type during processing with an updated palette in which
// case we must remove and release the resources held by the current palette

// We can be passed an optional device name if we wish to prepare a palette
// for a specific monitor on a multi monitor system

HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
                                      const CMediaType *pmtOld,
				      LPSTR szDevice)
{
    const VIDEOINFOHEADER *pNewInfo = (VIDEOINFOHEADER *) pmtNew->Format();
    const VIDEOINFOHEADER *pOldInfo = (VIDEOINFOHEADER *) pmtOld->Format();
    ASSERT(pNewInfo);

    // This is an performance optimisation, when we get a media type we check
    // to see if the format requires a palette change. If either we need one
    // when previously we didn't or vica versa then this returns TRUE, if we
    // previously needed a palette and we do now it compares their colours

    if (ShouldUpdate(pNewInfo,pOldInfo) == FALSE) {
        NOTE("No update needed");
        return S_FALSE;
    }

    // We must notify the filter graph that the application may have changed
    // the palette although in practice we don't bother checking to see if it
    // is really different. If it tries to get the palette either the window
    // or renderer lock will ensure it doesn't get in until we are finished

    RemovePalette();
    m_pFilter->NotifyEvent(EC_PALETTE_CHANGED,0,0);

    // Do we need a palette for the new format

    if (ContainsPalette(pNewInfo) == FALSE) {
        NOTE("New has no palette");
        return S_FALSE;
    }

    if (m_pBaseWindow) {
        m_pBaseWindow->LockPaletteLock();
    }

    // If we're changing the palette on the fly then we increment our palette
    // cookie which is compared against the cookie also stored in all of our
    // DIBSECTION media samples. If they don't match when we come to draw it
    // then we know the sample is out of date and we'll update it's palette

    NOTE("Making new colour palette");
    m_hPalette = MakePalette(pNewInfo, szDevice);
    ASSERT(m_hPalette != NULL);

    if (m_pBaseWindow) {
        m_pBaseWindow->UnlockPaletteLock();
    }

    // The window in which the new palette is to be realised may be a NULL
    // pointer to signal that no window is in use, if so we don't call it
    // Some

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久不见久久见免费视频7| 日本欧美大码aⅴ在线播放| 91精品国产91久久综合桃花| 国产精品一品视频| 亚洲成a人v欧美综合天堂下载| 国产天堂亚洲国产碰碰| 欧美精品自拍偷拍动漫精品| 成人动漫视频在线| 国产一区在线观看麻豆| 日韩一区精品字幕| 一区二区三区在线视频免费观看| 久久精品亚洲精品国产欧美kt∨| 欧美色倩网站大全免费| 不卡一区中文字幕| 国产成a人无v码亚洲福利| 蜜臀av一区二区| 亚洲午夜久久久久久久久久久 | 国产免费观看久久| 欧美高清dvd| 在线视频欧美区| 成人高清免费在线播放| 精品系列免费在线观看| 天天爽夜夜爽夜夜爽精品视频| 亚洲视频一区二区在线观看| 国产婷婷色一区二区三区在线| 91精品国产欧美一区二区18| 欧美在线一二三四区| 91久久一区二区| 91偷拍与自偷拍精品| 成人av免费在线| 精品美女一区二区三区| 日韩一级高清毛片| 欧美一区二区三区在线| 在线电影院国产精品| 欧美日韩中文字幕精品| 91久久国产最好的精华液| 一本久久a久久精品亚洲| 91免费国产在线| 色天天综合久久久久综合片| 99久久免费视频.com| 99国产精品99久久久久久| 91麻豆免费观看| 色国产精品一区在线观看| 欧美影院一区二区三区| 色婷婷精品大视频在线蜜桃视频| 色呦呦网站一区| 欧美日韩黄色影视| 日韩一级免费一区| 精品久久国产字幕高潮| 久久久久久久久久美女| 精品盗摄一区二区三区| 国产三级一区二区三区| 国产精品三级在线观看| 亚洲欧美在线高清| 亚洲激情校园春色| 亚洲国产精品一区二区尤物区| 五月婷婷综合在线| 久久国产视频网| 国产福利91精品一区二区三区| 国产99久久久久久免费看农村| 丁香激情综合五月| 欧美性一级生活| 精品国产在天天线2019| 久久精品亚洲乱码伦伦中文| 国产精品国产自产拍在线| 亚洲欧美日韩国产成人精品影院| 亚洲高清免费在线| 亚洲二区视频在线| 欧美丝袜丝交足nylons图片| 成人午夜免费电影| 国产激情精品久久久第一区二区 | 日韩欧美国产综合| 国产日韩欧美电影| 亚洲激情一二三区| 久久成人精品无人区| 成人高清av在线| 欧美高清hd18日本| 国产欧美一区二区精品仙草咪| 亚洲男人的天堂网| 麻豆精品一区二区| 春色校园综合激情亚洲| 欧美日韩一区中文字幕| 久久综合色鬼综合色| 亚洲乱码国产乱码精品精的特点| 日本中文字幕一区二区视频 | 国产成人av电影在线观看| 91首页免费视频| 日韩视频一区二区在线观看| 国产精品视频第一区| 日韩高清国产一区在线| 粉嫩绯色av一区二区在线观看| 欧美午夜理伦三级在线观看| 久久综合狠狠综合久久激情 | 精品久久久久久久久久久久久久久| 亚洲色图色小说| 久久精品国内一区二区三区| 99精品热视频| 精品国产乱码久久久久久1区2区 | 一本色道久久综合亚洲精品按摩| 日韩视频在线永久播放| 亚洲欧美电影院| 国产aⅴ精品一区二区三区色成熟| 欧美综合一区二区三区| 国产嫩草影院久久久久| 久久国产精品区| 欧美日韩国产123区| 17c精品麻豆一区二区免费| 激情文学综合丁香| 欧美一区三区四区| 亚洲综合色视频| 懂色av一区二区夜夜嗨| 日韩精品一区二区三区在线| 亚洲一区二区在线观看视频| www.欧美日韩国产在线| 久久丝袜美腿综合| 日本aⅴ精品一区二区三区| 欧美性色综合网| 亚洲女与黑人做爰| 成人app下载| 国产精品视频九色porn| 国产在线看一区| 日韩免费高清av| 日韩精品国产精品| 欧美日韩精品一区二区| 亚洲狼人国产精品| 99精品在线观看视频| 欧美国产精品v| 国产成人8x视频一区二区 | 国产视频一区二区在线| 国产呦萝稀缺另类资源| 2020国产精品自拍| 精品亚洲成a人| 欧美mv日韩mv国产网站app| 毛片av一区二区三区| 3atv一区二区三区| 日韩国产欧美在线视频| 在线91免费看| 日韩高清在线一区| 欧美大胆人体bbbb| 国精产品一区一区三区mba桃花| 日韩一级免费观看| 国产综合色精品一区二区三区| 日韩一级完整毛片| 国产美女主播视频一区| 久久久无码精品亚洲日韩按摩| 狠狠狠色丁香婷婷综合久久五月| 精品美女一区二区| 国产成人自拍高清视频在线免费播放| 久久精品一区四区| 成人夜色视频网站在线观看| 中文幕一区二区三区久久蜜桃| 9人人澡人人爽人人精品| 中文字幕在线一区| 91精品福利视频| 天堂一区二区在线| 欧美成人video| 国产a精品视频| 亚洲精品国产无天堂网2021| 欧美色综合天天久久综合精品| 热久久国产精品| 国产网红主播福利一区二区| 91欧美激情一区二区三区成人| 夜夜爽夜夜爽精品视频| 欧美一三区三区四区免费在线看| 国产在线精品一区在线观看麻豆| 欧美国产成人在线| 欧洲av一区二区嗯嗯嗯啊| 青青草97国产精品免费观看无弹窗版| 久久综合久久综合久久| 91麻豆精东视频| 热久久一区二区| 欧美国产日本韩| 欧美日韩黄色一区二区| 韩国中文字幕2020精品| 综合久久给合久久狠狠狠97色| 欧美精品久久一区| 成人精品免费网站| 天堂成人国产精品一区| 国产日韩欧美a| 欧美日韩精品免费观看视频| 国产成人av电影在线播放| 亚洲一区在线观看视频| 精品国产网站在线观看| 99久久99久久久精品齐齐| 日本vs亚洲vs韩国一区三区 | 日韩激情视频在线观看| 国产精品网站一区| 欧美群妇大交群中文字幕| 国产精品白丝av| 亚洲午夜电影在线| 中文字幕精品一区二区三区精品| 欧美老肥妇做.爰bbww| 成人一区二区三区视频在线观看| 五月天亚洲精品| 一色桃子久久精品亚洲| 欧美电影免费提供在线观看| 色婷婷激情综合| 顶级嫩模精品视频在线看| 日韩在线一区二区三区| 亚洲图片另类小说|