#include <fraclist.h>
Inheritance diagram for CachedFractal:
Public Member Functions | |
CachedFractal () | |
CachedFractal constructor. | |
~CachedFractal () | |
CachedFractal destructor. | |
virtual INT32 | operator== (const FillGeometryAttribute &Attrib) |
void | SetCachedFractal (FillGeometryAttribute *) |
FillGeometryAttribute * | GetCachedFractal () |
void | IncUsageCount () |
void | DecUsageCount () |
INT32 | GetUsageCount () |
INT32 | GetSize () |
KernelBitmap * | GetBitmap () |
void | MakeFakeFractal () |
BOOL | IsFakeFractal () |
Protected Attributes | |
FillGeometryAttribute * | Fractal |
INT32 | UsageCount |
BOOL | m_bIsFake |
Definition at line 120 of file fraclist.h.
|
CachedFractal constructor.
Definition at line 132 of file fraclist.cpp. 00133 { 00134 Fractal = NULL; 00135 UsageCount = 0; 00136 m_bIsFake = FALSE; 00137 }
|
|
CachedFractal destructor.
Definition at line 152 of file fraclist.cpp. 00153 { 00154 if (IsFakeFractal()) 00155 { 00156 if (Fractal->GetBitmap()) 00157 { 00158 delete Fractal->GetBitmapRef()->GetBitmap(); 00159 Fractal->GetBitmapRef()->SetBitmap(NULL); 00160 } 00161 00162 delete Fractal; 00163 return; 00164 } 00165 00166 if (UsageCount > 0) 00167 TRACEUSER( "Mike", _T("Deleting cached fractal while it's still in use\n")); 00168 00169 if (Fractal) 00170 { 00171 GlobalFractalList* pFracList = GetApplication()->GetGlobalFractalList(); 00172 BOOL StillUsed = FALSE; 00173 00174 if (pFracList) 00175 { 00176 CachedFractal* pCachedFractal = (CachedFractal*)pFracList->GetHead(); 00177 00178 while (pCachedFractal != NULL) 00179 { 00180 OILBitmap* pBmp = NULL; 00181 if (pCachedFractal->GetBitmap()) 00182 pBmp = pCachedFractal->GetBitmap()->ActualBitmap; 00183 00184 // Are the bitmaps the same ? 00185 if (Fractal->GetBitmap() && 00186 Fractal->GetBitmap()->ActualBitmap == pBmp ) 00187 { 00188 // This fractal bitmap is still being used 00189 StillUsed = TRUE; 00190 break; 00191 } 00192 00193 pCachedFractal = (CachedFractal*)pFracList->GetNext(pCachedFractal); 00194 } 00195 } 00196 00197 if (Fractal->GetBitmap()) 00198 { 00199 // Only delete the actual bitmap, if it's not used for any other fractals 00200 if (!StillUsed) 00201 { 00202 delete Fractal->GetBitmapRef()->GetBitmap()->ActualBitmap; 00203 Fractal->GetBitmapRef()->GetBitmap()->ActualBitmap = NULL; 00204 } 00205 00206 delete Fractal->GetBitmapRef()->GetBitmap(); 00207 Fractal->GetBitmapRef()->SetBitmap(NULL); 00208 } 00209 00210 delete Fractal; 00211 } 00212 }
|
|
Definition at line 311 of file fraclist.cpp. 00312 { 00313 UsageCount--; 00314 TRACEUSER( "Mike", _T("Dec Cached Fractal @ %x, Usage to %d\n"),this, UsageCount); 00315 }
|
|
Definition at line 356 of file fraclist.cpp. 00357 { 00358 if (Fractal == NULL) 00359 return NULL; 00360 00361 return Fractal->GetBitmap(); 00362 }
|
|
Definition at line 278 of file fraclist.cpp. 00279 { 00280 return Fractal; 00281 }
|
|
Definition at line 328 of file fraclist.cpp. 00329 { 00330 ERROR2IF(Fractal->GetBitmap() == NULL || 00331 Fractal->GetBitmap()->ActualBitmap == NULL, 0, "GetSize called when bitmap is NULL"); 00332 00333 BitmapInfo Info; 00334 Info.MemoryUsed = 0; 00335 00336 if (Fractal->GetBitmap() && 00337 Fractal->GetBitmap()->ActualBitmap) 00338 { 00339 Fractal->GetBitmap()->ActualBitmap->GetInfo(&Info); 00340 } 00341 00342 return Info.MemoryUsed; 00343 }
|
|
Definition at line 136 of file fraclist.h. 00136 { return UsageCount; }
|
|
Definition at line 294 of file fraclist.cpp. 00295 { 00296 UsageCount++; 00297 TRACEUSER( "Mike", _T("Inc Cached Fractal @ %x, Usage to %d\n"),this, UsageCount); 00298 }
|
|
Definition at line 143 of file fraclist.h. 00143 { return m_bIsFake; }
|
|
Definition at line 142 of file fraclist.h.
|
|
Definition at line 227 of file fraclist.cpp. 00228 { 00229 FillGeometryAttribute* CachedFrac = GetCachedFractal(); 00230 FillGeometryAttribute* OtherFrac = (FillGeometryAttribute*)&Attrib; 00231 00232 if (OtherFrac->GetRuntimeClass() != CachedFrac->GetRuntimeClass()) 00233 return FALSE; 00234 00235 return ( OtherFrac->IsSameAsCachedFractal(CachedFrac) ); 00236 }
|
|
Definition at line 251 of file fraclist.cpp. 00252 { 00253 CCRuntimeClass* ObjectType = NewFrac->GetRuntimeClass(); 00254 FillGeometryAttribute* FracClone = (FillGeometryAttribute*)ObjectType->CreateObject(); 00255 00256 NewFrac->CacheFractalData(FracClone); 00257 00258 KernelBitmap* Bmp = new KernelBitmap(NewFrac->GetBitmap()->ActualBitmap, TRUE); 00259 FracClone->GetBitmapRef()->SetBitmap(Bmp); 00260 // Bmp->IncUsageCount(); 00261 00262 Fractal = FracClone; 00263 }
|
|
Definition at line 146 of file fraclist.h. |
|
Definition at line 149 of file fraclist.h. |
|
Definition at line 147 of file fraclist.h. |