void Node2D::set_global_scale(const Size2 &p_scale) { CanvasItem *pi = get_parent_item(); if (pi) { const Size2 parent_global_scale = pi->get_global_transform().get_scale(); set_scale(p_scale / parent_global_scale); } else { set_scale(p_scale); } }
void GrowArc::flip( double x0, double y0, glow_eFlipDirection dir) { switch ( dir) { case glow_eFlipDirection_Horizontal: trf.store(); set_scale( 1, -1, x0, y0, glow_eScaleType_FixPoint); break; case glow_eFlipDirection_Vertical: trf.store(); set_scale( -1, 1, x0, y0, glow_eScaleType_FixPoint); break; } }
void Object3D::set_rotation(const glm::mat3 &theRot) { glm::vec3 pos_tmp(position()), scale_tmp(scale()); m_transform = glm::mat4(theRot); set_position(pos_tmp); set_scale(scale_tmp); }
void Seal::construct() { imaged = nullptr; piece_size(200.0f); z = 0.0f; set_scale(1.0f); radian = 0.0f; material().Diffuse.a = 1.0f; material().Diffuse.r = 1.0f; material().Diffuse.g = 1.0f; material().Diffuse.b = 1.0f; material().Ambient.a = 1.0f; material().Ambient.r = 1.0f; material().Ambient.g = 1.0f; material().Ambient.b = 1.0f; material().Specular.a = 0.0f; material().Specular.r = 0.0f; material().Specular.g = 0.0f; material().Specular.b = 0.0f; material().Emissive.a = 0.0f; material().Emissive.r = 0.0f; material().Emissive.g = 0.0f; material().Emissive.b = 0.0f; material().Power = 1.0f; computed_world_mat = false; }
//! set parameter void sci_psk_dem::set(int param, var* p_v) { int iv; double v; var_vec *p_var_vec; var_ivec *p_var_ivec; p_var_vec = NULL; p_var_ivec = NULL; // p_v might be either var_vec, var_ivec or var_bvec p_var_vec = dynamic_cast<var_vec *> (p_v); if (p_var_vec == NULL) { p_var_ivec = dynamic_cast<var_ivec *> (p_v); if (p_var_ivec == NULL) { throw sci_exception ("sci_psk_dem::set - p_v - bad cast"); } } switch (param) { case SCI_SIZE: // size constellation if (p_var_vec) { iv = (int)p_var_vec->v[0]; } else if (p_var_ivec) { iv = p_var_ivec->v[0]; } else { throw sci_exception ("sci_psk_dem::set - SCI_SIZE - bad cast"); } set_size(iv); break; case SCI_SCALE: if (p_var_vec) { v = p_var_vec ->v[0]; } else { throw sci_exception ("sci_psk_dem::set - SCI_SCALE - bad cast"); } set_scale(v); break; case SCI_OUTPUT: if (p_var_vec) { iv = (int)p_var_vec->v[0]; } else if (p_var_ivec) { iv = p_var_ivec->v[0]; } else { throw sci_exception ("sci_psk_dem::set - SCI_OUTPUT - bad cast"); } set_output( iv ); break; default: throw sci_exception ("sci_psk_mod::set - unknown param"); } return; };
int VMDTracker::start(const SensorConfig *config) { set_scale(config->getscale()); set_offset(config->getoffset()); set_right_rot(config->getright_rot()); set_left_rot(config->getleft_rot()); return do_start(config); }
void Object3D::set_rotation(float pitch, float yaw, float roll) { glm::vec3 pos_tmp(position()), scale_tmp(scale()); m_transform = glm::mat4_cast(glm::quat(glm::vec3(pitch, yaw, roll))); set_position(pos_tmp); set_scale(scale_tmp); }
/* * Our main function we start of here... * we should make sure that we never return from here, or vectrex will * be surely bothered! */ int main(void) { unsigned char anim_state; /* our animation state counter */ signed char pacman_x; /* where is the pacman? */ signed char pacman_y; pacman_x = 0; pacman_y = 0; anim_state = 0; setup(); /* setup our program */ while (true) /* never to return... */ { start_one_vectrex_round(); /* start 'de round */ intensity(MAX_BRIGHTNESS); /* set some brightness */ set_scale(MOVE_SCALE); /* set scale factor */ print_str(-128,100, "JOYTICK 1 TO MOVE PACMAN!"); /* a message! */ move_to(pacman_x, pacman_y); /* position pacman */ set_scale(PACMAN_SCALE); /* set scale factor for the sprite */ draw_vector_list(pacman[anim_state]); /* draw the current pacman */ anim_state++; /* next time the next animation */ if (anim_state == MAX_ANIM) /* could do a % MAXANIM, but this is */ anim_state = 0; /* more optimized */ if (!read_ram(Vec_Music_Flag)) /* music finished? */ play_song(SCRAMBLE_MUSIC); /* if so ... restart */ if (joystick1_x>0) /* check the joystick and */ { /* update position */ pacman_x++; } else if (joystick1_x<0) { pacman_x--; } if (joystick1_y>0) { pacman_y++; } else if (joystick1_y<0) { pacman_y--; } if (pacman_x>=100) pacman_x = 100; /* make sure pacman is not */ if (pacman_x<=-100) pacman_x = -100; /* out of bounds */ if (pacman_y>=100) pacman_y = 100; if (pacman_y<=-100) pacman_y = -100; joy_digital(); /* call once per round, to insure */ } /* while (true) */ /* joystick information is up to date */ }
PXL_Text::PXL_Text(PXL_Font* f_font, std::string f_text, int f_pos_x, int f_pos_y, uint16 f_size) : scale_origin(this) { font = f_font; text = f_text; size = f_size; x = f_pos_x; y = f_pos_y; colour.r = colour.g = colour.b = 0; colour.a = 1; set_scale(1, 1); }
gboolean compiz_set(const char *key, const char *value) { if (key == NULL) { return FALSE; } if (g_strcmp0(value, VAL_WORKSPACE) == 0) { return set_scale(key, value); } return set_commands(key, value, FALSE); }
MirWaitHandle* mir_buffer_stream_set_scale(MirBufferStream* opaque_stream, float scale) try { auto buffer_stream = reinterpret_cast<mcl::ClientBufferStream*>(opaque_stream); if (!buffer_stream) return nullptr; return buffer_stream->set_scale(scale); } catch (std::exception const& ex) { MIR_LOG_UNCAUGHT_EXCEPTION(ex); return nullptr; }
int hid_switch_large_view(void) { if(options.view != VIEW_LARGE) { set_scale(options.view = VIEW_LARGE); hid_exit(); hid_init(); //gdk_window_unfullscreen(main_wnd->window); } return 0; }
int hid_switch_normal_view(void) { if(options.view != VIEW_NORMAL) { set_scale(options.view = VIEW_NORMAL); hid_exit(); hid_init(); //gdk_window_unfullscreen(main_wnd->window); } return 0; }
int hid_switch_fullscreen(void) { if(options.view != VIEW_FULL) { set_scale(options.view = VIEW_FULL); hid_exit(); hid_init(); gdk_window_fullscreen(main_wnd->window); } return 0; }
void YC20UI2::size_allocate(GtkAllocation *alloc) { //std::cerr << "size_allocate: " << alloc.get_x() << " x " << alloc.get_y() << " : " << alloc.get_width() << " x " << alloc.get_height() << std::endl; if (alloc->width > 1280) { alloc->width = 1280; } else if (alloc->width < 768) { alloc->width = 768; } float scale = (float)alloc->width/1280.0; set_scale(scale); alloc->height = 200.0 * scale; }
void YC20UI2::size_request(GtkRequisition *req) { //std::cerr << "size_request: " << req->width << " x " << req->height << std::endl; if (req->width > 1280) { req->width = 1280; } else if (req->width < 768) { req->width = 768; } float scale = (float)req->width/1280.0; set_scale(scale); req->height = 200.0 * scale; }
////////////////////////// constructor Axes::Axes(DisplayDevice *d, Displayable *par) : Displayable(par), disp(d) { colorCat = (-1); // indicate we don't yet have a color object to use need_create_cmdlist = TRUE; movedAxes = FALSE; // initialize coordinates for axes lines origin[0] = yLine[0] = zLine[0] = 0.0; xLineCap[1] = xLineCap[2] = 0.0; xLine[0] = AXESRODLEN; xLineCap[0] = 1.0; origin[1] = xLine[1] = zLine[1] = 0.0; yLineCap[0] = yLineCap[2] = 0.0; yLine[1] = AXESRODLEN; yLineCap[1] = 1.0; origin[2] = xLine[2] = yLine[2] = 0.0; zLineCap[0] = zLineCap[1] = 0.0; zLine[2] = AXESRODLEN; zLineCap[2] = 1.0; xText[0] = AXESTXTLEN * xLine[0]; xText[1] = xLine[1]; xText[2] = xLine[2]; yText[1] = AXESTXTLEN * yLine[1]; yText[0] = yLine[0]; yText[2] = yLine[2]; zText[2] = AXESTXTLEN * zLine[2]; zText[0] = zLine[0]; zText[1] = zLine[1]; // Displayable characteristics rot_on(); glob_trans_off(); cent_trans_off(); // set scaling factor to a small amount scale_on(); set_scale(0.25); scale_off(); // put axes in lower left corner by default axesPos = AXES_LOWERLEFT; Aspect = (-1.0); colorCat = scene->add_color_category("Axes"); // add components, and their default colors scene->add_color_item(colorCat, "X", AXESXCOL); scene->add_color_item(colorCat, "Y", AXESYCOL); scene->add_color_item(colorCat, "Z", AXESZCOL); scene->add_color_item(colorCat, "Origin", AXESOCOL); scene->add_color_item(colorCat, "Labels", AXESTCOL); do_color_changed(colorCat); }
void reset_view(t_3dview *view) { int i; #ifdef DEBUG printf("Reset view called\n"); #endif set_scale(view,4.0,4.0); clear_rvec(view->eye); calc_box_center(view->box,view->origin); view->eye[ZZ]=3.0*max(view->box[XX][XX],view->box[YY][YY]); zoom_3d(view,1.0); view->eye[WW]=view->origin[WW]=0.0; /* Initiate the matrix */ unity_m4(view->Rot); calculate_view(view); }
static void init(void) { vita2d_init(); vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF)); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG); fullscreen_scale_x = SCREEN_W / (float)GAMEBOY_WIDTH; fullscreen_scale_y = SCREEN_H / (float)GAMEBOY_HEIGHT; gb_texture = vita2d_create_empty_texture(GAMEBOY_WIDTH, GAMEBOY_HEIGHT); gb_texture_pixels = vita2d_texture_get_datap(gb_texture); set_scale(3); theGearboyCore = new GearboyCore(); theGearboyCore->Init(); }
void Node2D::scale(const Vector2& p_amount) { set_scale( get_scale() * p_amount ); }
int main(int argc, char **argv) { AVFormatContext *afc; AVStream *st; AVPacket pk; struct frame_format frame_fmt = { 0 }; const struct pixconv *pixconv = NULL; const struct memman *memman = NULL; const struct codec *codec = NULL; struct frame_format dp; int bufsize = BUFFER_SIZE; pthread_t dispt; unsigned flags = OFBP_DOUBLE_BUF; char *test_param = NULL; char *dispdrv = NULL; char *timer_drv = NULL; char *memman_drv = NULL; char *pixconv_drv = NULL; char *codec_drv = NULL; int opt; int ret = 0; #define error(n) do { ret = n; goto out; } while (0) while ((opt = getopt(argc, argv, "b:d:fFM:P:st:T:v:")) != -1) { switch (opt) { case 'b': bufsize = strtol(optarg, NULL, 0) * 1048576; break; case 'd': dispdrv = optarg; break; case 'F': noaspect = 1; case 'f': flags |= OFBP_FULLSCREEN; break; case 'M': memman_drv = optarg; break; case 'P': pixconv_drv = optarg; break; case 's': flags &= ~OFBP_DOUBLE_BUF; break; case 't': test_param = optarg; break; case 'T': timer_drv = optarg; break; case 'v': codec_drv = optarg; break; } } argc -= optind; argv += optind; if (test_param) return speed_test(dispdrv, memman_drv, pixconv_drv, test_param, flags); if (argc < 1) return 1; av_register_all(); avcodec_register_all(); afc = open_file(argv[0]); st = find_stream(afc); if (!st) { fprintf(stderr, "No video streams found.\n"); exit(1); } codec = find_driver(codec_drv, NULL, ofbp_codec_start); if (!codec) { fprintf(stderr, "Decoder '%s' not found\n", codec_drv); error(1); } if (codec->open(NULL, st->codec, &frame_fmt)) { fprintf(stderr, "Error opening decoder\n"); error(1); } if (!frame_fmt.width) { fprintf(stderr, "Decoder error: frame size not specified\n"); error(1); } dp.pixfmt = frame_fmt.pixfmt; display = display_open(dispdrv, &dp, &frame_fmt); if (!display) error(1); set_scale(&dp, &frame_fmt, flags); if (display->memman) { if (dp.pixfmt == frame_fmt.pixfmt) { memman = display->memman; } else if (display->flags & OFBP_PRIV_MEM) { fprintf(stderr, "Decoder/display pixel format mismatch\n"); error(1); } } if (!memman) memman = find_driver(memman_drv, NULL, ofbp_memman_start); if (!memman) error(1); if ((codec->flags & OFBP_PHYS_MEM) && !(memman->flags & OFBP_PHYS_MEM)) { fprintf(stderr, "Incompatible decoder/memman\n"); error(1); } if (memman->alloc_frames(&frame_fmt, bufsize, &frames, &num_frames)) error(1); if (memman != display->memman) { pixconv = pixconv_open(pixconv_drv, &frame_fmt, &dp); if (!pixconv) error(1); if ((pixconv->flags & OFBP_PHYS_MEM) && !(memman->flags & display->flags & OFBP_PHYS_MEM)) { fprintf(stderr, "Incompatible display/memman/pixconv\n"); error(1); } } timer = timer_open(timer_drv); if (!timer) error(1); init_frames(&frame_fmt); if (display->enable(&frame_fmt, flags, pixconv, &dp)) error(1); pthread_mutex_init(&disp_lock, NULL); sem_init(&disp_sem, 0, 0); signal(SIGINT, sigint); pthread_create(&dispt, NULL, disp_thread, st); while (!stop && !av_read_frame(afc, &pk)) { if (pk.stream_index == st->index) if (codec->decode(&pk)) stop = 1; av_free_packet(&pk); } if (!stop) { sem_post(&disp_sem); while (disp_tail != -1) usleep(100000); } stop = 1; sem_post(&disp_sem); pthread_join(dispt, NULL); out: if (afc) av_close_input_file(afc); if (codec) codec->close(); if (timer) timer->close(); if (memman) memman->free_frames(frames, num_frames); if (display) display->close(); if (pixconv) pixconv->close(); return ret; }
static int speed_test(const char *drv, const char *mem, const char *conv, char *size, unsigned disp_flags) { const struct pixconv *pixconv = NULL; const struct memman *memman = NULL; struct frame_format dp = { 0 }; struct frame_format ff = { 0 }; struct timespec t1, t2; unsigned w, h = 0; unsigned n = 1000; unsigned bufsize; char *ss = size; int i, j; w = strtoul(size, &size, 0); if (*size++) h = strtoul(size, &size, 0); if (*size++) n = strtoul(size, NULL, 0); if (!w || !h || !n) { fprintf(stderr, "Invalid size/count '%s'\n", ss); return 1; } ff.width = ALIGN(w, 32); ff.height = ALIGN(h, 32); ff.disp_x = 0; ff.disp_y = 0; ff.disp_w = w; ff.disp_h = h; dp.pixfmt = ff.pixfmt = PIX_FMT_YUV420P; display = display_open(drv, &dp, &ff); if (!display) return 1; set_scale(&dp, &ff, disp_flags); if (display->memman) { memman = display->memman; ff.pixfmt = dp.pixfmt; } if (!memman) memman = find_driver(mem, NULL, ofbp_memman_start); if (memman->alloc_frames(&ff, 0, &frames, &num_frames)) return 1; if (memman != display->memman) { pixconv = pixconv_open(conv, &ff, &dp); if (!pixconv) return 1; if ((pixconv->flags & OFBP_PHYS_MEM) && !(memman->flags & display->flags & OFBP_PHYS_MEM)) { fprintf(stderr, "Incompatible display/memman/pixconv\n"); return 1; } } init_frames(&ff); if (display->enable(&ff, disp_flags, pixconv, &dp)) return 1; bufsize = ff.disp_w * ff.disp_h * 3 / 2; test_pattern(frames, num_frames, &ff); signal(SIGINT, sigint); clock_gettime(CLOCK_REALTIME, &t1); for (i = 0; i < n && !stop; i++) { struct frame *f = ofbp_get_frame(); display->prepare(f); display->show(f); } clock_gettime(CLOCK_REALTIME, &t2); j = ts_diff_ms(&t2, &t1); fprintf(stderr, "%d ms, %d fps, read %lld B/s, write %lld B/s\n", j, i*1000 / j, 1000LL*i*bufsize / j, 2000LL*i*w*h / j); memman->free_frames(frames, num_frames); display->close(); if (pixconv) pixconv->close(); return 0; }
END_PERIODIC_TASK int sc_main (int, char *[]) { sc_time sim_time; // Definition of a task set (set to be assigned to a processor) // with the kista::taskset_by_name_t and task_info_t classes taskset_by_name_t task_set1; task_info_t task_info_t1("task1",task1); task_info_t task_info_t2("task2",task2); task_info_t1.set_WCET(WCET_T1); task_info_t2.set_WCET(WCET_T2); task_info_t1.set_Period(PERIOD_T1); task_info_t2.set_Period(PERIOD_T2); // // NOW WE ESTABLISH PRIORITIES (In KisTA: the lowest the value, the highest the priority, 0 reserved) // (The user assignation of this example is the opposite to Rate Monotonic scheduling) // You later can see how the set_rate_monotonic method makes an automatic assignation, // which overrides the user assignation once it is invoked afterwards, within the task set // #ifdef _SET_USER_PRIORITIES task_info_t1.set_priority(5); task_info_t2.set_priority(3); #endif #ifdef _SET_USER_DEADLINES task_info_t1.set_Deadline(DEADLINE_T1); task_info_t2.set_Deadline(DEADLINE_T2); #endif task_set1["task1"] = &task_info_t1; task_set1["task2"] = &task_info_t2; // gs->tasks_assigned["task1"] = task_info_t("task1",task1, gs); // gs->tasks_assigned["task2"] = task_info_t("task2",task2, gs); // Declaration of an scheduler and assignation of the task set // with the kista::scheduler class scheduler scheduler1(&task_set1, "scheduler1"); // Equivalently, the scheduler can be declared... // scheduler *scheduler1; // ... and assigned the task set afterwards, at construnction time // scheduler1 = new scheduler(&task_set1, "scheduler1"); // by default, non-preemptive, one processor // configuring the scheduler scheduler1.set_preemptive(); // enabling time slicing (we keep it disabled) // scheduler1.enable_time_slicing(); #ifdef _SET_STATIC_PRIORITIES scheduler1.set_policy(STATIC_PRIORITIES); #endif #ifdef _SET_RATE_MONOTONIC scheduler1.set_rate_monotonic(); // it already includes the set_dispatch_policy(STATIC_PRIORITIES) #endif #ifdef _SET_DEADLINE_MONOTONIC scheduler1.set_deadline_monotonic(); // it already includes the set_dispatch_policy(STATIC_PRIORITIES) #endif // Tracing of the tasks and scheduler ocupation signals // with the kista::trace method of the kista::scheduler class scheduler1.trace_utilizations(); tikz_activity_trace_handler gen_tikz_report_handler; // create_tikz_activity_trace(); //gen_tikz_report_handler = create_tikz_activity_trace(); gen_tikz_report_handler = create_tikz_activity_trace("2tasks_tikz_trace"); set_scale(gen_tikz_report_handler,1.25); set_landscape(gen_tikz_report_handler); no_text_in_traces(gen_tikz_report_handler); do_not_show_unactive_boxes(gen_tikz_report_handler); set_time_stamps_max_separation(gen_tikz_report_handler,3); only_image(gen_tikz_report_handler); // cluster(gen_tikz_report_handler); // compact(gen_tikz_report_handler); sketch_report.set_file_name("ex3_sketch"); // This will set the file name of the sketch report to "ex3_sketch.tex" // otherwise, the default name "system_sketch.tex" will be applied sketch_report.enable(); // sketch_report.set_file_name("ex3_sketch"); // Here, it would be overriden, and the the default name used sim_time = get_hyperperiod(task_set1); cout << "Hyperperiod of task set : " << sim_time << endl; cout << "Global simulation time limit : " << get_global_simulation_time_limit() << endl; // to enable scheduling times enable_scheduling_times(); set_scheduling_time(sc_time(1,SC_NS)); set_default_scheduling_time_calculators(); sc_start(sim_time); cout << "End of simulation at " << sc_time_stamp() << endl; sc_stop(); taskset_by_name_t::iterator ts_it; cout << "-------------------------" << endl; cout << "POST-SIM. REPORTS" << endl; cout << "-------------------------" << endl; cout << "*********************************************" << endl; cout << " Utilization and Starvation Report " << endl; cout << "*********************************************" << endl; cout << "Hyperperiod of task set task_set1: " << get_hyperperiod(task_set1) << endl; for(ts_it = task_set1.begin(); ts_it != task_set1.end(); ts_it++) { cout << ts_it->first << " task utilization : (static) " << (float)(ts_it->second->utilization()*100.0) << "% (simulation): " << (float)(scheduler1.get_task_utilization(ts_it->first)*100.0) << "%" << endl; } cout << "Task Set utilization : (static) " << (float)(utilization(task_set1)*100.0) << "% (simulation) " << (float)(scheduler1.get_tasks_utilization()*100.0) << "%" << endl; for(ts_it = task_set1.begin(); ts_it != task_set1.end(); ts_it++) { cout << ts_it->first << " task density : (static) " << (float)(ts_it->second->density()*100.0) << "%" << endl; } cout << "Task Set density : (static) " << (float)(density(task_set1)*100.0) << "% " << endl; cout << scheduler1.name() << " (sim) number of schedulings: " << (unsigned int)scheduler1.get_number_of_schedulings() << endl; cout << scheduler1.name() << " (sim) scheduler utilization : " << (float)(scheduler1.get_scheduler_utilization()*100.0) << "%" << endl; cout << scheduler1.name() << " (sim) platform utilization : " << (float)(scheduler1.get_platform_utilization()*100.0) << "%" << endl; cout << "last simulation time: " << sc_time_stamp() << endl; if(scheduler1.assess_starvation()!=true) { cout << scheduler1.name() << " scheduler: No starvation detected. All tasks had chance to execute." << endl; } scheduler1.report_miss_deadlines(); scheduler1.report_response_times(); return 0; }
int amvideo_utils_set_virtual_position(int32_t x, int32_t y, int32_t w, int32_t h, int rotation) { LOG_FUNCTION_NAME //for osd rotation, need convert the axis first int osd_rotation = amdisplay_utils_get_osd_rotation(); if(osd_rotation > 0) amvideo_convert_axis(&x,&y,&w,&h,&rotation,osd_rotation); int video_fd; int dev_fd = -1, dev_w, dev_h, disp_w, disp_h, video_global_offset; int dst_x, dst_y, dst_w, dst_h; char buf[SYSCMD_BUFSIZE]; int angle_fd = -1; int ret = -1; int axis[4]; char enable_p2p_play[8] = {0}; int video_on_vpp2 = is_video_on_vpp2(); int vertical_panel = is_vertical_panel(); int vertical_panel_reverse = is_vertical_panel_reverse(); if (video_on_vpp2) { int fb0_w, fb0_h, fb2_w, fb2_h; amdisplay_utils_get_size(&fb0_w, &fb0_h); amdisplay_utils_get_size_fb2(&fb2_w, &fb2_h); if (fb0_w > 0 && fb0_h > 0 && fb2_w > 0 && fb2_h > 0) { if (vertical_panel) { int x1, y1, w1, h1; if (vertical_panel_reverse) { x1 = (1.0 * fb2_w / fb0_h) * y; y1 = (1.0 * fb2_h / fb0_w) * x; w1 = (1.0 * fb2_w / fb0_h) * h; h1 = (1.0 * fb2_h / fb0_w) * w; } else { x1 = (1.0 * fb2_w / fb0_h) * y; y1 = (1.0 * fb2_h / fb0_w) * (fb0_w - x - w); w1 = (1.0 * fb2_w / fb0_h) * h; h1 = (1.0 * fb2_h / fb0_w) * w; } x = x1; y = y1; w = w1; h = h1; } else { int x1, y1, w1, h1; x1 = (1.0 * fb2_w / fb0_w) * x; y1 = (1.0 * fb2_h / fb0_h) * y; w1 = (1.0 * fb2_w / fb0_w) * w; h1 = (1.0 * fb2_h / fb0_h) * h; x = x1; y = y1; w = w1; h = h1; } } } LOGI("amvideo_utils_set_virtual_position:: x=%d y=%d w=%d h=%d\n", x, y, w, h); bzero(buf, SYSCMD_BUFSIZE); dst_x = x; dst_y = y; dst_w = w; dst_h = h; video_fd = open(VIDEO_PATH, O_RDWR); if (video_fd < 0) { goto OUT; } dev_fd = open(DISP_DEVICE_PATH, O_RDONLY); if (dev_fd < 0) { goto OUT; } read(dev_fd, buf, SYSCMD_BUFSIZE); if (sscanf(buf, "%dx%d", &dev_w, &dev_h) == 2) { LOGI("device resolution %dx%d\n", dev_w, dev_h); } else { ret = -2; goto OUT; } if (video_on_vpp2) amdisplay_utils_get_size_fb2(&disp_w, &disp_h); else amdisplay_utils_get_size(&disp_w, &disp_h); LOGI("amvideo_utils_set_virtual_position:: disp_w=%d, disp_h=%d\n", disp_w, disp_h); video_global_offset = amvideo_utils_get_global_offset(); int free_scale_enable = 0; int ppscaler_enable = 0; int freescale_mode_enable = 0; if (((disp_w != dev_w) || (disp_h / 2 != dev_h)) && (video_global_offset == 0)) { char val[256]; memset(val, 0, sizeof(val)); if (video_on_vpp2) { if (amsysfs_get_sysfs_str(FREE_SCALE_PATH_FB2, val, sizeof(val)) == 0) { /* the returned string should be "free_scale_enable:[0x%x]" */ free_scale_enable = (val[21] == '0') ? 0 : 1; } } else { if (amsysfs_get_sysfs_str(FREE_SCALE_PATH, val, sizeof(val)) == 0) { /* the returned string should be "free_scale_enable:[0x%x]" */ free_scale_enable = (val[21] == '0') ? 0 : 1; } } memset(val, 0, sizeof(val)); if (amsysfs_get_sysfs_str(PPSCALER_PATH, val, sizeof(val)) == 0) { /* the returned string should be "current ppscaler mode is disabled/enable" */ ppscaler_enable = (val[25] == 'd') ? 0 : 1; } memset(val, 0, sizeof(val)); if (amsysfs_get_sysfs_str(FREE_SCALE_MODE_PATH, val, sizeof(val)) == 0) { /* the returned string should be "free_scale_mode:new/default" */ freescale_mode_enable = (val[16] == 'd') ? 0 : 1; } } angle_fd = open(ANGLE_PATH, O_WRONLY); if (angle_fd >= 0) { if (video_on_vpp2 && vertical_panel) ioctl(angle_fd, PPMGR_IOC_SET_ANGLE, 0); else ioctl(angle_fd, PPMGR_IOC_SET_ANGLE, (rotation/90) & 3); LOGI("set ppmgr angle %d\n", (rotation/90) & 3); } /* this is unlikely and only be used when ppmgr does not exist * to support video rotation. If that happens, we convert the window * position to non-rotated window position. * On ICS, this might not work at all because the transparent UI * window is still drawn is it's direction, just comment out this for now. */ #if 0 if (((rotation == 90) || (rotation == 270)) && (angle_fd < 0)) { if (dst_h == disp_h) { int center = x + w / 2; if (abs(center - disp_w / 2) < 2) { /* a centered overlay with rotation, change to full screen */ dst_x = 0; dst_y = 0; dst_w = dev_w; dst_h = dev_h; LOGI("centered overlay expansion"); } } } #endif /*if (free_scale_enable == 0 && ppscaler_enable == 0) { OSD_DISP_MODE display_mode = OSD_DISP_1080P; int x_d=0,y_d=0,w_d=0,h_d=0; LOGI("set screen position:x[%d],y[%d],w[%d],h[%d]", dst_x, dst_y, dst_w, dst_h); display_mode = get_osd_display_mode(); get_device_win(display_mode, &x_d, &y_d, &w_d, &h_d); if(display_mode==OSD_DISP_720P) { if((dst_w >= 1279)||(dst_w==0)) { dst_x = x_d; dst_y = y_d; dst_w = w_d; dst_h = h_d; } else { dst_x = dst_x*w_d/1280+x_d; dst_y = dst_y*h_d/720+y_d; dst_w = dst_w*w_d/1280; dst_h = dst_h*h_d/720; } } else if((display_mode==OSD_DISP_1080I)||(display_mode==OSD_DISP_1080P)||(display_mode==OSD_DISP_LVDS1080P)) { if((dst_w >= 1919)||(dst_w == 0)) { dst_x = x_d; dst_y = y_d; dst_w = w_d; dst_h = h_d; } else {//scaled to 1080p dst_x = dst_x*w_d/1920+x_d; dst_y = dst_y*h_d/1080+y_d; dst_w = dst_w*w_d/1920; dst_h = dst_h*h_d/1080; LOGI("after scaled to 1080 ,set screen position:x[%d],y[%d],w[%d],h[%d]", dst_x, dst_y, dst_w, dst_h); } } else if((display_mode==OSD_DISP_480I)||(display_mode==OSD_DISP_480P)) { if((dst_w >= 719)||(dst_w == 0)) { dst_x = x_d; dst_y = y_d; dst_w = w_d; dst_h = h_d; } else {//scaled to 480p/480i dst_x = dst_x*w_d/720+x_d; dst_y = dst_y*h_d/480+y_d; dst_w = dst_w*w_d/720; dst_h = dst_h*h_d/480; LOGI("after scaled to 480,set screen position:x[%d],y[%d],w[%d],h[%d]", dst_x, dst_y, dst_w, dst_h); } } else if((display_mode==OSD_DISP_576I)||(display_mode==OSD_DISP_576P)) { if((dst_w >= 719)||(dst_w == 0)) { dst_x = x_d; dst_y = y_d; dst_w = w_d; dst_h = h_d; } else {//scaled to 576p/576i dst_x = dst_x*w_d/720+x_d; dst_y = dst_y*h_d/576+y_d; dst_w = dst_w*w_d/720; dst_h = dst_h*h_d/576; LOGI("after scaled to 576 ,set screen position:x[%d],y[%d],w[%d],h[%d]", dst_x, dst_y, dst_w, dst_h); } } }*/ if (free_scale_enable == 0 && ppscaler_enable == 0) { char val[256]; if (freescale_mode_enable == 1) { int left = 0, top = 0, right = 0, bottom = 0; int x = 0, y = 0, w = 0, h = 0; memset(val, 0, sizeof(val)); if (amsysfs_get_sysfs_str(WINDOW_AXIS_PATH, val, sizeof(val)) == 0) { /* the returned string should be "window axis is [a b c d]" */ if (sscanf(val + 15, "[%d %d %d %d]", &left, &top, &right, &bottom) == 4) { x = left; y = top; w = right - left + 1; h = bottom - top + 1; if ((dst_w >= dev_w - 1) || (dst_w == 0)) { dst_x = 0; dst_w = w; } if ((dst_h >= dev_h - 1) || (dst_h == 0)) { dst_y = 0; dst_h = h; } dst_x = dst_x * w / dev_w + x; dst_y = dst_y * h / dev_h + y; LOGI("after scaled, screen position: %d %d %d %d", dst_x, dst_y, dst_w, dst_h); } } } else { int x = 0, y = 0, w = 0, h = 0; int fb_w = 0, fb_h = 0; int req_2xscale = 0; memset(val, 0, sizeof(val)); if (amsysfs_get_sysfs_str(REQUEST_2XSCALE_PATH, val, sizeof(val)) == 0) { /* the returned string should be "a b c" */ if (sscanf(val, "%d", &req_2xscale) == 1) { if (req_2xscale == 7 || req_2xscale == 16) { if (sscanf(val, "%d %d %d", &req_2xscale, &w, &h) == 3) { if (req_2xscale == 7) w *= 2; get_axis(DISPLAY_AXIS_PATH, &x, &y, &fb_w, &fb_h); if (fb_w == 0 || fb_h == 0) { fb_w = 1280; fb_h = 720; } set_scale(x, y, w, h, &dst_x, &dst_y, &dst_w, &dst_h, fb_w, fb_h); LOGI("after scaled, screen position: %d %d %d %d", dst_x, dst_y, dst_w, dst_h); } } } } } } else if (free_scale_enable == 1 && ppscaler_enable == 0) { char val[256]; int left = 0, top = 0, right = 0, bottom = 0; int x = 0, y = 0, w = 0, h = 0; int freescale_x = 0, freescale_y = 0, freescale_w = 0, freescale_h = 0; if (amsysfs_get_sysfs_str(WINDOW_AXIS_PATH, val, sizeof(val)) == 0) { /* the returned string should be "window axis is [a b c d]" */ if (sscanf(val + 15, "[%d %d %d %d]", &left, &top, &right, &bottom) == 4) { x = left; y = top; w = right - left + 1; h = bottom - top + 1; get_axis(FREE_SCALE_AXIS_PATH, &freescale_x, &freescale_y, &freescale_w, &freescale_h); freescale_w = (freescale_w + 1) & (~1); freescale_h = (freescale_h + 1) & (~1); set_scale(x, y, w, h, &dst_x, &dst_y, &dst_w, &dst_h, freescale_w, freescale_h); LOGI("after scaled, screen position: %d %d %d %d", dst_x, dst_y, dst_w, dst_h); } } } axis[0] = dst_x; axis[1] = dst_y; axis[2] = dst_x + dst_w - 1; axis[3] = dst_y + dst_h - 1; ioctl(video_fd, AMSTREAM_IOC_SET_VIDEO_AXIS, &axis[0]); ret = 0; OUT: if (video_fd >= 0) { close(video_fd); } if (dev_fd >= 0) { close(dev_fd); } if (angle_fd >= 0) { close(angle_fd); } LOGI("amvideo_utils_set_virtual_position (corrected):: x=%d y=%d w=%d h=%d\n", dst_x, dst_y, dst_w, dst_h); return ret; }
void Node2D::_edit_set_scale(const Size2 &p_scale) { set_scale(p_scale); }
void Node2D::apply_scale(const Size2 &p_amount) { set_scale(get_scale() * p_amount); }
/* * Inlined static... insures this is 'really' inlined completely... * * Process one dot... * */ static inline void do_shot(struct shot *current_shot) { zero_beam(); /* reset beam to middle of screen */ if (current_shot->shot_counter > 0) /* is this shot active? */ { current_shot->shot_counter--; /* no?, than reduce counter... */ if (current_shot->shot_counter == 0) /* if 0... make active and set up */ { init_shot(current_shot); } return; /* next time shot will be active, */ } /* for now... return */ else { switch (current_shot->direction) /* process direction flag */ { case TO_HALF_THREE: { /* is dot out of bounds? */ if ((current_shot->x > 120) || (current_shot->y > 120) ) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } current_shot->x += current_shot->speed; current_shot->y += current_shot->speed; break; } case TO_THREE: { /* is dot out of bounds? */ if (current_shot->x > 120) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->x += current_shot->speed; break; } case TO_HALF_SIX: { /* is dot out of bounds? */ if ((current_shot->x > 120) || (current_shot->y < -120) ) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->x += current_shot->speed; current_shot->y -= current_shot->speed; break; } case TO_SIX: { /* is dot out of bounds? */ if (current_shot->y < -120) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->y -= current_shot->speed; break; } case TO_HALF_NINE: { /* is dot out of bounds? */ if ((current_shot->x < -120) || (current_shot->y < -120) ) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->x -= current_shot->speed; current_shot->y -= current_shot->speed; break; } case TO_NINE: { /* is dot out of bounds? */ if (current_shot->x < -120) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->x -= current_shot->speed; break; } case TO_HALF_TWELF: { /* is dot out of bounds? */ if ((current_shot->x < -120) || (current_shot->y > 120) ) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->x -= current_shot->speed; current_shot->y += current_shot->speed; break; } case TO_TWELF: { /* is dot out of bounds? */ if (current_shot->y > 120) { /* yep, than make inactive and reset 'timer' */ current_shot->shot_counter = SHOT_INTERVALL; /* and bye */ return; } /* otherwise process coordinated according to direction and speed */ current_shot->y += current_shot->speed; break; } default: { /* oops... something wrong... make this false dot inactive ... */ current_shot->shot_counter = SHOT_INTERVALL; return; } } } /* now draw the dot */ write_ram(Vec_Dot_Dwell, DOT_BRIGHTNESS); /* first set up the dot dwell time */ set_scale(SHOT_SCALE); /* set scale for positioning */ draw_dot(current_shot->x, current_shot->y); /* position and draw the dot */ }
int shveu_setup( SHVEU *veu, const struct ren_vid_surface *src_surface, const struct ren_vid_surface *dst_surface, shveu_rotation_t filter_control) { float scale_x, scale_y; uint32_t temp; uint32_t Y, C; const struct veu_format_info *src_info; const struct veu_format_info *dst_info; struct ren_vid_surface local_src; struct ren_vid_surface local_dst; struct ren_vid_surface *src = &local_src; struct ren_vid_surface *dst = &local_dst; void *base_addr; if (!veu || !src_surface || !dst_surface) { debug_info("ERR: Invalid input - need src and dest"); return -1; } src_info = fmt_info(src_surface->format); dst_info = fmt_info(dst_surface->format); dbg(__func__, __LINE__, "src_user", src_surface); dbg(__func__, __LINE__, "dst_user", dst_surface); /* scale factors */ scale_x = (float)dst_surface->w / src_surface->w; scale_y = (float)dst_surface->h / src_surface->h; if (!format_supported(src_surface->format) || !format_supported(dst_surface->format)) { debug_info("ERR: Invalid surface format!"); return -1; } /* Scaling limits */ if (veu_is_veu2h(veu)) { if ((scale_x > 8.0) || (scale_y > 8.0)) { debug_info("ERR: Outside scaling limits!"); return -1; } } else { if ((scale_x > 16.0) || (scale_y > 16.0)) { debug_info("ERR: Outside scaling limits!"); return -1; } } if ((scale_x < 1.0/16.0) || (scale_y < 1.0/16.0)) { debug_info("ERR: Outside scaling limits!"); return -1; } /* source - use a buffer the hardware can access */ if (get_hw_surface(veu->uiomux, veu->uiores, src, src_surface) < 0) { debug_info("ERR: src is not accessible by hardware"); return -1; } copy_surface(src, src_surface); /* destination - use a buffer the hardware can access */ if (get_hw_surface(veu->uiomux, veu->uiores, dst, dst_surface) < 0) { debug_info("ERR: dest is not accessible by hardware"); return -1; } uiomux_lock (veu->uiomux, veu->uiores); base_addr = veu->uio_mmio.iomem; /* Keep track of the requested surfaces */ veu->src_user = *src_surface; veu->dst_user = *dst_surface; /* Keep track of the actual surfaces used */ veu->src_hw = local_src; veu->dst_hw = local_dst; /* Software reset */ if (read_reg(base_addr, VESTR) & 0x1) write_reg(base_addr, 0, VESTR); while (read_reg(base_addr, VESTR) & 1) ; /* Clear VEU end interrupt flag */ write_reg(base_addr, 0, VEVTR); /* VEU Module reset */ write_reg(base_addr, 0x100, VBSRR); /* default to not using bundle mode */ write_reg(base_addr, 0, VBSSR); /* source */ Y = uiomux_all_virt_to_phys(src->py); C = uiomux_all_virt_to_phys(src->pc); write_reg(base_addr, Y, VSAYR); write_reg(base_addr, C, VSACR); write_reg(base_addr, (src->h << 16) | src->w, VESSR); write_reg(base_addr, size_y(src->format, src->pitch), VESWR); /* destination */ Y = uiomux_all_virt_to_phys(dst->py); C = uiomux_all_virt_to_phys(dst->pc); if (filter_control & 0xFF) { if ((filter_control & 0xFF) == 0x10) { /* Horizontal Mirror (A) */ Y += size_y(dst->format, src->w); C += size_y(dst->format, src->w); } else if ((filter_control & 0xFF) == 0x20) { /* Vertical Mirror (B) */ Y += size_y(dst->format, (src->h-1) * dst->pitch); C += size_c(dst->format, (src->h-2) * dst->pitch); } else if ((filter_control & 0xFF) == 0x30) { /* Rotate 180 (C) */ Y += size_y(dst->format, src->w); C += size_y(dst->format, src->w); Y += size_y(dst->format, src->h * dst->pitch); C += size_c(dst->format, src->h * dst->pitch); } else if ((filter_control & 0xFF) == 1) { /* Rotate 90 (D) */ Y += size_y(dst->format, src->h-16); C += size_y(dst->format, src->h-16); } else if ((filter_control & 0xFF) == 2) { /* Rotate 270 (E) */ Y += size_y(dst->format, (src->w-16) * dst->pitch); C += size_c(dst->format, (src->w-16) * dst->pitch); } else if ((filter_control & 0xFF) == 0x11) { /* Rotate 90 & Mirror Horizontal (F) */ /* Nothing to do */ } else if ((filter_control & 0xFF) == 0x21) { /* Rotate 90 & Mirror Vertical (G) */ Y += size_y(dst->format, src->h-16); C += size_y(dst->format, src->h-16); Y += size_y(dst->format, (src->w-16) * dst->pitch); C += size_c(dst->format, (src->w-16) * dst->pitch); } } write_reg(base_addr, Y, VDAYR); write_reg(base_addr, C, VDACR); write_reg(base_addr, size_y(dst->format, dst->pitch), VEDWR); /* byte/word swapping */ temp = 0; #ifdef __LITTLE_ENDIAN__ temp |= src_info->vswpr; temp |= dst_info->vswpr << 4; #endif write_reg(base_addr, temp, VSWPR); /* transform control */ temp = src_info->vtrcr_src; temp |= dst_info->vtrcr_dst; if (is_rgb(src_surface->format)) temp |= VTRCR_RY_SRC_RGB; if (different_colorspace(src_surface->format, dst_surface->format)) temp |= VTRCR_TE_BIT_SET; if (veu->bt709) temp |= VTRCR_BT709; if (veu->full_range) temp |= VTRCR_FULL_COLOR_CONV; write_reg(base_addr, temp, VTRCR); if (veu_is_veu2h(veu)) { /* color conversion matrix */ write_reg(base_addr, 0x0cc5, VMCR00); write_reg(base_addr, 0x0950, VMCR01); write_reg(base_addr, 0x0000, VMCR02); write_reg(base_addr, 0x397f, VMCR10); write_reg(base_addr, 0x0950, VMCR11); write_reg(base_addr, 0x3cdd, VMCR12); write_reg(base_addr, 0x0000, VMCR20); write_reg(base_addr, 0x0950, VMCR21); write_reg(base_addr, 0x1023, VMCR22); write_reg(base_addr, 0x00800010, VCOFFR); } /* Clipping */ write_reg(base_addr, 0, VRFSR); set_clip(base_addr, 0, dst->w); set_clip(base_addr, 1, dst->h); /* Scaling */ write_reg(base_addr, 0, VRFCR); if (!(filter_control & 0x3)) { /* Not a rotate operation */ set_scale(veu, base_addr, 0, src->w, dst->w, 0); set_scale(veu, base_addr, 1, src->h, dst->h, 0); } /* Filter control - directly pass user arg to register */ write_reg(base_addr, filter_control, VFMCR); return 0; fail: uiomux_unlock(veu->uiomux, veu->uiores); return -1; }
Matrix4x4 SceneGraph::local_pose(TransformInstance i) const { Matrix4x4 tr = matrix4x4(rotation(_data.local[i.i].rotation), _data.local[i.i].position); set_scale(tr, _data.local[i.i].scale); return tr; }
static void zoom_out(GSimpleAction* action, GVariant* parameter, main_window* data){ set_scale(data->canvas->scale_factor - 0.1, data); }