• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GET_INT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GET_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_INT函数的具体用法?C++ GET_INT怎么用?C++ GET_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GET_INT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: load_string

void C_THISCLASS::load_config(unsigned char *data, int len)
{
	int pos=0;
  if (data[pos] == 1)
  {
    pos++;
    load_string(effect_exp[0],data,pos,len);
    load_string(effect_exp[1],data,pos,len);
    load_string(effect_exp[2],data,pos,len);
  }
  else
  {
    char buf[769];
    if (len-pos >= 768)
    {
      memcpy(buf,data+pos,768);
      pos+=768;
      buf[768]=0;
      effect_exp[2].assign(buf+512);
      buf[512]=0;
      effect_exp[1].assign(buf+256);
      buf[256]=0;
      effect_exp[0].assign(buf);
    }
  }
	if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
	if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; }

}
开发者ID:azeem,项目名称:chavs,代码行数:29,代码来源:r_shift.cpp


示例2: func_substring

CELL func_substring(CELL frame)
{
	CELL string = FV0;
	CELL start = FV1;
	CELL end = FV2;
	if (!STRINGP(string)) {
		return make_exception("expects a string");
	}
	if (!INTP(start)) {
		return make_exception("expects a non-negative start index");
	}
	if (!INTP(end)) {
		return make_exception("expects a non-negative end index");
	}

	size_t len = GET_STRING(string)->len;
	size_t starti = GET_INT(start);
	size_t endi = GET_INT(end);
	if (starti < 0 || starti > len) {
		return make_exception("start index %d out of range [0,%d]", starti, len);
	}
	if (endi < starti || endi > len) {
		return make_exception("end index %d out of range [%d,%d]", endi, starti, len);
	}

	gc_root_1("func_substring", string);
	CELL result = make_string_raw(endi - starti);
	gc_unroot();
	memcpy(GET_STRING(result)->data, GET_STRING(string)->data + starti, endi - starti);
	return result;
}
开发者ID:adrmcintyre,项目名称:wisp,代码行数:31,代码来源:string.c


示例3: improve_skill

/* code for skill improvement through use */
void improve_skill(struct char_data *ch, int skill, int chance)
{
  int percent = GET_SKILL(ch, skill);
  int newpercent, max;
  char skillbuf[MAX_STRING_LENGTH];
  char mybuf[256];

  max = max_lvl_skill[1][spells[find_skill_num_def(skill)].difficulty][(int) GET_LEVEL(ch)];
  if (percent >= max || IS_NPC(ch))
    return;
  if (number(1, (chance * 50)) > (GET_WIS(ch) + GET_INT(ch)))
    return;
  newpercent = 1;
  if (number(1, 120) <= GET_WIS(ch))
    newpercent++;
  if (number(1, 120) <= GET_INT(ch))
    newpercent++;
  percent += newpercent;
  percent = MIN(percent, max);
  SET_SKILL(ch, skill, percent);
  if (newpercent) {
    sprintf(mybuf, "SKILLIMPROVE: %s improved skill %s, int = %d, wis = %d, improved by = %d, now = %d", GET_NAME(ch), spells[find_skill_num_def(skill)].command, GET_INT(ch), GET_WIS(ch), newpercent, percent);
    mudlog(mybuf, 'D', COM_IMMORT, TRUE);
    sprintf(skillbuf, "{RYou feel your skill in {W%s {Rimproving.{x\r\n", spells[find_skill_num_def(skill)].command);
    send_to_char(skillbuf, ch);
  }
}
开发者ID:nawglan,项目名称:ShadowWind,代码行数:28,代码来源:skills.c


示例4: LFUN

CAMLprim value LFUN(sqr_nrm2_stub)(
  value vSTABLE, value vN, value vOFSX, value vINCX, value vX)
{
  CAMLparam1(vX);

  integer GET_INT(N), GET_INT(INCX);
  REAL res;

  VEC_PARAMS(X);

  caml_enter_blocking_section();  /* Allow other threads */
  if (Bool_val(vSTABLE)) {
#ifndef LACAML_DOUBLE
  res = scnrm2_(&N, X_data, &INCX);
#else
  res = dznrm2_(&N, X_data, &INCX);
#endif
  res *= res;
  } else {
    COMPLEX cres = FUN(dotc)(&N, X_data, &INCX, X_data, &INCX);
    res = cres.r;
  }
  caml_leave_blocking_section();  /* Disallow other threads */

  CAMLreturn(caml_copy_double(res));
}
开发者ID:kkirstein,项目名称:lacaml,代码行数:26,代码来源:vec_CZ_c.c


