#include <fraclist.h>
Inheritance diagram for GlobalFractalList:
Public Member Functions | |
GlobalFractalList () | |
GlobalFractalList constructor. | |
~GlobalFractalList () | |
GlobalFractalList destructor. | |
BOOL | AddFractal (FillGeometryAttribute *) |
Adds an item to the tail of the GlobalFractallist if it doesn't already exist. | |
BOOL | RemoveFractal (FillGeometryAttribute *) |
Called when a fractal is destroyed. | |
void | GetDocumentFractalData (Document *pDoc, EnumFractalData *pData) |
Updates the fields in the EnumFractalData with information about fractals in the specified document. | |
CachedFractal * | CheckFractalBitmap (FillGeometryAttribute *) |
Checks to see if this fractal fill is already in the list. | |
Static Public Member Functions | |
static BOOL | Init () |
Initialise the GlobalFractalList. | |
static BOOL | DeInit () |
DeInitialise the GlobalFractalList. Static function so it finds the global fractal list first. | |
Private Member Functions | |
INT32 | GetFractalCacheCount () |
Calculates the total number of cached fractals. | |
INT32 | GetFractalCacheSize () |
Calculates the total memory used by the cached fractals. | |
void | Destroy () |
Destroy the contents of the fractal list. |
Definition at line 183 of file fraclist.h.
|
GlobalFractalList constructor.
Definition at line 377 of file fraclist.cpp.
|
|
GlobalFractalList destructor.
Definition at line 394 of file fraclist.cpp. 00395 { 00396 if (!IsEmpty()) 00397 { 00398 TRACEALL( _T("Trying to delete global fractal list when it's not empty !!\n") ); 00399 Destroy(); 00400 } 00401 }
|
|
Adds an item to the tail of the GlobalFractallist if it doesn't already exist.
Definition at line 472 of file fraclist.cpp. 00473 { 00474 CachedFractal* ExistingFrac = CheckFractalBitmap(NewFractal); 00475 00476 if (ExistingFrac != NULL) 00477 { 00478 ExistingFrac->IncUsageCount(); 00479 return FALSE; 00480 } 00481 00482 CachedFractal* Fractal = new CachedFractal(); 00483 00484 if (Fractal == NULL) 00485 return FALSE; 00486 00487 TRACEUSER( "Mike", _T("Adding Cached Fractal @ %x\n"),Fractal); 00488 00489 Fractal->SetCachedFractal(NewFractal); 00490 Fractal->IncUsageCount(); 00491 00492 AddTail((ListItem*)Fractal); 00493 00494 if (this != GetApplication()->GetGlobalFractalList()) 00495 Fractal->MakeFakeFractal(); 00496 00497 TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount()); 00498 TRACEUSER( "Mike", _T("Cached Fractal Size = %d\n"),GetFractalCacheSize()); 00499 00500 return(TRUE); 00501 }
|
|
Checks to see if this fractal fill is already in the list.
Definition at line 549 of file fraclist.cpp. 00550 { 00551 ListItem* Fractal = GetHead(); 00552 while (Fractal!=NULL) 00553 { 00554 // Are the fractals the same ? 00555 if ( *((CachedFractal*)Fractal) == *FractalFill ) 00556 return ((CachedFractal*)Fractal); 00557 00558 Fractal = GetNext(Fractal); 00559 } 00560 return NULL; 00561 }
|
|
DeInitialise the GlobalFractalList. Static function so it finds the global fractal list first.
Definition at line 452 of file fraclist.cpp. 00453 { 00454 GlobalFractalList* FracList = GetApplication()->GetGlobalFractalList(); 00455 if (FracList) 00456 FracList->Destroy(); 00457 return TRUE; 00458 }
|
|
Destroy the contents of the fractal list.
Definition at line 416 of file fraclist.cpp. 00417 { 00418 ListItem* Fractal; 00419 while ((Fractal=RemoveHead())!=NULL) 00420 delete Fractal; 00421 }
|
|
Updates the fields in the EnumFractalData with information about fractals in the specified document.
Definition at line 618 of file fraclist.cpp. 00619 { 00620 BitmapInfo Info; 00621 GlobalFractalList FoundList; 00622 00623 if (pDoc != NULL) 00624 { 00625 // Now Scan this document's tree for any references to a bitmap 00626 Node* pNode = Node::DocFindFirstDepthFirst(pDoc); 00627 while (pNode != NULL) 00628 { 00629 // First of all is this a NodeHidden ? 00630 // If so we want to look at the actual hidden node it's pointing at, 00631 // and scan the subtree, for Hidden bitmap references. 00632 if (!pNode->IsNodeHidden()) 00633 { 00634 if (pNode->IsAnAttribute()) // Is this an Attribute ? 00635 { 00636 // Is it a Fractal Fill ? 00637 if (((NodeAttribute*)pNode)->IsAFractalFill()) 00638 { 00639 AttrFractalFill* pFrac = (AttrFractalFill*)pNode; 00640 FillGeometryAttribute* pVal = (FillGeometryAttribute*)pFrac->GetAttributeValue(); 00641 BOOL NewFractal = FoundList.AddFractal(pVal); 00642 00643 if (NewFractal) 00644 { 00645 pData->Count++; 00646 00647 if (pVal->GetBitmap() && 00648 pVal->GetBitmap()->ActualBitmap) 00649 { 00650 pVal->GetBitmap()->ActualBitmap->GetInfo(&Info); 00651 pData->Size += Info.MemoryUsed; 00652 } 00653 } 00654 } 00655 } 00656 } 00657 00658 // Move onto the next node in the tree 00659 pNode = pNode->DocFindNextDepthFirst(); 00660 } 00661 } 00662 00663 FoundList.Destroy(); 00664 }
|
|
Calculates the total number of cached fractals.
Definition at line 574 of file fraclist.cpp. 00575 { 00576 return GetCount(); 00577 }
|
|
Calculates the total memory used by the cached fractals.
Definition at line 590 of file fraclist.cpp. 00591 { 00592 INT32 FracSize = 0; 00593 ListItem* Fractal = GetHead(); 00594 while (Fractal != NULL) 00595 { 00596 FracSize += ((CachedFractal*)Fractal)->GetSize(); 00597 Fractal = GetNext(Fractal); 00598 } 00599 return FracSize; 00600 }
|
|
Initialise the GlobalFractalList.
Reimplemented from SimpleCCObject. Definition at line 435 of file fraclist.cpp. 00436 { 00437 return TRUE; 00438 }
|
|
Called when a fractal is destroyed.
Definition at line 514 of file fraclist.cpp. 00515 { 00516 CachedFractal* ExistingFrac = CheckFractalBitmap(Frac); 00517 00518 if (ExistingFrac == NULL) 00519 return TRUE; // This will be the case when we delete the cached fractal 00520 00521 ExistingFrac->DecUsageCount(); 00522 00523 if (ExistingFrac->GetUsageCount() <= 0) 00524 { 00525 TRACEUSER( "Mike", _T("Removing Cached Fractal @ %x\n"),ExistingFrac); 00526 RemoveItem((ListItem*)ExistingFrac); 00527 delete ExistingFrac; 00528 00529 return TRUE; 00530 } 00531 00532 TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount()); 00533 TRACEUSER( "Mike", _T("Cached Fractal Size = %d\n"),GetFractalCacheSize()); 00534 00535 return FALSE; // The fractal is still there 00536 }
|