bool plDynamicTextMap::IIsValid( void ) { if( GetImage() == nil && fHasCreateBeenCalled ) { // we are going to allocate the fImage at this point... when someone is looking for it fImage = (void *)IAllocateOSSurface( (uint16_t)fWidth, (uint16_t)fHeight ); hsColorRGBA color; if( fInitBuffer != nil ) { IClearFromBuffer( fInitBuffer ); } else { color.Set( 0.f, 0.f, 0.f, 1.f ); ClearToColor( color ); FlushToHost(); } IBuildLevelSizes(); fTotalSize = GetLevelSize( 0 ); SetCurrLevel( 0 ); // Destroy the old texture ref, if we have one. This should force the // pipeline to recreate one more suitable for our use SetDeviceRef( nil ); plProfile_NewMem(MemMipmaps, fTotalSize); plProfile_NewMem(DynaTextMem, fTotalSize); #ifdef MEMORY_LEAK_TRACER IAddToMemRecord( this, plRecord::kViaCreate ); #endif } if( GetImage() == nil ) return false; return true;//fWriter->IsValid(); }
fJPEGData = NULL; fJAlphaData = NULL; return; } if (numLevels == 0) { numLevels = 1; while (width > 1 || height > 1) { width = (width > 1) ? width >> 1 : 1; height = (height > 1) ? height >> 1 : 1; numLevels++; } } fLevelData.resize(numLevels); fTotalSize = IBuildLevelSizes(); fImageData = new unsigned char[fTotalSize]; memset(fImageData, 0, fTotalSize); } void plMipmap::CopyFrom(plMipmap* src) { delete[] fImageData; delete[] fJPEGData; delete[] fJAlphaData; fImageData = NULL; fJPEGData = NULL; fJAlphaData = NULL; fPixelSize = src->fPixelSize; fSpace = src->fSpace; fFlags = src->fFlags;