mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 20:43:26 +02:00
items draw rework, npc trade fix
This commit is contained in:
@@ -13,7 +13,7 @@ SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)"
|
||||
|
||||
# set debug as default build type
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
SET(CMAKE_BUILD_TYPE Debug)
|
||||
ENDIF()
|
||||
|
||||
# setup compiler options
|
||||
|
@@ -83,3 +83,23 @@ void Image::overwriteMask(const Color& maskedColor, const Color& insideColor, co
|
||||
a = writeColor.a();
|
||||
}
|
||||
}
|
||||
|
||||
void Image::append(const Point& dest, const ImagePtr& other)
|
||||
{
|
||||
if(!other)
|
||||
return;
|
||||
|
||||
uint8* otherPixels = other->getPixelData();
|
||||
for(int p = 0; p < other->getPixelCount(); ++p) {
|
||||
int x = p % other->getWidth();
|
||||
int y = p / other->getWidth();
|
||||
int pos = ((dest.y + y) * m_size.width() + (dest.x + x)) * 4;
|
||||
|
||||
if(otherPixels[p*4+3] == 0xFF) {
|
||||
m_pixels[pos+0] = otherPixels[p*4+0];
|
||||
m_pixels[pos+1] = otherPixels[p*4+1];
|
||||
m_pixels[pos+2] = otherPixels[p*4+2];
|
||||
m_pixels[pos+3] = otherPixels[p*4+3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ public:
|
||||
static ImagePtr loadPNG(const std::string& file);
|
||||
|
||||
void overwriteMask(const Color& maskedColor, const Color& insideColor = Color::white, const Color& outsideColor = Color::alpha);
|
||||
void append(const Point& dest, const ImagePtr &other);
|
||||
|
||||
std::vector<uint8>& getPixels() { return m_pixels; }
|
||||
uint8* getPixelData() { return &m_pixels[0]; }
|
||||
@@ -43,6 +44,7 @@ public:
|
||||
int getWidth() { return m_size.width(); }
|
||||
int getHeight() { return m_size.height(); }
|
||||
int getBpp() { return m_bpp; }
|
||||
uint8* getPixel(int x, int y) { return &m_pixels[(y * m_size.width() + x) * 4]; }
|
||||
|
||||
private:
|
||||
std::vector<uint8> m_pixels;
|
||||
|
@@ -142,6 +142,7 @@ void Texture::generateMipmaps()
|
||||
//FIXME: disabled because mipmaps size needs to be in base of 2,
|
||||
// and the current algorithmn does not support that
|
||||
//generateSoftwareMipmaps(getPixels());
|
||||
logTraceError("non power of 2.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user