mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
Add patch to avoid unnecessary redrawing.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12490 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8f5f0db6d1
commit
a9c23f7485
2 changed files with 24 additions and 16 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-02-10 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m ([-drawRect:]): make this more efficent,
|
||||||
|
only redraw cells that we clip.
|
||||||
|
|
||||||
Mon Feb 11 00:35:19 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
Mon Feb 11 00:35:19 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
* Source/NSLayoutManager.m ([-dealloc]): Modified to work for
|
* Source/NSLayoutManager.m ([-dealloc]): Modified to work for
|
||||||
|
|
|
@ -463,7 +463,7 @@
|
||||||
if (![_menu _ownedByPopUp])
|
if (![_menu _ownedByPopUp])
|
||||||
_cellSize.width = accumulatedOffset + 3; // Add the border width
|
_cellSize.width = accumulatedOffset + 3; // Add the border width
|
||||||
|
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
[self setFrameSize: NSMakeSize(_cellSize.width + 1,
|
[self setFrameSize: NSMakeSize(_cellSize.width + 1,
|
||||||
(howMany * _cellSize.height))];
|
(howMany * _cellSize.height))];
|
||||||
|
@ -527,7 +527,7 @@
|
||||||
|
|
||||||
- (NSRect) innerRect
|
- (NSRect) innerRect
|
||||||
{
|
{
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
return NSMakeRect(_bounds.origin.x + 1, _bounds.origin.y,
|
return NSMakeRect(_bounds.origin.x + 1, _bounds.origin.y,
|
||||||
_bounds.size.width - 1, _bounds.size.height);
|
_bounds.size.width - 1, _bounds.size.height);
|
||||||
|
@ -543,10 +543,11 @@
|
||||||
{
|
{
|
||||||
NSRect theRect;
|
NSRect theRect;
|
||||||
|
|
||||||
if (_needsSizing)
|
if (_needsSizing == YES)
|
||||||
[self sizeToFit];
|
{
|
||||||
|
[self sizeToFit];
|
||||||
if (!_horizontal)
|
}
|
||||||
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
theRect.origin.y = _bounds.size.height - (_cellSize.height * (index + 1));
|
theRect.origin.y = _bounds.size.height - (_cellSize.height * (index + 1));
|
||||||
theRect.origin.x = 1;
|
theRect.origin.x = 1;
|
||||||
|
@ -572,7 +573,7 @@
|
||||||
NSRect aRect = [self rectOfItemAtIndex: i];
|
NSRect aRect = [self rectOfItemAtIndex: i];
|
||||||
|
|
||||||
// Add the border to the rectangle
|
// Add the border to the rectangle
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
aRect.origin.x--;
|
aRect.origin.x--;
|
||||||
aRect.size.width++;
|
aRect.size.width++;
|
||||||
|
@ -594,7 +595,7 @@
|
||||||
{
|
{
|
||||||
NSRect aRect = [self rectOfItemAtIndex: index];
|
NSRect aRect = [self rectOfItemAtIndex: index];
|
||||||
|
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
aRect.origin.x--;
|
aRect.origin.x--;
|
||||||
aRect.size.width++;
|
aRect.size.width++;
|
||||||
|
@ -677,7 +678,7 @@
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
|
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
f = screenRect.size.height * (items - 1);
|
f = screenRect.size.height * (items - 1);
|
||||||
screenFrame.size.height += f;
|
screenFrame.size.height += f;
|
||||||
|
@ -696,7 +697,7 @@
|
||||||
// Compute position for popups, if needed
|
// Compute position for popups, if needed
|
||||||
if (selectedItemIndex > -1)
|
if (selectedItemIndex > -1)
|
||||||
{
|
{
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
screenFrame.origin.y += screenRect.size.height * selectedItemIndex;
|
screenFrame.origin.y += screenRect.size.height * selectedItemIndex;
|
||||||
}
|
}
|
||||||
|
@ -731,7 +732,7 @@
|
||||||
DPSgsave(ctxt);
|
DPSgsave(ctxt);
|
||||||
DPSsetlinewidth(ctxt, 1);
|
DPSsetlinewidth(ctxt, 1);
|
||||||
DPSsetgray(ctxt, NSDarkGray);
|
DPSsetgray(ctxt, NSDarkGray);
|
||||||
if (!_horizontal)
|
if (_horizontal == NO)
|
||||||
{
|
{
|
||||||
DPSmoveto(ctxt, NSMinX(_bounds), NSMinY(_bounds));
|
DPSmoveto(ctxt, NSMinX(_bounds), NSMinY(_bounds));
|
||||||
DPSrlineto(ctxt, 0, _bounds.size.height);
|
DPSrlineto(ctxt, 0, _bounds.size.height);
|
||||||
|
@ -747,13 +748,15 @@
|
||||||
// Draw the menu cells.
|
// Draw the menu cells.
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
NSRect aRect;
|
NSRect aRect;
|
||||||
NSMenuItemCell *aCell;
|
NSMenuItemCell *aCell;
|
||||||
|
|
||||||
aRect = [self rectOfItemAtIndex: i];
|
aRect = [self rectOfItemAtIndex: i];
|
||||||
// FIXME: Should check if rect overlapps aRect
|
if (NSIntersectsRect(rect, aRect) == YES)
|
||||||
aCell = [_itemCells objectAtIndex: i];
|
{
|
||||||
[aCell drawWithFrame: aRect inView: self];
|
aCell = [_itemCells objectAtIndex: i];
|
||||||
|
[aCell drawWithFrame: aRect inView: self];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue