Skip to content

Commit

Permalink
feat: remove mempool in thmclrx (not byakuren)
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX committed Apr 26, 2017
1 parent 4452f1d commit e59117e
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 93 deletions.
4 changes: 3 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{
"target_name": "byakuren",
"type": "static_library",
"dependencies": [
"xmempool"
],
"sources": [
"./deps/byakuren/byakuren.c",
"./deps/byakuren/common.c",
Expand All @@ -22,7 +25,6 @@
{
"target_name": "thmclrx",
"dependencies": [
"xmempool",
"byakuren"
],
"sources": [
Expand Down
File renamed without changes.
9 changes: 1 addition & 8 deletions lib/x.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require("sugar");
var thmclrxCpp = require("../build/Release/thmclrx.node");
var pixelGetter = require("pixel-getter");
var defaultPalette = require("./defaultPalette");
var defaultPalette = require("./default_palette");
defaultPalette = defaultPalette.map(function(palette) {
return {
r : palette[0],
Expand Down Expand Up @@ -141,10 +141,3 @@ exports.mixGet = function(file, firstStepMaxColors, palette, callback, frameNumb
callback(undefined, result);
});
};

/**
* clear memory pool
*/
exports.cleanPool = function() {
thmclrxCpp.cleanPool();
};
12 changes: 0 additions & 12 deletions src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,13 @@

namespace __thmclrx__ {

MemoryPool<RGB> rgb_pool;

const Palette default_palette(256, _default_palette.colors);

void RGB::ColorString(char* str)
{
sprintf(str, "%.2X%.2X%.2X", this->red, this->green, this->blue);
}

void RGB::RecycleArray(RGB* array[], int count)
{
for(int i = 0; i < count; i++)
{
rgb_pool.Recycle(array[i]);
}

memset(array, 0, count * sizeof(RGB));
}

Palette::Palette(int count, bkr_rgb* colors)
{
this->count = count;
Expand Down
6 changes: 0 additions & 6 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
#define __COMMON_H__
#include <string>
#include <v8.h>
#include "mempool.h"
#include <byakuren/byakuren.h>

namespace __thmclrx__ {

typedef struct RGB : bkr_rgb
{
void ColorString(char* str);

// for recycling RGB objects generated from MemoryPool
static void RecycleArray(RGB* array[], int count);
} RGB;

typedef struct Palette : bkr_palette_array
Expand All @@ -53,8 +49,6 @@ typedef struct PicturePixels

v8::Local<v8::Array> StatsToV8(bkr_color_stats stats[], unsigned int count);

extern MemoryPool<RGB> rgb_pool;

}

#endif
66 changes: 0 additions & 66 deletions src/mempool.h

This file was deleted.

0 comments on commit e59117e

Please sign in to comment.