示例5: process_player_kick_packet

// process a player kick packet
void process_player_kick_packet(ubyte *data, header *hinfo)
{
	int player_num,from_player,ban,reason;	
	short player_id;
	int offset = HEADER_LENGTH;
	
	// get the address of the guy who is to be kicked
	GET_SHORT(player_id);
	GET_INT(ban);
	GET_INT(reason);
	player_num = find_player_id(player_id);
	PACKET_SET_SIZE();

	// only the server should ever receive a request to kick a guy
	Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);
	
	// determine who sent the packet	
	from_player = find_player_id(hinfo->id);

	// check to see if this guy is allowed to make such a request
	if((from_player == -1) || !multi_kick_can_kick(&Net_players[from_player]) ){
		nprintf(("Network","Received a kick request from an invalid player!!\n"));
	} 
	// otherwise, process the request fully
	else {
		// make sure we have a valid player to kick
		if(player_num == -1){
			nprintf(("Network","Received request to kick an unknown player!\n"));
		} else {
			// will handle all the rest of the details
			multi_kick_player(player_num,ban,reason);
		}
	}
}
开发者ID:DahBlount,项目名称:fs2open.github.com,代码行数:35,代码来源:multi_kick.cpp


示例6: GET_INT

void [email protected]()
{
    int maxIndex = first + count - 1, i;
    int maxTextureUnit = GET_INT(TRS_CTX_CTEXUNIT_MAX);
    void* origUnit = GET(TRS_CTX_CTEXUNIT);
    
    /* Save all the enabled arrays that are not bound to any buffers */
    SAVE_ARRAY(GET_BOOL(TRS_CTX_VERTEX_ENABLED)      && GET(TRS_CTX_VERTEX_BINDING) == 0,      GET(TRS_CTX_VERTEX_POINTER),      GET_INT(TRS_CTX_VERTEX_STRIDE),      GET_INT(TRS_CTX_VERTEX_TYPE),      GET_INT(TRS_CTX_VERTEX_SIZE));
    SAVE_ARRAY(GET_BOOL(TRS_CTX_NORMAL_ENABLED)      && GET(TRS_CTX_NORMAL_BINDING) == 0,      GET(TRS_CTX_NORMAL_POINTER),      GET_INT(TRS_CTX_NORMAL_STRIDE),      GET_INT(TRS_CTX_NORMAL_TYPE),      3);
    SAVE_ARRAY(GET_BOOL(TRS_CTX_COLOR_ENABLED)       && GET(TRS_CTX_COLOR_BINDING) == 0,       GET(TRS_CTX_COLOR_POINTER),       GET_INT(TRS_CTX_COLOR_STRIDE),       GET_INT(TRS_CTX_COLOR_TYPE),       GET_INT(TRS_CTX_COLOR_SIZE));
    SAVE_ARRAY(GET_BOOL(TRS_CTX_POINTSIZE_ENABLED)   && GET(TRS_CTX_POINTSIZE_BINDING) == 0,   GET(TRS_CTX_POINTSIZE_POINTER),   GET_INT(TRS_CTX_POINTSIZE_STRIDE),   GET_INT(TRS_CTX_POINTSIZE_TYPE),   1);
    SAVE_ARRAY(GET_BOOL(TRS_CTX_MATRIXINDEX_ENABLED) && GET(TRS_CTX_MATRIXINDEX_BINDING) == 0, GET(TRS_CTX_MATRIXINDEX_POINTER), GET_INT(TRS_CTX_MATRIXINDEX_STRIDE), GET_INT(TRS_CTX_MATRIXINDEX_TYPE), GET_INT(TRS_CTX_MATRIXINDEX_SIZE));
    SAVE_ARRAY(GET_BOOL(TRS_CTX_WEIGHT_ENABLED)      && GET(TRS_CTX_WEIGHT_BINDING) == 0,      GET(TRS_CTX_WEIGHT_POINTER),      GET_INT(TRS_CTX_WEIGHT_STRIDE),      GET_INT(TRS_CTX_WEIGHT_TYPE),      GET_INT(TRS_CTX_WEIGHT_SIZE));

    maxTextureUnit = TR_MAX(GL_TEXTURE0, maxTextureUnit);
    for (i = GL_TEXTURE0; i < maxTextureUnit + 1; i++)
    {
        SET(TRS_CTX_CTEXUNIT, i);
        SAVE_ARRAY(GET_BOOL(TRS_CTX_CTEXUNIT_TEXCOORD_ENABLED) && GET(TRS_CTX_CTEXUNIT_TEXCOORD_BINDING) == 0,
                   GET(TRS_CTX_CTEXUNIT_TEXCOORD_POINTER),
                   GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_STRIDE),
                   GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_TYPE),
                   GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_SIZE));
    }
    SET(TRS_CTX_CTEXUNIT, origUnit);
}
开发者ID:se210,项目名称:tracy,代码行数:26,代码来源:gl_hooks_tracer.c


