| 46 | } |
| 47 | |
| 48 | FontTextureAtlasSlot* FontTextureAtlas::AddEntry(uint32 width, uint32 height, const Array<byte>& data) |
| 49 | { |
| 50 | if (width == 0 || height == 0) |
| 51 | return nullptr; |
| 52 | |
| 53 | // Try to find slot for the texture |
| 54 | FontTextureAtlasSlot* slot = nullptr; |
| 55 | for (int32 i = 0; i < _freeSlots.Count(); i++) |
| 56 | { |
| 57 | FontTextureAtlasSlot* e = _freeSlots[i]; |
| 58 | if (e->Width == width && e->Height == height) |
| 59 | { |
| 60 | slot = e; |
| 61 | _freeSlots.RemoveAt(i); |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | if (!slot) |
| 66 | { |
| 67 | slot = _atlas.Insert(width, height); |
| 68 | } |
| 69 | |
| 70 | if (slot) |
| 71 | { |
| 72 | // Copy data to into the atlas memory |
| 73 | CopyDataIntoSlot(slot, data); |
| 74 | _isDirty = true; |
| 75 | } |
| 76 | |
| 77 | return slot; |
| 78 | } |
| 79 | |
| 80 | bool FontTextureAtlas::Invalidate(const FontTextureAtlasSlot* slot) |
| 81 | { |
no test coverage detected