summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-09 12:20:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-09 12:20:20 +0300
commitbd989f8f08faf42e19e4e62b507e13cd4643a4ac (patch)
tree1419659738ed292c6cbb0a36a97ebf5d8a6f126c
parent0db4d44067c2e4f652e4d6a81ffdf53c2ef8d0cd (diff)
unused code removed
-rw-r--r--plugins/FloatingContacts/src/bitmap_funcs.cpp109
-rw-r--r--plugins/FloatingContacts/src/bitmap_funcs.h7
2 files changed, 0 insertions, 116 deletions
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp
index 2c0ff762e8..8412e0430f 100644
--- a/plugins/FloatingContacts/src/bitmap_funcs.cpp
+++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp
@@ -53,16 +53,6 @@ MyBitmap::MyBitmap(int w, int h)
allocate(w, h);
}
-MyBitmap::MyBitmap(const char *fn, const char *fnAlpha)
-{
- dcBmp = nullptr;
- hBmp = nullptr;
- bits = nullptr;
- width = height = 0;
- bitsSave = nullptr;
- loadFromFile(fn, fnAlpha);
-}
-
MyBitmap::~MyBitmap()
{
delete[] bitsSave;
@@ -877,105 +867,6 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque)
return hRgn;
}
-static int hex2dec(char hex)
-{
- if ((hex >= '0') && (hex <= '9'))
- return hex - '0';
- if ((hex >= 'a') && (hex <= 'f'))
- return hex - 'a' + 0xa;
- if ((hex >= 'A') && (hex <= 'F'))
- return hex - 'A' + 0xa;
- return 0;
-}
-
-bool MyBitmap::loadFromFile_pixel(const char *fn)
-{
- allocate(1, 1);
- int r, g, b, a = 255;
- const char *p = fn + mir_strlen("pixel:");
- r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
- g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
- b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
- *bits = rgba(r, g, b, a);
- return true;
-}
-
-bool MyBitmap::loadFromFile_gradient(const char *fn)
-{
- const char *p = fn + mir_strlen("gradient:");
-
- if (*p == 'h') allocate(256, 1);
- else allocate(1, 256);
-
- int r, g, b, a = 255;
-
- p += 2;
- r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
- g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
- b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
- COLOR32 from = rgba(r, g, b, a);
-
- p += 7;
- r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
- g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
- b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
- COLOR32 to = rgba(r, g, b, a);
-
- for (int i = 0; i < 256; ++i) {
- bits[i] = rgba(
- ((255 - i) * getr(from) + i * getr(to)) / 255,
- ((255 - i) * getg(from) + i * getg(to)) / 255,
- ((255 - i) * getb(from) + i * getb(to)) / 255,
- 255);
- }
-
- return true;
-}
-
-bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha)
-{
- SIZE sz;
- HBITMAP hBmpLoaded = Image_Load(_A2T(fn));
- if (!hBmpLoaded)
- return false;
-
- BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm);
- SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
-
- HDC dcTmp = CreateCompatibleDC(nullptr);
- GetBitmapDimensionEx(hBmpLoaded, &sz);
- HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
-
- allocate(sz.cx, sz.cy);
- BitBlt(dcBmp, 0, 0, width, height, dcTmp, 0, 0, SRCCOPY);
-
- DeleteObject(SelectObject(dcTmp, hBmpDcSave));
- DeleteDC(dcTmp);
-
- MyBitmap alpha;
- if (fnAlpha && alpha.loadFromFile(fnAlpha) && (alpha.getWidth() == width) && (alpha.getHeight() == height)) {
- for (int i = 0; i < width*height; i++)
- bits[i] = (bits[i] & 0x00ffffff) | ((alpha.bits[i] & 0x000000ff) << 24);
- premultipleChannels();
- }
- else makeOpaque();
-
- return true;
-}
-
-bool MyBitmap::loadFromFile(const char *fn, const char *fnAlpha)
-{
- if (bits) free();
-
- if (!strncmp(fn, "pixel:", mir_strlen("pixel:")))
- return loadFromFile_pixel(fn);
-
- if (!strncmp(fn, "gradient:", mir_strlen("gradient:")))
- return loadFromFile_gradient(fn);
-
- return loadFromFile_default(fn, fnAlpha);
-}
-
void MyBitmap::allocate(int w, int h)
{
if (dcBmp && (width == w) && (height == h)) return;
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.h b/plugins/FloatingContacts/src/bitmap_funcs.h
index 690578dabf..23192b6cf7 100644
--- a/plugins/FloatingContacts/src/bitmap_funcs.h
+++ b/plugins/FloatingContacts/src/bitmap_funcs.h
@@ -41,21 +41,14 @@ private:
void free();
- bool loadFromFile_pixel(const char *fn);
- bool loadFromFile_gradient(const char *fn);
- bool loadFromFile_png(const char *fn, const char *fnAlpha = nullptr);
- bool loadFromFile_default(const char *fn, const char *fnAlpha = nullptr);
void premultipleChannels();
public:
MyBitmap();
MyBitmap(int w, int h);
- MyBitmap(const char *fn, const char *fnAlpha = nullptr);
~MyBitmap();
void allocate(int w, int h);
- bool loadFromFile(const char *fn, const char *fnAlpha = nullptr);
-
int getWidth() { return width; }
int getHeight() { return height; }