示例7: write_mobile_espec

int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{
  if (GET_ATTACK(mob) != 0)
    fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob));
  if (GET_STR(mob) != 0)
    fprintf(fd, "Str: %d\n", GET_STR(mob));
  if (GET_ADD(mob) != 0)
    fprintf(fd, "StrAdd: %d\n", GET_ADD(mob));
  if (GET_DEX(mob) != 0)
    fprintf(fd, "Dex: %d\n", GET_DEX(mob));
  if (GET_INT(mob) != 0)
    fprintf(fd, "Int: %d\n", GET_INT(mob));
  if (GET_WIS(mob) != 0)
    fprintf(fd, "Wis: %d\n", GET_WIS(mob));
  if (GET_CON(mob) != 0)
    fprintf(fd, "Con: %d\n", GET_CON(mob));
  if (GET_CHA(mob) != 0)
    fprintf(fd, "Cha: %d\n", GET_CHA(mob));
  if(GET_CLASS(mob) != CLASS_NPC_OTHER)
    fprintf(fd, "Class: %d\n", GET_CLASS(mob));
  if(GET_RACE(mob) != RACE_NPC_OTHER)
    fprintf(fd, "Race: %d\n", GET_RACE(mob));
  if(GET_MOB_WEIGHT(mob))
    fprintf(fd, "Weight: %d\n", GET_MOB_WEIGHT(mob));

  fprintf(fd, "Size: %d\n", GET_MOB_SIZE(mob));

  fputs("E\n", fd);
  return TRUE;
}
开发者ID:vedicveko,项目名称:Aarait,代码行数:30,代码来源:genmob.c


示例8: func_integer_to_char

CELL func_integer_to_char(CELL frame)
{
	if (!(INTP(FV0) && GET_INT(FV0) >= 0 && GET_INT(FV0) <= 255)) {
		return make_exception("expects an <integer> in [0,255]");
	}
	return make_char(GET_INT(FV0));
}
开发者ID:adrmcintyre,项目名称:wisp,代码行数:7,代码来源:char.c


示例9: LFUN

CAMLprim value LFUN(mat_axpy_stub)(
  value vALPHA,
  value vM, value vN,
  value vXR, value vXC, value vX,
  value vYR, value vYC, value vY)
{
  CAMLparam2(vX, vY);
  integer GET_INT(M), GET_INT(N);
  if (M > 0 && N > 0) {
    CREATE_NUMBER(ALPHA);
    MAT_PARAMS(X);
    MAT_PARAMS(Y);
    INIT_NUMBER(ALPHA);
    caml_enter_blocking_section();
      if (rows_X == M && rows_Y == M) {
        integer MN = M * N;
        FUN(axpy)(&MN, &ALPHA, X_data, &integer_one, Y_data, &integer_one);
      } else {
        NUMBER *X_last = X_data + rows_X * N;
        do {
          FUN(axpy)(&M, &ALPHA, X_data, &integer_one, Y_data, &integer_one);
          X_data += rows_X;
          Y_data += rows_Y;
        } while (X_data != X_last);
      }
    caml_leave_blocking_section();
  }

  CAMLreturn(Val_unit);
}
开发者ID:akabe,项目名称:lacaml,代码行数:30,代码来源:mat_SDCZ_c.c


