#include "stdafx.h" LEAD_IMPLEMENTOBJECT(LUserFile); ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// LUserFile::LUserFile() { } LUserFile::~LUserFile() { } L_INT LUserFile::LoadFileCallBack(pFILEINFO pFileInfo, LBitmapBase L_FAR * pLBitmap, LBuffer L_FAR * pLBuffer, L_UINT uFlags, L_INT nRow, L_INT nLines) { L_INT nHeight = 0; L_INT nWidth = 0; RECT rc; if ((uFlags & FILEREAD_FIRSTPASS) && (uFlags & FILEREAD_FIRSTROW)) m_pView->HandlePalette(WM_QUERYNEWPALETTE,m_pView->m_hWnd); SetRect(&rc, 0, 0,pLBitmap->GetWidth() ,pLBitmap->GetHeight()); pLBitmap->SetDstRect(&rc); CWindowDC dc(m_pView); pLBitmap->Paint()->SetDC(dc.GetSafeHdc()); pLBitmap->Paint()->PaintDCBuffer(*pLBuffer,nRow,nLines); if (pLBitmap->GetViewPerspective() == BOTTOM_LEFT) SetRect (&rc, 0, pLBitmap->GetHeight()/2,pLBitmap->GetWidth()/2,pLBitmap->GetHeight() ); else SetRect (&rc, 0,0,pLBitmap->GetWidth()/2,pLBitmap->GetHeight()/2 ); pLBitmap->SetDstRect(&rc); pLBitmap->Paint()->PaintDCBuffer(*pLBuffer,nRow,nLines); pLBitmap->Access(); for (L_INT row = 0; row < nLines; row++) { L_INT32 nPos = row * pLBitmap->GetBytesPerLine(); m_pLeadBuffer->Copy((L_UCHAR L_HUGE *)(pLBuffer->Lock())+nPos,pLBitmap->GetBytesPerLine()); pLBuffer->Unlock(); if(pLBitmap->PutRow(*m_pLeadBuffer, nRow)!=pLBitmap->GetBytesPerLine()) { MessageBox (NULL, _T("Error putting row data!"), _T("ERROR"), MB_OK); return 0; } m_pLeadBuffer->Resize(nRow, pLBitmap->GetBitsPerPixel(),&nWidth, &nHeight); while (nHeight--) { LBuffer tmpBuffer; L_INT32 uSize = (nWidth * pLBitmap->GetBitsPerPixel() / 8); tmpBuffer.Copy(m_pLeadBuffer->Lock(),uSize); m_pLeadBuffer->Unlock(); L_INT32 nRet32 = pLBitmap->PutRow(tmpBuffer, m_nDispRow); if (nRet32 != uSize) { MessageBox (NULL, _T("Error putting subimage data!"), _T("ERROR"), MB_OK); return 0; } m_nDispRow++; } nRow++; } pLBitmap->Release(); return SUCCESS; }