View gist:1656050
class PngIconConverter | |
{ | |
/* input image with width = height is suggested to get the best result */ | |
/* png support in icon was introduced in Windows Vista */ | |
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false) | |
{ | |
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream); | |
if (input_bit != null) | |
{ | |
int width, height; |
View gist:2760319
template<typename T> | |
void CCDirector::popSceneWithTransition(float t) { | |
CCAssert(m_pRunningScene != NULL, "running scene should not null"); | |
m_pobScenesStack->removeLastObject(); | |
unsigned int c = m_pobScenesStack->count(); | |
if (c == 0) { | |
end(); | |
} |
View gist:6074996
CefClient -> Handlers | |
RequestHandler: can be used as QNetworkAccessManager | |
-> OnBeforeResourceLoad(.., .., request) | |
-> request.GetHeaderMap() | |
-> request.Url | |
ContextMenuHandler: handle context menu here | |
-> OnBeforeContextMenu(.., .., .., model) | |
-> model.AddItem(id, caption) |
View libcef notes
Cef1: | |
CefBrowser::CreateBrowser -> | |
CreateBrowserHelper -> | |
PostTask to UI Thread -> | |
CefBrowser::CreateBrowserSync | |
CefBrowser::CreateBrowserSync(window_info, client_handler, url, settings) [browser_impl.cc] | |
-> new CefBrowserImpl(window_info, settings, opener{NativeView = null}, client_handler) | |
-> BrowserWebViewDelegate(this) |
View gist:3929023
#define UKN_STATIC_RUN_CODE_I(name, code) \ | |
namespace { \ | |
static struct name { \ | |
name() { \ | |
code; \ | |
} \ | |
} UKN_JOIN(g_, name); \ | |
} | |
#define UKN_STATIC_RUN_CODE(code) \ |
View gist:13001c901edf0dc9fb85
#include <objc/objc-runtime.h> | |
// from objc_runtime_new.h with some simplifications | |
#if __LP64__ | |
typedef uint32_t mask_t; | |
#define FAST_DATA_MASK 0x00007ffffffffff8UL | |
#else | |
typedef uint64_t mask_t; | |
#define FAST_DATA_MASK 0xfffffffcUL |
View gist:11047818
#include <vector> | |
#include <set> | |
struct TypeDescriptor { | |
TypeDescriptor* parent; | |
const char* name; | |
typedef std::set<TypeDescriptor*> ChildList; | |
ChildList children; |