示例10: android_view_GraphicBuffer_lockCanvas

static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
        jlong wrapperHandle, jobject canvas, jobject dirtyRect) {

    GraphicBufferWrapper* wrapper =
                reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
    if (!wrapper) {
        return JNI_FALSE;
    }

    sp<GraphicBuffer> buffer(wrapper->buffer);

    Rect rect;
    if (dirtyRect) {
        rect.left = GET_INT(dirtyRect, gRectClassInfo.left);
        rect.top = GET_INT(dirtyRect, gRectClassInfo.top);
        rect.right = GET_INT(dirtyRect, gRectClassInfo.right);
        rect.bottom = GET_INT(dirtyRect, gRectClassInfo.bottom);
    } else {
        rect.set(Rect(buffer->getWidth(), buffer->getHeight()));
    }

    void* bits = NULL;
    status_t status = buffer->lock(LOCK_CANVAS_USAGE, rect, &bits);

    if (status) return JNI_FALSE;
    if (!bits) {
        buffer->unlock();
        return JNI_FALSE;
    }

    ssize_t bytesCount = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat());

    SkBitmap bitmap;
    bitmap.setInfo(SkImageInfo::Make(buffer->getWidth(), buffer->getHeight(),
                                     convertPixelFormat(buffer->getPixelFormat()),
                                     kPremul_SkAlphaType),
                   bytesCount);

    if (buffer->getWidth() > 0 && buffer->getHeight() > 0) {
        bitmap.setPixels(bits);
    } else {
        bitmap.setPixels(NULL);
    }

    SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer->getPixelFormat());
    INVOKEV(canvas, gCanvasClassInfo.setNativeBitmap, reinterpret_cast<jlong>(&bitmap));

    SkRect clipRect;
    clipRect.set(rect.left, rect.top, rect.right, rect.bottom);
    SkCanvas* nativeCanvas = GraphicsJNI::getNativeCanvas(env, canvas);
    nativeCanvas->clipRect(clipRect);

    if (dirtyRect) {
        INVOKEV(dirtyRect, gRectClassInfo.set,
                int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
    }

    return JNI_TRUE;
}
开发者ID:1477584437,项目名称:platform_frameworks_base,代码行数:59,代码来源:android_view_GraphicBuffer.cpp


示例11: affect_total

/* walk even though they could fly at will.                             */
void affect_total(struct char_data *ch)
{
  struct affected_type *af;
  int i,j;
  char buff[200];

  for(i=0; i<MAX_WEAR; i++) {
    if (ch->equipment[i])
      for(j=0; j<MAX_OBJ_AFFECT; j++)
	affect_modify(ch, ch->equipment[i]->affected[j].location,
		      (int)ch->equipment[i]->affected[j].modifier,
		      ch->equipment[i]->obj_flags.bitvector, FALSE);
  }
  
  for(af = ch->affected; af; af=af->next)
    if(af->type != SPELL_FLY)
      affect_modify(ch, af->location, (int) af->modifier, af->bitvector, 
		    FALSE);

  ch->tmpabilities = ch->abilities; 
  
  for(i=0; i<MAX_WEAR; i++) {
    if (ch->equipment[i])
      for(j=0; j<MAX_OBJ_AFFECT; j++)
	affect_modify(ch, ch->equipment[i]->affected[j].location,
		      (int) ch->equipment[i]->affected[j].modifier,
		      ch->equipment[i]->obj_flags.bitvector, TRUE);
  }
  
  
  for(af = ch->affected; af; af=af->next)
    if(af->type != SPELL_FLY)
      affect_modify(ch, af->location, (int)af->modifier, 
		    af->bitvector, TRUE);
  
  /* Make certain values are between 0..25, not < 0 and not > 25! */
  
  i = ((!IS_PC(ch)) ? 25 :18);	/* fuck polies */
 
  GET_DEX(ch) = MAX(3,MIN(GET_DEX(ch), i));
  GET_INT(ch) = MAX(3,MIN(GET_INT(ch), i));
  GET_WIS(ch) = MAX(3,MIN(GET_WIS(ch), i));
  GET_CON(ch) = MAX(3,MIN(GET_CON(ch), i));
  GET_STR(ch) = MAX(3,GET_STR(ch));
  
  if (!IS_PC(ch)) {
    GET_STR(ch) = MIN(GET_STR(ch), i);
  } else if(GET_RACE(ch) != RACE_OGRE) {
    if (GET_STR(ch) > 18) {
      GET_ADD(ch) = 100;
      GET_STR(ch) = 18;
    }
  } else {			
    /* warning: I am counting on ChangeStrength() */
    /* to be working for this to be safe :) */
    GET_STR(ch) = MIN(22,GET_STR(ch));
  }
}
开发者ID:okeuday,项目名称:sillymud,代码行数:59,代码来源:handler.c


