本文整理汇总了C++中Unref函数的典型用法代码示例。如果您正苦于以下问题:C++ Unref函数的具体用法?C++ Unref怎么用?C++ Unref使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Unref函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stack_arg
void CreateOpenSplineFunc::execute() {
ComValue& vect = stack_arg(0);
if (!vect.is_type(ComValue::ArrayType) || vect.array_len()==0) {
reset_stack();
push_stack(ComValue::nullval());
return;
}
const int len = vect.array_len();
const int npts = len/2;
int x[npts];
int y[npts];
ALIterator i;
AttributeValueList* avl = vect.array_val();
avl->First(i);
for (int j=0; j<npts && !avl->Done(i); j++) {
x[j] = avl->GetAttrVal(i)->int_val();
avl->Next(i);
y[j] = avl->GetAttrVal(i)->int_val();
avl->Next(i);
}
AttributeList* al = stack_keys();
Resource::ref(al);
reset_stack();
PasteCmd* cmd = nil;
if (npts) {
BrushVar* brVar = (BrushVar*) _ed->GetState("BrushVar");
PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
Transformer* rel = get_transformer(al);
ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
ArrowOpenBSpline* openspline = new ArrowOpenBSpline(x, y, npts, aVar->Head(), aVar->Tail(),
_ed->GetViewer()->GetMagnification(), stdgraphic);
if (brVar != nil) openspline->SetBrush(brVar->GetBrush());
if (patVar != nil) openspline->SetPattern(patVar->GetPattern());
if (colVar != nil) {
openspline->FillBg(!colVar->GetBgColor()->None());
openspline->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
}
openspline->SetTransformer(rel);
Unref(rel);
ArrowSplineOvComp* comp = new ArrowSplineOvComp(openspline);
comp->SetAttributeList(al);
if (PasteModeFunc::paste_mode()==0)
cmd = new PasteCmd(_ed, new Clipboard(comp));
ComValue compval(new OverlayViewRef(comp), symbol_add("ArrowSplineComp"));
push_stack(compval);
execute_log(cmd);
} else
push_stack(ComValue::nullval());
Unref(al);
}
示例2: ygeta_l
long *
ygeta_l(int iarg, long *ntot, long *dims)
{
Operations *ops;
Member *type;
void *p;
if (iarg < 0) return 0;
p = ygeta_array(iarg, &ops, &type);
yget_dims(ntot, dims, type);
if (ops != &longOps) {
if (type->dims) {
long *q = ypush_array(&longStruct, type->dims);
y_to_l[ops->promoteID](p, q, type->number);
sp[-iarg-1].ops = &intScalar;
Unref(sp[-iarg-1].value.db);
sp--;
sp[-iarg].value.db = sp[1].value.db;
sp[-iarg].ops = &dataBlockSym;
return q;
} else {
int is_db = (sp[-iarg].ops == &dataBlockSym);
long x;
y_to_l[ops->promoteID](p, &x, type->number);
sp[-iarg].ops = &longScalar;
if (is_db) Unref(sp[-iarg].value.db);
sp[-iarg].value.l = x;
return &(sp[-iarg].value.l);
}
}
return p;
}
示例3: ygeta_dz
double *
ygeta_dz(int iarg, long *ntot, long *dims, int *is_z)
{
Operations *ops;
Member *type;
void *p;
if (iarg < 0) return 0;
p = ygeta_array(iarg, &ops, &type);
yget_dims(ntot, dims, type);
*is_z = (ops==&complexOps);
if (ops!=&doubleOps && !*is_z) {
if (type->dims) {
double *q = ypush_array(&doubleStruct, type->dims);
y_to_d[ops->promoteID](p, q, type->number);
sp[-iarg-1].ops = &intScalar;
Unref(sp[-iarg-1].value.db);
sp--;
sp[-iarg].value.db = sp[1].value.db;
sp[-iarg].ops = &dataBlockSym;
return q;
} else {
int is_db = (sp[-iarg].ops == &dataBlockSym);
double x;
y_to_d[ops->promoteID](p, &x, type->number);
sp[-iarg].ops = &doubleScalar;
if (is_db) Unref(sp[-iarg].value.db);
sp[-iarg].value.d = x;
return &(sp[-iarg].value.d);
}
}
return p;
}
示例4: Line
void LinkComp::Read (istream& in) {
GraphicComp::Read(in);
Line* line = new Line(0, 0, 1, 1);
Transformer* t = ReadTransformer(in);
line->SetTransformer(t);
Unref(t);
_conn1 = (Connector*) unidraw->GetCatalog()->ReadComponent(in);
_conn2 = (Connector*) unidraw->GetCatalog()->ReadComponent(in);
Graphic* parent = new Picture;
parent->FillBg(ReadBgFilled(in));
PSColor* fg = ReadColor(in);
PSColor* bg = ReadColor(in);
parent->SetColors(fg, bg);
parent->SetBrush(ReadBrush(in));
t = ReadTransformer(in);
parent->SetTransformer(t);
Unref(t);
parent->Append(line, _conn1->GetGraphic(), _conn2->GetGraphic());
SetGraphic(parent);
}
示例5: Ref
void ArrowInteractor::SetColors (PSColor* fg, PSColor* bg) {
Ref(fg);
Ref(bg);
Unref(_fg);
Unref(_bg);
_fg = fg;
_bg = bg;
}
示例6: Unref
Graphic::~Graphic () {
#ifdef LEAKCHECK
_leakchecker->destroy();
#endif
Unref(_fg);
Unref(_bg);
Unref(_t);
}
示例7: Ref
void Graphic::SetColors (PSColor* fg, PSColor* bg) {
Ref(fg);
Ref(bg);
Unref(_fg);
Unref(_bg);
_fg = fg;
_bg = bg;
}
示例8: Transformer
Manipulator* TextOvView::CreateManipulator (
Viewer* v, Event& e, Transformer* rel, Tool* tool
) {
Manipulator* m = nil;
Editor* ed = v->GetEditor();
int tabWidth = Math::round(.5*ivinch);
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
FontVar* fontVar = (FontVar*) ed->GetState("FontVar");
ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");
PSFont* font = (fontVar == nil) ? psstdfont : fontVar->GetFont();
PSColor* fg = (colVar == nil) ? psblack : colVar->GetFgColor();
int lineHt = font->GetLineHt();
Painter* painter = new Painter;
painter->FillBg(false);
painter->SetFont(font);
painter->SetColors(fg, nil);
Orientation o = v->GetOrientation();
if (o!=Rotated)
painter->SetTransformer(rel);
else {
rel = new Transformer(rel);
rel->Rotate(90.0);
painter->SetTransformer(rel);
Unref(rel);
}
m = new TextManip(v, painter, lineHt, tabWidth, tool);
} else if (tool->IsA(RESHAPE_TOOL)) {
TextGraphic* textgr = (TextGraphic*) GetGraphic();
Painter* painter = new Painter;
int lineHt = textgr->GetLineHeight();
Coord xpos, ypos;
rel = new Transformer;
const char* text = textgr->GetOriginal();
int size = strlen(text);
textgr->TotalTransformation(*rel);
rel->Transform(0, 0, xpos, ypos);
painter->FillBg(false);
painter->SetFont(textgr->GetFont());
painter->SetColors(textgr->GetFgColor(), nil);
painter->SetTransformer(rel);
Unref(rel);
m = new TextManip(
v, text, size, xpos, ypos, painter, lineHt, tabWidth, tool
);
} else {
m = OverlayView::CreateManipulator(v, e, rel, tool);
}
return m;
}
示例9: ReadBitmap
void StencilComp::Read (istream& in) {
GraphicComp::Read(in);
Bitmap* image = ReadBitmap(in);
Bitmap* mask = nil;
Skip(in);
int m;
in >> m;
if (m == valid_mask) {
mask = ReadBitmap(in);
} else if (m == mask_equals_image) {
mask = image;
}
UStencil* stencil = new UStencil(image, mask);
stencil->FillBg(ReadBgFilled(in));
PSColor* fg = ReadColor(in);
PSColor* bg = ReadColor(in);
stencil->SetColors(fg, bg);
Transformer* t = ReadTransformer(in);
stencil->SetTransformer(t);
Unref(t);
SetGraphic(stencil);
_filename = ReadString(in);
}
示例10: s
void JSFiber::js_callback()
{
scope s(this);
v8::Local<v8::Value> retVal;
callFunction(retVal);
Unref();
}
示例11: Ref
void DragManip::SetTransformer (Transformer* t) {
if (_relative != t) {
Ref(t);
Unref(_relative);
_relative = t;
}
}
示例12: uv_unref
void NodeMap::renderFinished() {
Nan::HandleScope scope;
// We're done with this render call, so we're unrefing so that the loop could close.
uv_unref(reinterpret_cast<uv_handle_t *>(async));
// There is no render pending anymore, we the GC could now delete this object if it went out
// of scope.
Unref();
// Move the callback and image out of the way so that the callback can start a new render call.
auto cb = std::move(callback);
auto img = std::move(image);
assert(cb);
// These have to be empty to be prepared for the next render call.
assert(!callback);
assert(!image.data);
if (error) {
std::string errorMessage;
try {
std::rethrow_exception(error);
} catch (const std::exception& ex) {
errorMessage = ex.what();
}
v8::Local<v8::Value> argv[] = {
Nan::Error(errorMessage.c_str())
};
// This must be empty to be prepared for the next render call.
error = nullptr;
assert(!error);
cb->Call(1, argv);
} else if (img.data) {
v8::Local<v8::Object> pixels = Nan::NewBuffer(
reinterpret_cast<char *>(img.data.get()), img.size(),
// Retain the data until the buffer is deleted.
[](char *, void * hint) {
delete [] reinterpret_cast<uint8_t*>(hint);
},
img.data.get()
).ToLocalChecked();
img.data.release();
v8::Local<v8::Value> argv[] = {
Nan::Null(),
pixels
};
cb->Call(2, argv);
} else {
v8::Local<v8::Value> argv[] = {
Nan::Error("Didn't get an image")
};
cb->Call(1, argv);
}
}
示例13: GetOffset
Command* PinView::InterpGraphicCompManip (Manipulator* m) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
BrushVar* brVar = (BrushVar*) ed->GetState("Brush");
SlidingPin* sp = (SlidingPin*) dm->GetRubberband();
Transformer* rel = dm->GetTransformer();
Coord px, py, dum;
float dx, dy;
PinGraphic* pinGraphic;
sp->GetCurrent(px, py, dum, dum);
if (rel != nil) {
GetOffset(rel, px, py, dx, dy);
rel = new Transformer;
rel->Translate(dx, dy);
}
Graphic* pg = GetGraphicComp()->GetGraphic();
pinGraphic = new PinGraphic(px, py, pg);
if (brVar != nil) pinGraphic->SetBrush(brVar->GetBrush());
pinGraphic->SetTransformer(rel);
Unref(rel);
return new PasteCmd(ed, new Clipboard(NewSubject(pinGraphic)));
}
示例14: Transformer
Command* PadView::InterpGraphicCompManip (Manipulator* m) {
Command* cmd = nil;
DragManip* dm = (DragManip*) m;
SlidingRect* sr = (SlidingRect*) dm->GetRubberband();
Coord l, b, r, t;
sr->GetCurrent(l, b, r, t);
if (l != r || b != t) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
BrushVar* brVar = (BrushVar*) ed->GetState("Brush");
Transformer* rel = dm->GetTransformer();
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
Graphic* pg = GetGraphicComp()->GetGraphic();
PadGraphic* padGraphic = new PadGraphic(l, b, r, t, pg);
if (brVar != nil) padGraphic->SetBrush(brVar->GetBrush());
padGraphic->SetTransformer(rel);
Unref(rel);
cmd = new PasteCmd(ed, new Clipboard(NewSubject(padGraphic)));
}
return cmd;
}
示例15: FreeDratMesh
void FreeDratMesh(void *dmesh)
{
DratMesh *dm= dmesh;
double *z= dm->mesh.mesh.z;
double *r= dm->mesh.mesh.r;
DiscardMesh(&dm->mesh);
if (z) {
Array *array= Pointee(z);
Unref(array);
}
if (r) {
Array *array= Pointee(r);
Unref(array);
}
p_free(dmesh);
}