本文整理汇总了C++中SRect::FitInside方法的典型用法代码示例。如果您正苦于以下问题:C++ SRect::FitInside方法的具体用法?C++ SRect::FitInside怎么用?C++ SRect::FitInside使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SRect
的用法示例。
在下文中一共展示了SRect::FitInside方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintToBuffer
void CWindowOSXQT::PaintToBuffer(tuchar* puchBuffer, tuint32 uiInterleave, const SRect& rUpdate)
{
int iBytesNeeded = (mSize.iCX + 1) * (mSize.iCY + 1) * 4;
if (iBytesNeeded > miDrawBufferSize) {
if (mpcDrawBuffer) {
delete[] mpcDrawBuffer;
}
miDrawBufferSize = iBytesNeeded;
mpcDrawBuffer = new tuchar[miDrawBufferSize];
}
if (mpInvalidater->IsRectInvalidated() == true) {
// We need to update the buffer
SRect RectUpdate;
mpInvalidater->GetInvalidatedRect(RectUpdate);
mpInvalidater->Reset();
// Limit update rect to our actual size
SRect RectThis(SPos(0, 0), mSize);
RectUpdate.FitInside(RectThis);
// Limit update rect to, well, the update rect...
RectUpdate.FitInside(rUpdate);
GetPane()->OnDraw(RectUpdate);
if (mpControlOnTop) {
mpControlOnTop->OnDraw(RectUpdate);
}
}
// Copy to buffer delivered
tuint uiY;
for (uiY = rUpdate.iY; uiY < mSize.iCY && uiY < (rUpdate.iY + rUpdate.iCY); uiY++) {
tuchar* puchDest = puchBuffer + (uiInterleave * uiY);
tuchar* puchSource = mpcDrawBuffer + (4 * mSize.iCX * uiY);
tuint uiX;
for (uiX = rUpdate.iX; uiX < mSize.iCX && uiX < (rUpdate.iX + rUpdate.iCX); uiX++) {
((tuint32*)puchDest)[uiX] = ((tuint32*)puchSource)[uiX];
}
}
}
示例2: OnPaint
void CWindowOSXQT::OnPaint()
{
int iBytesNeeded = (mSize.iCX + 1) * (mSize.iCY + 1) * 4;
if (iBytesNeeded > miDrawBufferSize) {
if (mpcDrawBuffer) {
delete[] mpcDrawBuffer;
}
miDrawBufferSize = iBytesNeeded;
mpcDrawBuffer = new tuchar[miDrawBufferSize];
}
if (mpInvalidater->IsRectInvalidated() == false) {
// No updating neccasary
return;
}
SRect RectUpdate;
mpInvalidater->GetInvalidatedRect(RectUpdate);
mpInvalidater->Reset();
// Limit update rect to our actual size
SRect RectThis(SPos(0, 0), mSize);
RectUpdate.FitInside(RectThis);
GetPane()->OnDraw(RectUpdate);
if (mpControlOnTop) {
mpControlOnTop->OnDraw(RectUpdate);
}
PixMap srcbm;
GrafPtr saved;
Rect portBounds;
GrafPtr grafPtrThis;
BitMapPtr dstbitmap;
PixMapHandle dstpixmap;
memset(&srcbm,0,sizeof(PixMap));
// setup begin
srcbm.baseAddr = nil;
srcbm.rowBytes = 0x8000;
srcbm.bounds.left = 0;
srcbm.bounds.top = 0;
srcbm.bounds.right = mSize.iCX - 1;
srcbm.bounds.bottom = mSize.iCY - 1;
// ???
int bytesPerRow = mSize.iCX * 4;
srcbm.pmVersion = 4;
srcbm.packType = 0;
srcbm.packSize = 0;
srcbm.hRes = 0x00480000;
srcbm.vRes = 0x00480000;
srcbm.pixelType = 0;
srcbm.pixelSize = 0;
srcbm.cmpCount = 0;
srcbm.cmpSize = 0;
srcbm.pmTable = nil;
srcbm.pixelType = RGBDirect;
srcbm.pixelSize = 32;
srcbm.cmpCount = 3;
srcbm.cmpSize = 5;
srcbm.rowBytes = 0x8000 | (unsigned short) bytesPerRow;
srcbm.baseAddr = (Ptr)mpcDrawBuffer;
unsigned long ulOffsetX, ulOffsetY;
ulOffsetX = 0;
ulOffsetY = 0;
Rect SrcRect;
SrcRect.left = RectUpdate.iX;
SrcRect.right = RectUpdate.iX + RectUpdate.iCX - 1;
SrcRect.top = RectUpdate.iY;
SrcRect.bottom = RectUpdate.iY + RectUpdate.iCY - 1;
Rect DstRect;
DstRect = SrcRect;
GetPort(&saved);
grafPtrThis = (GrafPtr)::GetWindowPort(GetWindowRef());
if (saved != grafPtrThis) {
SetPort(grafPtrThis);
}
GetPortBounds(grafPtrThis, &portBounds);
int port_offsetX = portBounds.left;
int port_offsetY = portBounds.top;
SetOrigin( port_offsetX, port_offsetY );
/* Rect rctClip;
rctClip.left = 0;
rctClip.right = rctClip.left + mSize.iCX;
rctClip.top = 0;
rctClip.bottom = rctClip.top + mSize.iCY;
ClipRect(&rctClip);*/
//.........这里部分代码省略.........