示例12: if

void MainWindow::readSettings()
{
	QVariant v;
	QSettings s;

	s.beginGroup("Units");
	if (s.value("unit_system").toString() == "metric") {
		prefs.unit_system = METRIC;
		prefs.units = SI_units;
	} else if (s.value("unit_system").toString() == "imperial") {
		prefs.unit_system = IMPERIAL;
		prefs.units = IMPERIAL_units;
	} else {
		prefs.unit_system = PERSONALIZE;
		GET_UNIT("length", length, units::FEET, units::METERS);
		GET_UNIT("pressure", pressure, units::PSI, units::BAR);
		GET_UNIT("volume", volume, units::CUFT, units::LITER);
		GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
		GET_UNIT("weight", weight, units::LBS, units::KG);
	}
	s.endGroup();
	s.beginGroup("DisplayListColumns");
	GET_BOOL("CYLINDER", visible_cols.cylinder);
	GET_BOOL("TEMPERATURE", visible_cols.temperature);
	GET_BOOL("TOTALWEIGHT", visible_cols.totalweight);
	GET_BOOL("SUIT", visible_cols.suit);
	GET_BOOL("NITROX", visible_cols.nitrox);
	GET_BOOL("OTU", visible_cols.otu);
	GET_BOOL("MAXCNS", visible_cols.maxcns);
	GET_BOOL("SAC", visible_cols.sac);
	s.endGroup();
	s.beginGroup("TecDetails");
	GET_BOOL("po2graph", pp_graphs.po2);
	GET_BOOL("pn2graph", pp_graphs.pn2);
	GET_BOOL("phegraph", pp_graphs.phe);
	GET_DOUBLE("po2threshold", pp_graphs.po2_threshold);
	GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold);
	GET_DOUBLE("phethreshold", pp_graphs.phe_threshold);
	GET_BOOL("mod", mod);
	GET_DOUBLE("modppO2", mod_ppO2);
	GET_BOOL("ead", ead);
	GET_BOOL("redceiling", profile_red_ceiling);
	GET_BOOL("dcceiling", profile_dc_ceiling);
	GET_BOOL("calcceiling", profile_calc_ceiling);
	GET_BOOL("calcceiling3m", calc_ceiling_3m_incr);
	GET_BOOL("calcalltissues", calc_all_tissues);
	GET_INT("gflow", gflow);
	GET_INT("gfhigh", gfhigh);
	set_gf(prefs.gflow, prefs.gfhigh);
	s.endGroup();

	s.beginGroup("Display");
	v = s.value(QString("divelist_font"));
	if (v.isValid())
		prefs.divelist_font = strdup(v.toString().toUtf8().data());
}
开发者ID:1nv4d3r5,项目名称:subsurface,代码行数:56,代码来源:mainwindow.cpp


示例13: func_make_string

CELL func_make_string(CELL frame)
{
	if (!(INTP(FV0) && GET_INT(FV0) >= 0)) {
		return make_exception("1st argument expects non-negative integer");
	}
	if (FC == 2 && !CHARP(FV1)) {
		return make_exception("2nd argument expects character");
	}
	return make_string_filled(GET_INT(FV0), (FC == 2) ? GET_CHAR(FV1) : -1);
}
开发者ID:adrmcintyre,项目名称:wisp,代码行数:10,代码来源:string.c


