Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f576c59
Fumbling toward a transformation on CoronaTotalTime, so far the comma…
ggcrunchy Feb 7, 2019
6626191
Moved some of the time transform stuff into ShaderResource with link …
ggcrunchy Feb 8, 2019
e59f04a
Better argument checking for time transforms
ggcrunchy Feb 9, 2019
e05f972
Whoops, wasn't always linking Program back to ShaderResource
ggcrunchy Feb 10, 2019
c7af750
Removed notes to self about changes
ggcrunchy Feb 11, 2019
9058c1f
timeTransform ignored if no time dependency
ggcrunchy Feb 11, 2019
c01d916
Minor changes
ggcrunchy May 29, 2020
08dc3b6
Maintenance Revert Test
scottrules44 Sep 20, 2021
05b91fb
Simulator: Adding Samsung Galaxy 21 as a skin
scottrules44 Sep 22, 2021
f44be24
Maintenance
scottrules44 Sep 22, 2021
581d844
Android: adding rest of media intents for Android 11
scottrules44 Sep 22, 2021
265be3c
Merge
ggcrunchy Sep 23, 2021
e217c80
Merge
ggcrunchy Oct 4, 2021
ca300c1
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy Oct 19, 2021
0b5e1e9
First go at graphics.undefineEffect()
ggcrunchy Nov 9, 2021
b41e624
Revert "First go at graphics.undefineEffect()"
ggcrunchy Nov 10, 2021
5be6193
Merging upstream
ggcrunchy Aug 18, 2022
f38ecec
Merge branch 'master' of https://github.com/ggcrunchy/corona
ggcrunchy Aug 18, 2022
bb395b8
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy Dec 16, 2022
0bf47a5
Merge remote-tracking branch 'upstream/master'
ggcrunchy Jun 12, 2025
27ad840
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy May 4, 2026
6b59610
Merge branch 'master' of https://github.com/coronalabs/corona into GP…
ggcrunchy May 4, 2026
5b1a4c7
Disabled some seemingly dead code (offscreen GPU surfaces)
ggcrunchy May 5, 2026
8c2ea26
glActiveTexture() and glClientActiveTexture() were still getting drag…
ggcrunchy May 6, 2026
027abd1
First go at updating Texture and PlatformBitmap's Format types as bit…
ggcrunchy May 11, 2026
14f0423
No need to have Texture and PlatformBitmap agree for each FormatValue…
ggcrunchy May 12, 2026
bb9559e
Whoops, compressed dimension was a U8 but should be at least a U16
ggcrunchy May 15, 2026
33eab45
A couple missed Format::GetValue() uses
ggcrunchy Jun 4, 2026
7934397
A couple more format issues
ggcrunchy Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions librtt/Display/Rtt_BufferBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BufferBitmap::BufferBitmap( Rtt_Allocator* allocator, size_t w, size_t h, Platfo
fWidth( (U32) w ),
fHeight( (U32) h ),
fProperties( 0 ),
fFormat( format ),
fFormat( format.GetValue() ),
fOrientation( orientation )
{
Rtt_ASSERT( fData );
Expand Down Expand Up @@ -89,7 +89,7 @@ BufferBitmap::UprightHeight() const
PlatformBitmap::Format
BufferBitmap::GetFormat() const
{
return (PlatformBitmap::Format)fFormat;
return (PlatformBitmap::FormatValue)fFormat;
}

bool
Expand Down
66 changes: 59 additions & 7 deletions librtt/Display/Rtt_PlatformBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@
namespace Rtt
{

// ----------------------------------------------------------------------------

PlatformBitmap::Format::Format( FormatValue value )
: fValue( value )
{
}

PlatformBitmap::FormatValue
PlatformBitmap::Format::GetValue() const
{
return (FormatValue)GetStockFormatAndFlag( fValue );
}

bool
PlatformBitmap::Format::IsNonCore() const
{
return HasFormatFlag( fValue );
}

// ----------------------------------------------------------------------------

PlatformBitmap::PlatformBitmap()
Expand Down Expand Up @@ -50,7 +69,7 @@ PlatformBitmap::HitTest( Rtt_Allocator *context, int i, int j, U8 threshold ) co

int index = (int) bytesPerPixel * ( i + j*Width() );

switch ( format )
switch ( format.GetValue() )
{
case kMask:
{
Expand Down Expand Up @@ -134,7 +153,7 @@ PlatformBitmap::HasAlphaChannel() const

Format format = GetFormat();

switch ( format )
switch ( format.GetValue() )
{
case kRGBA:
case kBGRA:
Expand All @@ -143,6 +162,12 @@ PlatformBitmap::HasAlphaChannel() const
result = true;
break;
default:
if ( format.IsNonCore() )
{
FormatDetails details = FormatDetails::UnpackFromValue( format.GetBackingValue() );

result = -1 != details.fAlphaIndex;
}
break;
}

Expand Down Expand Up @@ -189,7 +214,7 @@ PlatformBitmap::IsLandscape() const
size_t
PlatformBitmap::BytesPerPixel( Format format )
{
switch( format )
switch( format.GetValue() )
{
case kMask:
return 1;
Expand All @@ -203,6 +228,12 @@ PlatformBitmap::BytesPerPixel( Format format )
case kABGR:
return 4;
default:
if ( format.IsNonCore() )
{
FormatDetails details = FormatDetails::UnpackFromValue( format.GetBackingValue() );

return details.fBytesPerComponent * details.fNumComponents;
}
break;
}

Expand Down Expand Up @@ -259,7 +290,7 @@ PlatformBitmap::GetColorByteIndexesFor(
int blueIndexOut = -1;

// Fetch the color byte index by format and endianness.
switch (format)
switch ( format.GetValue() )
{
case PlatformBitmap::kRGB:
#ifdef Rtt_LITTLE_ENDIAN
Expand Down Expand Up @@ -325,8 +356,20 @@ PlatformBitmap::GetColorByteIndexesFor(
#endif
break;
default:
// New formats need to have a case above
Rtt_ASSERT_NOT_IMPLEMENTED();
if ( format.IsNonCore() )
{
FormatDetails details = FormatDetails::UnpackFromValue( format.GetBackingValue() );

redIndexOut = details.fRedIndex;
greenIndexOut = details.fGreenIndex;
blueIndexOut = details.fBlueIndex;
alphaIndexOut = details.fAlphaIndex;
}
else
{
// New formats need to have a case above
Rtt_ASSERT_NOT_IMPLEMENTED();
}
break;
}

Expand Down Expand Up @@ -371,7 +414,7 @@ PlatformBitmap::Unlock()
void
PlatformBitmap::SwapRGB()
{
if ( GetFormat() != kRGBA )
if ( GetFormat().GetValue() != kRGBA )
return;

char * pixels = const_cast<char *>( (const char *) GetBits( NULL ) );
Expand Down Expand Up @@ -402,6 +445,15 @@ PlatformBitmap::SwapBitmapRGB( char * pixels, int w, int h )

// ----------------------------------------------------------------------------

using FV1 = Texture::FormatValue;
using FV2 = PlatformBitmap::FormatValue;

// These details are basically frozen, but enforce them.
Rtt_STATIC_ASSERT( (U32)FV1::kNumFormats == (U32)FV2::kNumFormats );
Rtt_STATIC_ASSERT( (U32)( 1U << kStockFormatBits ) >= (U32)FV1::kNumFormats );

// ----------------------------------------------------------------------------

} // namespace Rtt

// ----------------------------------------------------------------------------
Expand Down
21 changes: 18 additions & 3 deletions librtt/Display/Rtt_PlatformBitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Rtt
class PlatformBitmap
{
public:
typedef enum Format
typedef enum FormatValue
{
kUndefined = 0,
kMask,
Expand All @@ -38,7 +38,22 @@ class PlatformBitmap
kLUMINANCE_ALPHA,
kNumFormats
}
Format;
FormatValue;

class Format {
public:
Format( FormatValue value = kUndefined );

FormatValue GetValue() const;
U32 GetBackingValue() const { return fValue; }
void SetBackingValue( U32 value ) { fValue = value; }

public:
bool IsNonCore() const;

private:
U32 fValue;
};

public:
typedef enum _Orientation
Expand Down Expand Up @@ -162,7 +177,7 @@ class PlatformBitmap
bool IsLandscape() const;

// TODO: Remove as this is subsumed by GetFormat();
Rtt_INLINE bool IsMask() const { return GetFormat() == kMask; }
Rtt_INLINE bool IsMask() const { return GetFormat().GetValue() == kMask; }

public:
RenderTypes::TextureFilter GetMagFilter() const { return (RenderTypes::TextureFilter)fMagFilter; }
Expand Down
11 changes: 9 additions & 2 deletions librtt/Display/Rtt_PlatformBitmapTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ PlatformBitmapTexture::ConvertFormat( PlatformBitmap::Format format )
{
Texture::Format result = Texture::kRGBA;

switch ( format )
switch ( format.GetValue() )
{
case PlatformBitmap::kRGB:
result = Texture::kRGB;
Expand Down Expand Up @@ -88,7 +88,14 @@ PlatformBitmapTexture::ConvertFormat( PlatformBitmap::Format format )
result = Texture::kLuminanceAlpha;
break;
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
if ( format.IsNonCore() )
{
result.SetBackingValue( format.GetBackingValue() );
}
else
{
Rtt_ASSERT_NOT_IMPLEMENTED();
}
break;
}

Expand Down
11 changes: 9 additions & 2 deletions librtt/Display/Rtt_TextureResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TextureResource::ConvertFormat( Texture::Format format )
{
PlatformBitmap::Format result = PlatformBitmap::kRGBA;

switch ( format )
switch ( format.GetValue() )
{
case Texture::kRGB:
result = PlatformBitmap::kRGB;
Expand All @@ -79,7 +79,14 @@ TextureResource::ConvertFormat( Texture::Format format )
case Texture::kLuminance:
case Texture::kAlpha:
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
if ( format.IsNonCore() )
{
result.SetBackingValue( format.GetBackingValue() );
}
else
{
Rtt_ASSERT_NOT_IMPLEMENTED();
}
break;
}

Expand Down
1 change: 1 addition & 0 deletions librtt/Display/Rtt_TextureResourceBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TextureResourceBitmap::Create(

if( save_to_file )
{
// TODO? check if this can occur with non-built-in-formats (BufferBitmap currently just uses a U8)
bitmap = Rtt_NEW( allocator,
BufferBitmap( display.GetAllocator(),
w,
Expand Down
2 changes: 1 addition & 1 deletion librtt/Display/Rtt_TextureResourceCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TextureResourceCanvas* TextureResourceCanvas::Create(Rtt::TextureFactory &factor
Texture::Filter filter = RenderTypes::Convert( display.GetDefaults().GetMagTextureFilter() );
Texture::Wrap wrap = RenderTypes::Convert( display.GetDefaults().GetTextureWrapX() );

if (Texture::kLuminance == format)
if ( Texture::kLuminance == format.GetValue() )
{
format = Texture::kRGBA;
}
Expand Down
3 changes: 3 additions & 0 deletions librtt/Renderer/Rtt_FrameBufferObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
namespace Rtt
{

class BufferBitmap;
class Texture;

// ----------------------------------------------------------------------------
Expand All @@ -42,6 +43,8 @@ class FrameBufferObject : public CPUResource
U8 GetDepthBits() const { return fDepthBits; }
U8 GetStencilBits() const { return fStencilBits; }
bool GetMustClear() const { return fMustClear; }

static void Capture( BufferBitmap& bitmap, S32 x_in_pixels, S32 y_in_pixels, S32 w_in_pixels, S32 h_in_pixels );

private:
Texture* fTexture;
Expand Down
Loading