mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
MapRender: First release (FormEditorCommon, FormEditorProperties, Map, MapBG, MapCommon, MapEditor, MapRenderTest.
git-svn-id: svn://ultimatepp.org/upp/trunk@4180 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5531a704ba
commit
9959d8888c
92 changed files with 7485 additions and 0 deletions
37
bazaar/MapBG/MipMap.cpp
Normal file
37
bazaar/MapBG/MipMap.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "MipMap.h"
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
void MipMapItem::Render(Draw* w, const Rect& r)
|
||||
{
|
||||
if (w)
|
||||
w->DrawImage(r, _mipMap);
|
||||
}
|
||||
|
||||
void MipMapItem::Prepare(const char* fp, const Size& sz)
|
||||
{
|
||||
if (_ready)
|
||||
return;
|
||||
_ready = true;
|
||||
|
||||
FileIn in(fp);
|
||||
One<StreamRaster> r = StreamRaster::OpenAny(in);
|
||||
if (!r)
|
||||
{
|
||||
LOG(NFormat("Ошибка при загрузке файла карты: %s", fp));
|
||||
ImageBuffer ib(sz);
|
||||
BufferPainter sw(ib);
|
||||
sw.DrawRect(sz, Yellow());
|
||||
_mipMap = ib;
|
||||
return;
|
||||
}
|
||||
|
||||
_mipMap = r->GetImage();
|
||||
}
|
||||
|
||||
void MipMapItem::Release()
|
||||
{
|
||||
if (!_ready)
|
||||
return;
|
||||
_mipMap.Clear();
|
||||
_ready = false;
|
||||
}
|
||||
Loading…
Reference in a new issue