示例14: pnm_getActualTraits

FUNC_STATUS WORD pnm_getActualTraits (
    IP_XFORM_HANDLE  hXform,         /* in:  handle for xform */
    DWORD            dwInputAvail,   /* in:  # avail bytes in input buf */
    PBYTE            pbInputBuf,     /* in:  ptr to input buffer */
    PDWORD           pdwInputUsed,   /* out: # bytes used from input buf */
    PDWORD           pdwInputNextPos,/* out: file-pos to read from next */
    PIP_IMAGE_TRAITS pInTraits,      /* out: input image traits */
    PIP_IMAGE_TRAITS pOutTraits)     /* out: output image traits */
{
    PPNM_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* If there is no header, we'll report no usage of input */
    *pdwInputUsed = 0;

    /* Parse the header for decode operations. */
    if (!g->fIsEncode) {
        unsigned char c;
        unsigned int maxval;

        GET_CHAR(&c);
        if (c!='P') {
            return IP_INPUT_ERROR;
        }
        GET_CHAR(&c);
        if (c=='4') {
            /* PBM */
            g->traits.iComponentsPerPixel=1;
            g->traits.iBitsPerPixel=1;

        } else if (c=='5') {
            /* PGM */
            g->traits.iComponentsPerPixel=1;
            g->traits.iBitsPerPixel=0;

        } else if (c=='6') {
            /* PPM */
            g->traits.iComponentsPerPixel=3;
            g->traits.iBitsPerPixel=0;

        } else {
            /* "Plain" (all-ASCII) formats (1-3) not (yet) supported. */
            return IP_INPUT_ERROR;
        }

        GET_INT(&g->traits.iPixelsPerRow);
        GET_INT(&g->traits.lNumRows);
        if (!g->traits.iBitsPerPixel) {
            GET_INT(&maxval);
            while (maxval) {
                g->traits.iBitsPerPixel++;
                maxval>>=1;
            }
        }
开发者ID:Distrotech,项目名称:hplip,代码行数:55,代码来源:xpnm.c


示例15: load_config

void C_THISCLASS::load_config(unsigned char *data, int len)
{
	int pos=0;
  int x=0;
	if (len-pos >= 4) { effect=GET_INT(); pos+=4; }
	if (len-pos >= 4) { num_colors=GET_INT(); pos+=4; }
	if (num_colors <= 16) while (len-pos >= 4 && x < num_colors) { colors[x++]=GET_INT(); pos+=4; }
  else num_colors=1;
  if (len-pos >= 4) { size=GET_INT(); pos+=4; }
  if (len-pos >= 4) { rot=GET_INT(); pos+=4; }
}
开发者ID:Denyufka,项目名称:LibVisual,代码行数:11,代码来源:r_oscstar.cpp


示例16: android_view_TextureView_lockCanvas

static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
        jlong nativeWindow, jobject canvas, jobject dirtyRect) {

    if (!nativeWindow) {
        return JNI_FALSE;
    }

    ANativeWindow_Buffer buffer;

    Rect rect;
    if (dirtyRect) {
        rect.left = GET_INT(dirtyRect, gRectClassInfo.left);
        rect.top = GET_INT(dirtyRect, gRectClassInfo.top);
        rect.right = GET_INT(dirtyRect, gRectClassInfo.right);
        rect.bottom = GET_INT(dirtyRect, gRectClassInfo.bottom);
    } else {
        rect.set(Rect(0x3FFF, 0x3FFF));
    }

    sp<ANativeWindow> window((ANativeWindow*) nativeWindow);
    int32_t status = native_window_lock(window.get(), &buffer, &rect);
    if (status) return JNI_FALSE;

    ssize_t bytesCount = buffer.stride * bytesPerPixel(buffer.format);

    SkBitmap bitmap;
    bitmap.setConfig(convertPixelFormat(buffer.format), buffer.width, buffer.height, bytesCount);

    if (buffer.format == WINDOW_FORMAT_RGBX_8888) {
        bitmap.setIsOpaque(true);
    }

    if (buffer.width > 0 && buffer.height > 0) {
        bitmap.setPixels(buffer.bits);
    } else {
        bitmap.setPixels(NULL);
    }

    SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer.format);

    SkCanvas* nativeCanvas = SkNEW_ARGS(SkCanvas, (bitmap));
    swapCanvasPtr(env, canvas, nativeCanvas);

    SkRect clipRect;
    clipRect.set(rect.left, rect.top, rect.right, rect.bottom);
    nativeCanvas->clipRect(clipRect);

    if (dirtyRect) {
        INVOKEV(dirtyRect, gRectClassInfo.set,
                int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
    }

    return JNI_TRUE;
}
开发者ID:BeTheNerd,项目名称:platform_frameworks_base,代码行数:54,代码来源:android_view_TextureView.cpp


示例17: load_config

void C_THISCLASS::load_config(unsigned char *data, int len)
{
	int pos=0;
	if (len-pos >= 4) { dir=GET_INT(); pos+=4; }
	if (len-pos >= 4) { which=GET_INT(); pos+=4; }
	if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
	if (len-pos >= 4) { adjblend_val=GET_INT(); pos+=4; }
  
  if (which < 0) which=0;
  if (which >= NBUF) which=NBUF-1;
}
开发者ID:Denyufka,项目名称:LibVisual,代码行数:11,代码来源:r_stack.cpp


示例18: VOGL_NOTE_UNUSED

// TODO: Requires GL >= 3.2 or extension GL_ARB_sync
bool vogl_sync_state::snapshot(const vogl_context_info &context_info, vogl_handle_remapper &remapper, GLuint64 handle, GLenum target)
{
    VOGL_FUNC_TRACER

    VOGL_NOTE_UNUSED(context_info);
    VOGL_NOTE_UNUSED(target);
    VOGL_NOTE_UNUSED(remapper);

    VOGL_CHECK_GL_ERROR;

    clear();

    m_snapshot_handle = handle;

    GLsync sync = vogl_handle_to_sync(handle);

    bool any_gl_errors = false;

#define GET_INT(pname)                                                    \
    do                                                                    \
    {                                                                     \
        GLint val = 0;                                                    \
        GLsizei len = 0;                                                  \
        GL_ENTRYPOINT(glGetSynciv)(sync, pname, sizeof(val), &len, &val); \
        if (vogl_check_gl_error())                                         \
            any_gl_errors = true;                                         \
        m_params.insert(pname, 0, &val, sizeof(val));                     \
    } while (0)

    GET_INT(GL_OBJECT_TYPE);
    GET_INT(GL_SYNC_STATUS);
    GET_INT(GL_SYNC_CONDITION);
    GET_INT(GL_SYNC_FLAGS);

#undef GET_INT

    if (any_gl_errors)
    {
        clear();

        vogl_error_printf("%s: GL error while enumerating sync %" PRIu64 "'s' params\n", VOGL_METHOD_NAME, (uint64_t)handle);
        return false;
    }

    VOGL_ASSERT(m_params.get_value<GLenum>(GL_OBJECT_TYPE) == GL_SYNC_FENCE);
    VOGL_ASSERT(m_params.get_value<GLenum>(GL_SYNC_CONDITION) == GL_SYNC_GPU_COMMANDS_COMPLETE);
    VOGL_ASSERT(m_params.get_value<uint>(GL_SYNC_FLAGS) == 0);

    m_is_valid = true;

    return true;
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:53,代码来源:vogl_sync_object.cpp


示例19: if

void MainWindow::readSettings()
{
	QVariant v;
	QSettings s;

	s.beginGroup("Units");
	if (s.value("unit_system").toString() == "metric") {
		prefs.unit_system = METRIC;
		prefs.units = SI_units;
	} else if (s.value("unit_system").toString() == "imperial") {
		prefs.unit_system = IMPERIAL;
		prefs.units = IMPERIAL_units;
	} else {
		prefs.unit_system = PERSONALIZE;
		GET_UNIT("length", length, units::FEET, units::METERS);
		GET_UNIT("pressure", pressure, units::PSI, units::BAR);
		GET_UNIT("volume", volume, units::CUFT, units::LITER);
		GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
		GET_UNIT("weight", weight, units::LBS, units::KG);
	}
	GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
	s.endGroup();
	s.beginGroup("TecDetails");
	GET_BOOL("po2graph", pp_graphs.po2);
	GET_BOOL("pn2graph", pp_graphs.pn2);
	GET_BOOL("phegraph", pp_graphs.phe);
	GET_DOUBLE("po2threshold", pp_graphs.po2_threshold);
	GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold);
	GET_DOUBLE("phethreshold", pp_graphs.phe_threshold);
	GET_BOOL("mod", mod);
	GET_DOUBLE("modppO2", mod_ppO2);
	GET_BOOL("ead", ead);
	GET_BOOL("redceiling", profile_red_ceiling);
	GET_BOOL("dcceiling", profile_dc_ceiling);
	GET_BOOL("calcceiling", profile_calc_ceiling);
	GET_BOOL("calcceiling3m", calc_ceiling_3m_incr);
	GET_BOOL("calcalltissues", calc_all_tissues);
	GET_INT("gflow", gflow);
	GET_INT("gfhigh", gfhigh);
	set_gf(prefs.gflow, prefs.gfhigh);
	GET_BOOL("show_time", show_time);
	GET_BOOL("show_sac", show_sac);
	s.endGroup();

	s.beginGroup("Display");
	v = s.value(QString("divelist_font"));
	if (v.isValid())
		prefs.divelist_font = strdup(v.toString().toUtf8().data());
}
开发者ID:levisjani,项目名称:subsurface,代码行数:49,代码来源:mainwindow.cpp


示例20: affect_total

/* This updates a character by subtracting everything he is affected by
 * restoring original abilities, and then affecting all again. */
void affect_total(struct char_data *ch)
{
  struct affected_type *af;
  int i, j;

  for (i = 0; i < NUM_WEARS; i++) {
    if (GET_EQ(ch, i))
      for (j = 0; j < MAX_OBJ_AFFECT; j++)
	affect_modify_ar(ch, GET_EQ(ch, i)->affected[j].location,
		      GET_EQ(ch, i)->affected[j].modifier,
		      GET_OBJ_AFFECT(GET_EQ(ch, i)), FALSE);
  }

  for (af = ch->affected; af; af = af->next)
    affect_modify_ar(ch, af->location, af->modifier, af->bitvector, FALSE);

  ch->aff_abils = ch->real_abils;

  for (i = 0; i < NUM_WEARS; i++) {
    if (GET_EQ(ch, i))
      for (j = 0; j < MAX_OBJ_AFFECT; j++)
	affect_modify_ar(ch, GET_EQ(ch, i)->affected[j].location,
		      GET_EQ(ch, i)->affected[j].modifier,
		      GET_OBJ_AFFECT(GET_EQ(ch, i)), TRUE);
  }

  for (af = ch->affected; af; af = af->next)
    affect_modify_ar(ch, af->location, af->modifier, af->bitvector, TRUE);

  /* Make certain values are between 0..25, not < 0 and not > 25! */
  i = (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_GRGOD) ? 25 : 18;

  GET_DEX(ch) = MAX(0, MIN(GET_DEX(ch), i));
  GET_INT(ch) = MAX(0, MIN(GET_INT(ch), i));
  GET_WIS(ch) = MAX(0, MIN(GET_WIS(ch), i));
  GET_CON(ch) = MAX(0, MIN(GET_CON(ch), i));
  GET_CHA(ch) = MAX(0, MIN(GET_CHA(ch), i));
  GET_STR(ch) = MAX(0, GET_STR(ch));

  if (IS_NPC(ch)) {
    GET_STR(ch) = MIN(GET_STR(ch), i);
  } else {
    if (GET_STR(ch) > 18) {
      i = GET_ADD(ch) + ((GET_STR(ch) - 18) * 10);
      GET_ADD(ch) = MIN(i, 100);
      GET_STR(ch) = 18;
    }
  }
}
开发者ID:Lundessa,项目名称:raven3,代码行数:51,代码来源:handler.c



注:本文中的GET_INT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_INT_FROM_POINTER函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_INDEX函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap