Core\CSharp\MS\Internal\Ink\StrokeRenderer.cs (27)
95double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle));
115if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d)
258double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width);
259percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d));
528bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d);
529bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d);
538if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d)
848double intersectLeft = Math.Max(rect1.Left, rect2.Left);
849double intersectTop = Math.Max(rect1.Top, rect2.Top);
850double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0);
851double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0);
861double minArea = Math.Min(rect1Area, rect2Area);
1065angle = Math.PI / 2.0;
1069angle = Math.PI * 3.0 / 2.0;
1080angle = Math.PI;
1087angle = Math.Atan(dy / dx) + Math.PI;
1091angle = Math.Atan(dy / dx) + (2 * Math.PI);
1095angle = Math.Atan(dy / dx);
1100angle = angle * 180 / Math.PI;
Core\CSharp\MS\Internal\Media3D\GeneralTransform2Dto3Dto2D.cs (19)
515if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
516(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
517(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
518(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
619if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y))
933if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
934(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
935(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
936(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
1103closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
Core\CSharp\MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
492lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
493lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
768ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm);
769ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm);
826stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
827stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm);
1038int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
1039int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
1362penThickness = Math.Abs(penThickness);
1438drawingPenThickness = drawingPenThickness / Math.Abs(unitValue);
2147int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth);
2154pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo);
2289pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo);
2431int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
Core\CSharp\MS\Internal\TextFormatting\SimpleTextLine.cs (10)
302realHeight = Math.Max(realHeight, run.Height);
303realAscent = Math.Max(realAscent, run.Baseline);
304realDescent = Math.Max(realDescent, run.Height - run.Baseline);
339_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
340_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
374_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
863int first = Math.Max(ich, dcp) + _cpFirst;
864int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst;
1235cpVisible = Math.Max(cpRunStart, cp);
1267cpVisible = Math.Min(cpRunEnd, cp);
Core\CSharp\MS\Internal\TextFormatting\TextStore.cs (16)
530int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position);
531int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position);
541int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd);
575currentPosition = Math.Max(currentPosition, bounds[i + 1].Position);
1148int runLength = Math.Min(span.length, cchToAdd - ichRun);
1236int first = limit - Math.Min(charRange.Length, limitCp - firstCp);
1319int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length);
1320int ichEnd = Math.Min(ichRun + spanLength, cchUniform);
1590(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1742(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1981textTop = Math.Max(textTop, lsrun.BaselineOffset);
1982textBottom = Math.Max(textBottom, lsrun.Descent);
2002textBottom = Math.Max(textBottom, lsrun.Height + top);
2006textBottom = Math.Max(textBottom, lsrun.Height + textTop);
2070cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move);
2071cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
Core\CSharp\System\Windows\Media\FormattedText.cs (21)
354i = Math.Min(limit, i + formatRider.Length);
430i = Math.Min(limit, i + formatRider.Length);
485i = Math.Min(limit, i + formatRider.Length);
538i = Math.Min(limit, i + formatRider.Length);
597i = Math.Min(limit, i + formatRider.Length);
656i = Math.Min(limit, i + formatRider.Length);
708i = Math.Min(limit, i + formatRider.Length);
761i = Math.Min(limit, i + formatRider.Length);
814i = Math.Min(limit, i + formatRider.Length);
866i = Math.Min(limit, i + formatRider.Length);
1007return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1152Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1667int x0 = Math.Max(enumerator.Position, startIndex);
1668int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1819accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1820accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1821accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1822accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1828metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1829metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1830lineStartOfLongestLine = Math.Min(lineStartOfLongestLine, currentLine.Start);
Core\CSharp\System\Windows\Media3D\Quaternion.cs (34)
94double angleInRadians = angleInDegrees * (Math.PI / 180.0);
98Vector3D v = (axisOfRotation / length) * Math.Sin(0.5 * angleInRadians);
102_w = Math.Cos(0.5 * angleInRadians);
166double msin = Math.Sqrt(_x*_x + _y*_y + _z*_z);
175double maxcoeff = Math.Max(Math.Abs(_x),Math.Max(Math.Abs(_y),Math.Abs(_z)));
179msin = Math.Sqrt(x*x + y*y + z*z);
185return Math.Atan2(msin,mcos) * (360.0 / Math.PI);
265double rmax = 1.0/Max(Math.Abs(_x),
266Math.Abs(_y),
267Math.Abs(_z),
268Math.Abs(_w));
276double normInverse = 1.0 / Math.Sqrt(norm2);
451double max = Math.Max(Math.Max(Math.Abs(_x),Math.Abs(_y)),
452Math.Max(Math.Abs(_z),Math.Abs(_w)));
459double smallLength = Math.Sqrt(x*x+y*y+z*z+w*w);
463return Math.Sqrt(norm2);
567double theta = t * Math.PI;
569scaleFrom = Math.Cos(theta);
570scaleTo = Math.Sin(theta);
575double omega = Math.Acos(cosOmega);
576double sinOmega = Math.Sqrt(1.0 - cosOmega*cosOmega);
577scaleFrom = Math.Sin((1.0 - t) * omega) / sinOmega;
578scaleTo = Math.Sin(t * omega) / sinOmega;
586double lengthOut = lengthFrom * Math.Pow(lengthTo/lengthFrom, t);
Core\CSharp\System\Windows\Media3D\Rect3D.cs (18)
101_x = Math.Min(point1._x, point2._x);
102_y = Math.Min(point1._y, point2._y);
103_z = Math.Min(point1._z, point2._z);
104_sizeX = Math.Max(point1._x, point2._x) - _x;
105_sizeY = Math.Max(point1._y, point2._y) - _y;
106_sizeZ = Math.Max(point1._z, point2._z) - _z;
443double x = Math.Max(_x, rect._x);
444double y = Math.Max(_y, rect._y);
445double z = Math.Max(_z, rect._z);
446_sizeX = Math.Min(_x + _sizeX, rect._x + rect._sizeX) - x;
447_sizeY = Math.Min(_y + _sizeY, rect._y + rect._sizeY) - y;
448_sizeZ = Math.Min(_z + _sizeZ, rect._z + rect._sizeZ) - z;
481double x = Math.Min(_x, rect._x);
482double y = Math.Min(_y, rect._y);
483double z = Math.Min(_z, rect._z);
484_sizeX = Math.Max(_x + _sizeX, rect._x + rect._sizeX) - x;
485_sizeY = Math.Max(_y + _sizeY, rect._y + rect._sizeY) - y;
486_sizeZ = Math.Max(_z + _sizeZ, rect._z + rect._sizeZ) - z;
src\Framework\MS\Internal\Documents\DocumentGrid.cs (18)
330if (Math.Abs(pageNumber - _firstVisiblePageNumber) > 1)
603double clippedHorizontalOffset = Math.Min(_horizontalOffset, ExtentWidth - ViewportWidth);
604clippedHorizontalOffset = Math.Max(clippedHorizontalOffset, 0.0);
646double clippedVerticalOffset = Math.Min(_verticalOffset, ExtentHeight - ViewportHeight);
647clippedVerticalOffset = Math.Max(clippedVerticalOffset, 0.0);
1248pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset);
1481visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1636double centerWidth = Math.Max(ViewportWidth, ExtentWidth);
2269(int)Math.Floor( ViewportWidth /
2274maxColumns = Math.Min(maxColumns, _pageCache.PageCount);
2275maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
2286int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns));
2298double aspectDiff = Math.Abs(layoutAspect - viewportAspect);
2412newScale = Math.Max(newScale, CurrentMinimumScale);
2413newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2482scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2511scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2749Math.Max(0.0, (ExtentWidth - row.RowSize.Width) / 2.0) : 0.0;
src\Framework\MS\Internal\Documents\RowCache.cs (13)
332double roundedOffset = Math.Round(offset, _findOffsetPrecision);
340double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
341double rowHeight = Math.Round(_rowCache[i].RowSize.Height, _findOffsetPrecision);
435startOffset = Math.Round(startOffset, _findOffsetPrecision);
436endOffset = Math.Round(endOffset, _findOffsetPrecision);
442double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
494_extentWidth = Math.Max(currentRow.RowSize.Width, _extentWidth);
566_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount);
567_layoutColumns = Math.Max(1, _layoutColumns);
687pivotPage = Math.Max(0, PageCache.PageCount - columns);
1026_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth);
1154_extentWidth = Math.Max(row.RowSize.Width, _extentWidth);
1423_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
src\Framework\MS\Internal\Documents\TextBoxView.cs (32)
504desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width);
505desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
701int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count-1].EndOffset, startPosition.Offset);
702int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset);
709firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
710lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
779int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count));
1789Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)),
1790Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
1936int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount);
2045int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset);
2046int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset);
2141int startOffset = Math.Max(lineStartOffset, unclippedStartOffset);
2142int endOffset = Math.Min(lineEndOffset, unclippedEndOffset);
2201lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1;
2204firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1));
2205lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1));
2277desiredSize.Width = Math.Max(desiredSize.Width, line.Width);
2551int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved);
2647desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width);
2710int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex);
2711int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1;
2805count = Math.Max(0, count);
2811count = Math.Min(count, _viewportLineVisuals.Count - start);
2970int rangeStart = Math.Max(viewportStart, selectionStart);
2971int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
3107padding = Math.Max(0, viewport.Height - _contentSize.Height);
src\Framework\MS\Internal\Ink\LassoHelper.cs (6)
116double step = Math.Sqrt(MinDistanceSquared / distanceSquared);
241&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))
242&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
251if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
257if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
262else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
src\Framework\MS\Internal\PtsHost\ContainerParagraph.cs (13)
540fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
541fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);
554fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
555fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
615dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
705urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
706durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
842urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
843durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
src\Framework\MS\Internal\PtsHost\SubpageParagraph.cs (16)
195subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
204subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
258dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
259fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
302fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
303fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
394subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
466dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
467durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
477fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
478fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
563subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
634dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
635durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
645fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
646fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
src\Framework\MS\Internal\PtsHost\TextParaClient.cs (19)
854int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart;
858int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart;
1597int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count);
1614int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count);
1642int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual));
2088int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart);
2091int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1);
2203int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart);
2206int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1);
2298lineRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
2409elementRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
3381line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim));
3448line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
src\Framework\System\Windows\Controls\Border.cs (12)
241Size childConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width),
242Math.Max(0.0, constraint.Height - combined.Height));
648Math.Max(0.0, rt.Width - thick.Left - thick.Right),
649Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
992LeftTop = Math.Max(0.0, radii.TopLeft - left);
993TopLeft = Math.Max(0.0, radii.TopLeft - top);
994TopRight = Math.Max(0.0, radii.TopRight - top);
995RightTop = Math.Max(0.0, radii.TopRight - right);
996RightBottom = Math.Max(0.0, radii.BottomRight - right);
997BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
998BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
999LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
src\Framework\System\Windows\Controls\DataGrid.cs (18)
2655indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5078int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5079int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5097int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5098int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5099int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5100int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5140_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5738nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5819nextRowIndex = Math.Max(0, Items.Count - 1);
6004index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6147int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6149targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6592distance = Math.Abs(pt.Y - cellBounds.Top);
6600distance = Math.Abs(pt.X - cellBounds.Left);
src\Framework\System\Windows\Controls\DataGridColumnCollection.cs (24)
755int columnCount = Math.Min(newFrozenCount, Count);
763int columnCount = Math.Min(oldFrozenCount, Count);
953availableStarSpace = Math.Max(0.0, availableStarSpace - columnMinWidth);
1237double displayValue = Math.Max(width.DesiredValue, minWidth);
1277double displayValue = Math.Min(width.DesiredValue, maxWidth);
1345TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace);
1369column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth)));
1391Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth)));
1463return Math.Max(availableSpace - requiredSpace, 0.0);
1674column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
1703double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth;
1788double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth);
1923column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
2010double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths));
2011giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
2081double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue;
2112if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth)))
2140giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth);
2147giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace));
2194return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth);
2202takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace);
2273double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths));
2274takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
src\Framework\System\Windows\Controls\DockPanel.cs (10)
232childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth),
233Math.Max(0.0, constraint.Height - accumulatedHeight));
253parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
259parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
266parentWidth = Math.Max(parentWidth, accumulatedWidth);
267parentHeight = Math.Max(parentHeight, accumulatedHeight);
297Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)),
298Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) );
311rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight);
322rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
src\Framework\System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
593Math.Max(ia.OriginWidth, pagePadding.Left),
594Math.Max(ia.OriginHeight, pagePadding.Top),
595Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
596Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
635Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom);
647Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom);
718SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
722SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
src\Framework\System\Windows\Controls\Grid.cs (69)
442gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
443gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
980cell.ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1);
983cell.RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1);
988cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
992cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1169userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1193definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1294DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1311DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1532double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1584double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1614tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1625tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1736starValue = Math.Min(starValue, c_starClip);
1740double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1741maxSize = Math.Min(maxSize, c_starClip);
1779double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1780resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1781resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1842double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1845scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1893double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1965resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2083double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2086resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2087resolvedSize = Math.Max(def.MinSize, resolvedSize);
2176starValue = Math.Min(starValue, c_starClip);
2180double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2181maxSize = Math.Min(maxSize, c_starClip);
2221definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2267double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2268resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2269resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2295final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2296final = Math.Min(final, definitions[definitionIndex].SizeCache);
2302final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2303final = Math.Min(final, definitions[definitionIndex].SizeCache);
2337final = Math.Max(final, definition.MinSizeForArrange);
2353final = Math.Max(final, definition.MinSizeForArrange);
2424double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2427scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2471double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2510def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2581resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2700double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2703resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2704resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2797final = Math.Max(final, definition.MinSizeForArrange);
2813final = Math.Max(final, definition.MinSizeForArrange);
2855double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2856double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2857double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2936Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3141int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3174int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3192int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3284return (Math.Abs(d) < c_epsilon);
3295return (Math.Abs(d1 - d2) < c_epsilon);
src\Framework\System\Windows\Controls\GridSplitter.cs (13)
506_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight);
658horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement;
659verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
666_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange);
670_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange);
804definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength);
808definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength);
814minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len);
815maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min);
923delta = Math.Min(Math.Max(delta, min), max);
src\Framework\System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
264double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth);
286childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth);
294childConstraintWidth = Math.Min(childConstraintWidth, column.Width);
301maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
308maxHeight = Math.Max(maxHeight, _paddingHeader.DesiredSize.Height);
357double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth));
391rect = new Rect(accumulatedWidth, 0.0, Math.Max(remainingWidth, 0.0), arrangeSize.Height);
1250return (DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), c_thresholdX));
src\Framework\System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (10)
122desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
123desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
130desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
131desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
134desiredSize.Width = Math.Min(availableSize.Width, desiredSize.Width);
154childRect.Width = Math.Max(finalSize.Width, dataGrid.CellsPanelActualWidth);
649return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance);
698height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height);
922columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth);
923columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
src\Framework\System\Windows\Controls\Primitives\Popup.cs (26)
2114if (Math.Abs(score - childArea) < Tolerance)
2140if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2141Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2156if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2168else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2191if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2202else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2257if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2259limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2261else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2263limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2279if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2281limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2283else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2285limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2637desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2638desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2642desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2643desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2644desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height);
2717return new Rect(mousePoint.x, mousePoint.y - 1, Math.Max(0, cursorWidth - hotX), Math.Max(0, cursorHeight - hotY + 2));
src\Framework\System\Windows\Controls\ScrollViewer.cs (17)
412get { return Math.Max(0.0, ExtentWidth - ViewportWidth); }
420get { return Math.Max(0.0, ExtentHeight - ViewportHeight); }
1803DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
1811DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
1856double newUnused = Math.Max(unused + delta, 0);
1865double newUnused = Math.Min(unused + delta, 0);
1876Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet));
1886Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
1899if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks)
1904return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) ||
1905DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation));
1924bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation));
1925bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation));
1935bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y)));
1948bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
src\Framework\System\Windows\Controls\SinglePageViewer.cs (6)
711Math.Max(ia.OriginWidth, pagePadding.Left),
712Math.Max(ia.OriginHeight, pagePadding.Top),
713Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
714Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
752SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
764SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
src\Framework\System\Windows\Controls\Slider.cs (13)
1023valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1029Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize);
1033Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1045valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1051Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1055Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize);
1140previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency);
1141next = Math.Min(Maximum, previous + TickFrequency);
1161double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction)));
1199double tickNumber = Math.Round((value - Minimum) / TickFrequency);
1357this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
src\Framework\System\Windows\Controls\Stack.cs (15)
610stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height);
615stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
675offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height));
683offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
688stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
689stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
767rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height);
774rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
908double left = Math.Max(targetRectOffset, minPhysicalOffset);
909targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
1007iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
src\Framework\System\Windows\Controls\TextBlock.cs (12)
1353Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)),
1354Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom)));
1393desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth());
1622double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
2067Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)),
2068Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom)));
2419int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
2420int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
3206Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)),
3207Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom)));
3256double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
3286width = Math.Max(0.0, width - paddingWidth);
src\Framework\System\Windows\Controls\VirtualizedCellInfoCollection.cs (12)
616int left = Math.Max(Left, region.Left);
617int top = Math.Max(Top, region.Top);
618int right = Math.Min(Right, region.Right);
619int bottom = Math.Min(Bottom, region.Bottom);
689Left = Math.Min(Left, region.Left);
690Top = Math.Min(Top, region.Top);
691Right = Math.Max(prevRight, region.Right);
692Bottom = Math.Max(prevBottom, region.Bottom);
732int top = Math.Max(Top, region.Top);
733int bottom = Math.Min(Bottom, region.Bottom);
740int top = Math.Max(Top, region.Top);
741int bottom = Math.Min(Bottom, region.Bottom);
src\Framework\System\Windows\Controls\VirtualizingStackPanel.cs (172)
515double delta = Math.Abs(scrollX - oldViewportOffset.X);
528_scrollData._offset.X = Math.Floor(_scrollData._offset.X);
529_scrollData._computedOffset.X = Math.Floor(_scrollData._computedOffset.X);
641double delta = Math.Abs(scrollY - oldViewportOffset.Y);
654_scrollData._offset.Y = Math.Floor(_scrollData._offset.Y);
655_scrollData._computedOffset.Y = Math.Floor(_scrollData._computedOffset.Y);
2286double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height);
2287int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount);
2288excludeCount = Math.Max(excludeCount,
2580double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
2637_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0);
2639_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0);
3328arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength);
4670pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4674logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4706extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4741extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4776pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4780logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4812extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4847extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4865double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4866int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4867itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
4978viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
4982cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
4986cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5013viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5028cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5032cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5044cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5048cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5077viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5081cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5085cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5112viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5127cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5131cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5143cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5147cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5212cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5217viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5237cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5241cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5256viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5267cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5284cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5288cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5315cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5320viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5340cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5344cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5359viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5370cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5387cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5391cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5447double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5459firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6414double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6595childViewport.X = Math.Min(childViewport.X, 0) -
6598childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6603childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6611Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6614Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6622Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6625Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6640childViewport.Y = Math.Min(childViewport.Y, 0) -
6644childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6649childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6657Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6660Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6668Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6671Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6774childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6779childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
6978Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
6979: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
6992Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
6993: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7006adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7012adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7097pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7098pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7099pixelSizeAfterViewport = Math.Max(childPixelSize.Width - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call
7144logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7145logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7153double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7156childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7158childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7160childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7163childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7165childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7167childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7189pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7190pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7191pixelSizeAfterViewport = Math.Max(childPixelSize.Height - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call
7236logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7237logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7245double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7248childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7250childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7252childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7255childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7257childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7259childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7302sz1.Height = Math.Max(sz1.Height, sz2.Height);
7307sz1.Width = Math.Max(sz1.Width, sz2.Width);
7357childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7362childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7446uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7530Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7531: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7668uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8327rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8352previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8359rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8384previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8414rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8420rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8458rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8511rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9390return Math.Max(0, _firstItemInExtendedViewportIndex);
9398return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9520_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9547_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9573Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9578Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9847double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
9940if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
9943viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10064double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10157if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10160viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10372_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10399_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10425Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10430Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10526lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10529double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10611if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10614viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10657lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10660double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10742if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10745viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11053double left = Math.Max(targetRectOffset, minPhysicalOffset);
11054targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
11101else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11147maxChildLength = Math.Max(maxChildLength, childSize.Height);
11151maxChildLength = Math.Max(maxChildLength, childSize.Width);
11740else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11756else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
src\Framework\System\Windows\Documents\TextStore.cs (12)
869milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top));
870milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom));
2325runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2755double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2756double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2758double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
3693int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
src\Framework\System\Windows\FrameworkElement.cs (59)
4065maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight);
4068minHeight = Math.Max(Math.Min(maxHeight, height), minHeight);
4075maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth);
4078minWidth = Math.Max(Math.Min(maxWidth, width), minWidth);
4180Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d));
4181Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a));
4201h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD);
4212w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA);
4220Double yCoverB = Math.Abs(yConstr/b);
4221Double xCoverC = Math.Abs(xConstr/c);
4241h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC);
4252w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB);
4258Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line.
4259Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line.
4261Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line.
4262Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line.
4269w = Math.Min(yCoverB, xCoverA) * 0.5;
4270h = Math.Min(xCoverC, yCoverD) * 0.5;
4287Double expandFactor = Math.Min(xConstr / childBoundsTr.Width,
4343Math.Max(availableSize.Width - marginWidth, 0),
4344Math.Max(availableSize.Height - marginHeight, 0));
4392frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
4393frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
4406Math.Max(desiredSize.Width, mm.minWidth),
4407Math.Max(desiredSize.Height, mm.minHeight));
4473ltd.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4520return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4582arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth);
4583arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight);
4591transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth);
4592transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight);
4601unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth),
4602Math.Max(0, this.DesiredSize.Height - marginHeight));
4607unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width);
4608unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height);
4695double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth);
4702double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight);
4733Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth),
4734Math.Min(innerInkSize.Height, mm.maxHeight));
4766Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth),
4767Math.Max(0, finalRect.Height - marginHeight));
4916inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
4917inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
4934Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth),
4935Math.Max(0, layoutSlotSize.Height - marginHeight));
5247inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
5248inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
src\Framework\System\Windows\Shell\WindowChromeWorker.cs (23)
1226double shortestDimension = Math.Min(windowSize.Width, windowSize.Height);
1229topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2);
1245topRightRadius = Math.Min(topRightRadius, shortestDimension / 2);
1253bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2);
1261bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2);
1292(int)Math.Floor(region.Left),
1293(int)Math.Floor(region.Top),
1294(int)Math.Ceiling(region.Right),
1295(int)Math.Ceiling(region.Bottom));
1300(int)Math.Floor(region.Left),
1301(int)Math.Floor(region.Top),
1302(int)Math.Ceiling(region.Right) + 1,
1303(int)Math.Ceiling(region.Bottom) + 1,
1304(int)Math.Ceiling(radius),
1305(int)Math.Ceiling(radius));
1401deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top);
1406deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left);
1411deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom);
1416deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right);
1423cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left),
1424cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right),
1425cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top),
1426cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
src\Framework\System\Windows\Window.cs (30)
1877frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1878frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1885Math.Max(desiredSize.Width, mm.minWidth),
1886Math.Max(desiredSize.Height, mm.minHeight));
1907arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1908arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1942childArrangeBounds.Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width);
1943childArrangeBounds.Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height);
3494childConstraint.Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width)));
3495childConstraint.Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)));
3539maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3540maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3549mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3554mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3560mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3571mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3576mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3582mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3958leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3959leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3960topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3961topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4896_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4897_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
8135return new Size(Math.Max(0.0, pt.X), Math.Max(0.0, pt.Y));
net\System\Net\Sockets\_OverlappedAsyncResult.cs (2)
194Logging.Dump(Logging.Sockets, AsyncObject, "PostCompletion", wsaBuffer.Pointer, Math.Min(wsaBuffer.Length, size));
200Logging.Dump(Logging.Sockets, AsyncObject, "PostCompletion", m_SingleBuffer.Pointer, Math.Min(m_SingleBuffer.Length, size));
net\System\Net\Sockets\Socket.cs (2)
9684Logging.Dump(Logging.Sockets, m_CurrentSocket, "FinishOperation(" + m_CompletedOperation + "Async)", wsaBuffer.Pointer, Math.Min(wsaBuffer.Length, size));
9699Logging.Dump(Logging.Sockets, m_CurrentSocket, "FinishOperation(" + m_CompletedOperation + "Async)Buffer", spe.m_Buffer, spe.m_Offset, Math.Min(spe.m_Count, size));
cdf\src\NetFx40\Tools\System.Activities.Presentation\System\Activities\Presentation\Base\Core\Internal\PropertyEditing\PropertyPanel.cs (10)
178double lastChildWidth = Math.Max(0, this.LastChildWidth);
180double availableWidth = Math.Max(0, availableSize.Width - lastChildWidth - indent);
200actualSize.Height = Math.Max(actualSize.Height, child.DesiredSize.Height);
211double lastChildWidth = Math.Max(0, this.LastChildWidth);
213double availableWidth = Math.Max(0, finalSize.Width - lastChildWidth - indent);
225child.Arrange(new Rect(Math.Max(0, finalSize.Width - lastChildWidth), 0, lastChildWidth, finalSize.Height));
229child.Arrange(new Rect(left, 0, Math.Min(desiredWidth, availableWidth), finalSize.Height));
234availableWidth = Math.Max(0, availableWidth);
248double dividerRight = Math.Max(0, this.LastChildWidth);
266Math.Max(dividerLeft - firstChildWidth, 0),
cdf\src\NetFx40\Tools\System.Activities.Presentation\System\Activities\Presentation\FreeFormEditing\ConnectorRouter.cs (22)
112vec.X.IsEqualTo(0) ? 0 : Math.Sign(vec.X),
113vec.Y.IsEqualTo(0) ? 0 : Math.Sign(vec.Y)
952int steps = (int)Math.Max(Math.Abs(sub.X / margin.Width), Math.Abs(sub.Y / margin.Height)); //one of the values will be null
1147(p.X.IsNoLessThan(Math.Min(this.point1.X, this.point2.X)) && p.X.IsNoGreaterThan(Math.Max(this.point1.X, this.point2.X))) :
1148(p.Y.IsNoLessThan(Math.Min(this.point1.Y, this.point2.Y)) && p.Y.IsNoGreaterThan(Math.Max(this.point1.Y, this.point2.Y)));
1184k += k.IsEqualTo(Math.Min(k1, k2)) ? -1.0 : 1.0;
1238if (vertical.A.X < Math.Min(horizontal.A.X, horizontal.B.X) || vertical.A.X > Math.Max(horizontal.A.X, horizontal.B.X))
1243if (horizontal.A.Y < Math.Min(vertical.A.Y, vertical.B.Y) || horizontal.A.Y > Math.Max(vertical.A.Y, vertical.B.Y))
1261return k.IsNoLessThan(Math.Min(k1, k2)) && k.IsNoGreaterThan(Math.Max(k1, k2));
1468newDistance = (int)Math.Abs(newCover.A.X - escape.X);
1472newDistance = (int)Math.Abs(newCover.A.Y - escape.Y);
1475if (Math.Sign(newDistance) == Math.Sign(originalDistance) && Math.Abs(newDistance) < Math.Abs(originalDistance))
fx\src\data\System\Data\Odbc\OdbcDataReader.cs (12)
504int nValues = Math.Min(values.Length, FieldCount);
830string strdata = buffer.PtrToStringUni(0, Math.Min(lengthOrIndicator, cbMaxData) / 2);
868cbActual = Math.Min(lengthOrIndicator, cbMaxData);
1020int lengthOfCopy = Math.Min(lengthFromDataIndex, length);
1023lengthOfCopy = Math.Min(lengthOfCopy, buffer.Length - bufferIndex);
1133length = Math.Min(length, buffer.Length - bufferIndex);
1192cbReadMax = (int)Math.Min(cbLength, internalNativeBuffer.Length - 4);
1200cbReadMax = (int)Math.Min(cbLength, internalNativeBuffer.Length - 2);
1292Buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen));
1304buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen));
2005row[columnSize] = unchecked((int)Math.Min(Math.Max(Int32.MinValue, metadata[i].size.ToInt64()), Int32.MaxValue));
fx\src\data\System\Data\OleDb\ColumnBinding.cs (11)
169return Math.Max(length, 0);
223_valueBindingOffset = Math.Max(offset, 0);
227_valueBindingSize = Math.Max(size, 0);
627LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length));
667LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length) * 2); /* charcount->bytecount*/
684LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length) * 2); /* charcount->bytecount*/
699int byteCount = Math.Min(LengthValue(), ColumnBindingMaxLen);
707int bytecount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, ColumnBindingMaxLen) : 0); // 70232
1056int byteCount = Math.Min(LengthValue(), ColumnBindingMaxLen-2);
1063int charCount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, (ColumnBindingMaxLen-2)/2) : 0); // 70232
1076int charCount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, (ColumnBindingMaxLen-2)/2) : 0); // 70232
fx\src\data\System\Data\SQLTypes\SQLDecimal.cs (26)
430precision = Math.Max(precision, m_bScale);
689double dInt = Math.Floor(dVal);
695dVal = Math.Floor (dInt / DUINT_BASE);
700dVal = Math.Floor (dInt / DUINT_BASE);
706dVal = Math.Floor (dInt / DUINT_BASE);
712dVal = Math.Floor (dInt / DUINT_BASE);
766dFrac -= Math.Floor (dFrac);
1125dRet /= System.Math.Pow(10.0, m_bScale);
1222ResInteger = Math.Max((int)x.m_bPrec - MyScale, (int)y.m_bPrec - OpScale);
1226ResScale = Math.Max(MyScale, OpScale);
1232ResPrec = Math.Min(MaxPrecision, ResPrec);
1433ResScale = Math.Min((ResPrec - ResInteger),ResScale);
1435ResScale = Math.Max(ResScale, Math.Min(ActualScale,x_cNumeDivScaleMin));
1649ResScale = Math.Max(x.m_bScale + y.m_bPrec + 1, x_cNumeDivScaleMin);
1652MinScale = Math.Min(ResScale, x_cNumeDivScaleMin);
1654ResInteger = Math.Min(ResInteger, NUMERIC_MAX_PRECISION);
1661ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1662ResScale = Math.Max(ResScale, MinScale);
2236bNewPrec = (byte) (Math.Min(NUMERIC_MAX_PRECISION,Math.Max(1,lAdjust + m_bPrec)));
3059lPosition = Math.Min(NUMERIC_MAX_PRECISION, lPosition);
3065lPosition = Math.Max(-NUMERIC_MAX_PRECISION, lPosition);
3075int lAdjust = Math.Abs(lPosition - (int)n.m_bScale); // Precision adjustment
3110lAdjust = Math.Abs(lPosition - n.m_bScale);
3152n = new SqlDecimal(Math.Pow(dBaseNum, exp));