#include "bitmap.h"#include "dcommon.h"Go to the source code of this file.
Defines | |
| #define | BITMAP_GENESIS_INTERNAL GENESISCC |
Functions | |
| geBoolean GENESISCC | geBitmap_AttachToDriver (geBitmap *Bmp, DRV_Driver *Driver, uint32 DriverFlags) |
| geBoolean GENESISCC | geBitmap_DetachDriver (geBitmap *Bmp, geBoolean DoUpdate) |
| geBitmap_Palette *GENESISCC | geBitmap_Palette_CreateFromDriver (DRV_Driver *Driver, gePixelFormat Format, int Size) |
| geRDriver_THandle *GENESISCC | geBitmap_GetTHandle (const geBitmap *Bmp) |
| geBoolean GENESISCC | geBitmap_SetDriverFlags (geBitmap *Bmp, uint32 flags) |
| geBoolean GENESISCC | geBitmap_SetGammaCorrection_DontChange (geBitmap *Bmp, geFloat Gamma) |
|
|
Definition at line 48 of file bitmap._h. Referenced by geBitmap_AttachToDriver(), geBitmap_DetachDriver(), geBitmap_GetTHandle(), geBitmap_Palette_CreateFromDriver(), and geBitmap_SetDriverFlags(). |
|
||||||||||||||||
|
Definition at line 1577 of file bitmap.c. References geBitmap::Alpha, BITMAP_GENESIS_INTERNAL, clear, geBitmap::DataOwner, geBitmap::Driver, geBitmap::DriverFlags, geBitmap::DriverHandle, geBitmap::DriverInfo, geBitmap_Info::Format, GE_FALSE, GE_TRUE, geBitmap_CreateTHandle(), geBitmap_DetachDriver(), geBitmap_HasAlpha(), geBitmap_IsValid(), geBitmap_MakeDriverLockInfo(), geBitmap_Update_SystemToDriver(), geBoolean, geErrorLog_AddString, gePixelFormat_HasGoodAlpha(), geBitmap_Info::HasColorKey, geBitmap_Info::Height, geBitmap::Info, geBitmap::LockCount, geBitmap::LockOwner, max, geBitmap_Info::MaximumMip, geBitmap_Info::MinimumMip, NULL, geBitmap::PreferredFormat, RDRIVER_PF_3D, geBitmap::SeekMipCount, DRV_Driver::THandle_Destroy, and geBitmap_Info::Width. Referenced by BitmapList_AttachAll(), geBitmap_ClearMips(), geBitmap_SetFormat(), geBitmap_SetMipCount(), geBitmap_SetPreferredFormat(), and geBitmap_Update_SystemToDriver().
01579 {
01580
01581 /**************
01582 * When you want to change the Driver,
01583 * I still need a copy of the old one to get the bits out
01584 * of the old THandles. That is:
01585 *
01586 * AttachDriver(Bmp,Driver)
01587 * <do stuff>
01588 * Change Driver Entries
01589 * AttachDriver(Bmp,Driver)
01590 *
01591 * is forbidden! The two different options are :
01592 *
01593 * 1.
01594 *
01595 * AttachDriver(Bmp,Driver)
01596 * <do stuff>
01597 * DetachDriver(Bmp)
01598 * Change Driver Entries
01599 * AttachDriver(Bmp,Driver)
01600 *
01601 * 2.
01602 *
01603 * AttachDriver(Bmp,Driver1)
01604 * <do stuff>
01605 * Driver2 = copy of Driver1
01606 * Change Driver2 Entries
01607 * AttachDriver(Bmp,Driver2)
01608 * Free Driver1
01609 *
01610 * This isn't so critical when just changing modes,
01611 * but is critical when changing drivers.
01612 *
01613 ****************/
01614
01615 assert( geBitmap_IsValid(Bmp) );
01616
01617 if ( Bmp->LockOwner || Bmp->DataOwner || Bmp->LockCount )
01618 {
01619 geErrorLog_AddString(-1,"AttachToDriver : not an isolated bitmap", NULL);
01620 return GE_FALSE;
01621 }
01622
01623 if ( Bmp->DriverHandle && Bmp->Driver == Driver )
01624 {
01625 assert( DriverFlags == 0 || DriverFlags == Bmp->DriverFlags );
01626 return GE_TRUE;
01627 }
01628
01629 if ( ! geBitmap_DetachDriver(Bmp,GE_TRUE) )
01630 {
01631 geErrorLog_AddString(-1,"AttachToDriver : detach failed", NULL);
01632 return GE_FALSE;
01633 }
01634
01635 if ( DriverFlags == 0 )
01636 {
01637 DriverFlags = Bmp->DriverFlags;
01638 if ( ! DriverFlags )
01639 {
01640 // return GE_FALSE;
01641 // ? {}
01642 DriverFlags = RDRIVER_PF_3D;
01643 }
01644 }
01645
01646 if ( Driver )
01647 {
01648 int NumMipLevels;
01649 int Width,Height;
01650 geBoolean WantAlpha;
01651 geRDriver_THandle * DriverHandle;
01652
01653 // if ( Bmp->DriverFlags & RDRIVER_PF_COMBINE_LIGHTMAP )
01654 // Bmp->SeekMipCount = max(Bmp->SeekMipCount,4);
01655
01656 NumMipLevels = max(Bmp->SeekMipCount,(Bmp->Info.MaximumMip + 1));
01657 if ( NumMipLevels > 4 ) NumMipLevels = 4; // {} kind of a hack, our drivers ignore mips > 4
01658
01659 // make sizes power-of-two and square
01660 // {} note : must let drivers do this to correctly scale UV's
01661 Width = Bmp->Info.Width;
01662 Height = Bmp->Info.Height;
01663
01664 WantAlpha = geBitmap_HasAlpha(Bmp);
01665 if ( gePixelFormat_HasGoodAlpha(Bmp->PreferredFormat) )
01666 WantAlpha = GE_TRUE;
01667
01668 assert( geBitmap_IsValid(Bmp) );
01669
01670 DriverHandle = geBitmap_CreateTHandle(Driver,Width,Height,NumMipLevels,
01671 Bmp->PreferredFormat,Bmp->Info.Format,Bmp->Info.HasColorKey,
01672 WantAlpha, (Bmp->Alpha) ? GE_TRUE : GE_FALSE,
01673 DriverFlags);
01674
01675 assert( geBitmap_IsValid(Bmp) );
01676
01677 if ( ! DriverHandle )
01678 return GE_FALSE;
01679
01680 Bmp->DriverHandle = DriverHandle;
01681 Bmp->Driver = Driver;
01682 Bmp->DriverFlags = DriverFlags;
01683
01684 #ifdef _DEBUG
01685 Bmp->DriverInfo = Bmp->Info;
01686 assert( geBitmap_IsValid(Bmp) );
01687 #endif
01688 clear(&(Bmp->DriverInfo));
01689
01690 if ( ! geBitmap_MakeDriverLockInfo(Bmp,0,&(Bmp->DriverInfo)) )
01691 {
01692 geErrorLog_AddString(-1,"AttachToDriver : updateinfo", NULL);
01693 return GE_FALSE;
01694 }
01695
01696 Bmp->DriverInfo.MinimumMip = 0;
01697 Bmp->DriverInfo.MaximumMip = NumMipLevels - 1;
01698
01699 assert( geBitmap_IsValid(Bmp) );
01700
01701 assert( geBitmap_IsValid(Bmp) );
01702
01703 if ( ! geBitmap_Update_SystemToDriver(Bmp) )
01704 {
01705 geErrorLog_AddString(-1,"AttachToDriver : Update_SystemToDriver", NULL);
01706 Driver->THandle_Destroy(Bmp->DriverHandle);
01707 Bmp->DriverHandle = NULL;
01708 return GE_FALSE;
01709 }
01710
01711 // {} Palette : Update_System calls Blit_Data, which should build it for us
01712 // if Driver is pal & System isn't
01713 }
01714
01715 return GE_TRUE;
01716 }
|
|
||||||||||||
|
|
Definition at line 1923 of file bitmap.c. References BITMAP_GENESIS_INTERNAL, and geBitmap::DriverHandle. Referenced by BitmapList_CountMembersAttached(), geEngine_DrawBitmap(), geEngine_RenderPoly(), geEngine_RenderPolyArray(), geTClip_SetTexture(), RenderFace(), RenderSkyThroughFrustum(), RenderTexturedPoint(), RenderTexturedPoly(), and RenderTransPoly().
01924 {
01925 // assert( geBitmap_IsValid(Bmp) );
01926
01927 return Bmp->DriverHandle;
01928 }
|
|
||||||||||||||||
|
||||||||||||
|
Definition at line 1742 of file bitmap.c. References BITMAP_GENESIS_INTERNAL, geBitmap::DriverFlags, GE_FALSE, GE_TRUE, geBitmap_FixDriverFlags(), geBitmap_IsValid(), and geBoolean. Referenced by geEngine_AddBitmap(), geWBitmap_Pool_CreateAllWBitmaps(), and geWorld_AddBitmap().
01743 {
01744 assert( geBitmap_IsValid(Bmp) );
01745 assert(Flags);
01746 if ( ! geBitmap_FixDriverFlags(&Flags) )
01747 {
01748 Bmp->DriverFlags = 0;
01749 return GE_FALSE;
01750 }
01751 Bmp->DriverFlags = Flags;
01752 return GE_TRUE;
01753 }
|
|
||||||||||||
|
Definition at line 1834 of file bitmap.c. References geBitmap::DriverGamma, geBitmap::DriverGammaLast, geBitmap::DriverGammaSet, GE_TRUE, geBitmap_IsValid(), geBoolean, and GENESISCC. Referenced by BitmapList_AttachAll().
01835 {
01836 assert(geBitmap_IsValid(Bmp));
01837 assert( Gamma > 0.0f );
01838
01839 if ( ! Bmp->DriverGammaSet )
01840 {
01841 Bmp->DriverGammaLast = Bmp->DriverGamma;
01842 Bmp->DriverGamma = Gamma;
01843 }
01844
01845 return GE_TRUE;
01846 }
|
1.3.2