const bool Hazard::OverlapsInEffect(const SDL_Rect* rect) const { // Only check overlap if active if (m_Active) return RectIntersect(m_Area, rect); else return false; }
void DisplayList::InvalidateRect(SRECT* r) { SRECT rect; rect.xmin = r->xmin; rect.xmax = r->xmax; rect.ymin = r->ymin; rect.ymax = r->ymax; RectInset(antialias ? -8 : -2, &rect); if ( RectTestIntersect(&devViewRect, &rect) ) { FLASHASSERT(nDirty < maxDirtyAreas); // Add to the list RectIntersect(&devViewRect, &rect, &devDirtyRect[nDirty]); RectUnion(&devDirtyRgn, &devDirtyRect[nDirty], &devDirtyRgn); // add to the dirty region devDirtyArea[nDirty] = RectArea(devDirtyRect+nDirty); // add to the list nDirty++; MergeDirtyList(nDirty == maxDirtyAreas); } }
BOOL MapToPrinterForm( PMPD pmpd, PFORM_INFO_1 pFormInfo, PPRINTERFORM pPrinterForm, BOOL bStringent ) /*++ Routine Description: Map a logical form to a printer paper size Arguments: pmpd - Pointer to printer description data pFormInfo - Pointer to logical form information pPrinterForm - Pointer to a buffer for returning printer form information bStringent - Whether to use more stringent criteria Return Value: TRUE if the logical form is supported on the printer FALSE otherwise --*/ { LONG width, height; WORD selection; PFEATURE pFeature; PPAPERSIZE pPaperSize, pNext; width = pFormInfo->Size.cx; height = pFormInfo->Size.cy; // // First check if the logical form name matches the name of a printer form. // Assert(pFormInfo->pName != NULL); pFeature = MpdPaperSizes(pmpd); Assert(pFeature->size == sizeof(PAPERSIZE)); pPaperSize = FindNamedSelection(pFeature, pFormInfo->pName, &selection); if (pPaperSize == NULL && (!bStringent || IsUserDefinedForm(pFormInfo))) { LONG dx, dy, minxy; WORD index; // // There is no name match. Try to find out if there is a // printer form whose size matches that of the logical form. // minxy = MAX_LONG; for (index=0; index < pFeature->count; index++) { pNext = FindIndexedSelection(pFeature, index); // // Compare the current size with the desired size. // dx = pNext->size.cx - width; dy = pNext->size.cy - height; // // Check if we have an exact size match. Tolerance is 1mm. // if (abs(dx) <= FORMSIZE_TOLERANCE && abs(dy) <= FORMSIZE_TOLERANCE) { selection = index; pPaperSize = pNext; break; } // // Not an exact match, see if we could fit on this form. // if (dx >= 0 && dy >= 0) { // // Check to see if the current form is smaller than // the smallest one we've found so far. // if (dx+dy < minxy) { // // Tentatively remember it as the smallest size. // selection = index; pPaperSize = pNext; minxy = dx + dy; } } } // // If there is no exact size match and the printer supports // custom paper size and the requested size is not too big, // then go ahead and select custom paper size on the printer. // if (index == pFeature->count && SupportCustomSize(pmpd, width, height)) { if (pPrinterForm) { pPrinterForm->name[0] = NUL; pPrinterForm->size = pFormInfo->Size; pPrinterForm->imageableArea = pFormInfo->ImageableArea; pPrinterForm->selection = SELIDX_ANY; } return TRUE; } } // // If the logical form is mapped to a printer paper size, then // return information about the printer paper size to the caller // if (pPaperSize && pPrinterForm) { pPrinterForm->imageableArea = pPaperSize->imageableArea; RectIntersect(&pPrinterForm->imageableArea, &pFormInfo->ImageableArea); pPrinterForm->size = pPaperSize->size; pPrinterForm->selection = selection; CopyStringW(pPrinterForm->name, pPaperSize->pName, CCHFORMNAME); } return (pPaperSize != NULL); }