MCPcopy Create free account
hub / github.com/InoriRus/Kyty / GetSize

Method GetSize

source/emulator/src/Graphics/Image.cpp:525–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525Math::Size Image::GetSize(const String& name)
526{
527 if (!name.EndsWith(U".png", String::Case::Insensitive))
528 {
529 EXIT("unsupported format: %s\n", name.C_Str());
530 }
531
532 File f;
533 if (!f.Open(name, File::Mode::Read))
534 {
535 EXIT("Can't open file %s\n", name.C_Str());
536 }
537
538 Math::Size s(0, 0);
539 uint32_t header = 0;
540
541 f.Seek(12);
542 f.Read(&header, 4);
543
544 if (header != 0x52444849)
545 {
546 EXIT("wrong png file: %s\n", name.C_Str());
547 }
548
549 f.ReadR(&s.width, 4);
550 f.ReadR(&s.height, 4);
551
552 f.Close();
553
554 return s;
555}
556
557} // namespace Kyty::Libs::Graphics
558

Callers 5

DirectFB_WM_ProcessEventFunction · 0.45
DirectFB_InitModesFunction · 0.45
DirectFB_MaximizeWindowFunction · 0.45

Calls 6

SeekMethod · 0.80
ReadRMethod · 0.80
EndsWithMethod · 0.45
OpenMethod · 0.45
ReadMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected