static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
{

//	if (f >= 0) mga_uninit();
	if(!vo_screenwidth || !vo_screenheight) {
		int fd;
		struct fb_var_screeninfo fbinfo;

		if(-1 != (fd = open(FBDEV, O_RDONLY))) {
			if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
				if(!vo_screenwidth)   vo_screenwidth = fbinfo.xres;
				if(!vo_screenheight) vo_screenheight = fbinfo.yres;
			} else {
				perror("FBIOGET_VSCREENINFO");
			}
			close(fd);
		} else {
			perror(FBDEV);
		}
	}

	if(vo_screenwidth && vo_screenheight){
		aspect_save_orig(width,height);
		aspect_save_prescale(d_width,d_height);
		aspect_save_screenres(vo_screenwidth,vo_screenheight);

		if(flags&VOFLAG_FULLSCREEN) { /* -fs */
			aspect(&d_width,&d_height,A_ZOOM);
			vo_fs = VO_TRUE;
		} else {
			aspect(&d_width,&d_height,A_NOZOOM);
			vo_fs = VO_FALSE;
		}
		mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_AspectResized,d_width,d_height);
	}

	vo_dwidth=d_width; vo_dheight=d_height;
	mga_vid_config.dest_width = d_width;
	mga_vid_config.dest_height= d_height;
	mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
	mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
	if(vo_screenwidth && vo_screenheight){
		mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
		mga_vid_config.y_org=(vo_screenheight-d_height)/2;
	}

    return mga_init(width,height,format);
}
Exemple #2
0
int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
                     uint32_t d_width, uint32_t d_height, uint32_t flags,
                     char *title, uint32_t format) {
  panscan_init();
  aspect_save_orig(width,height);
  aspect_save_prescale(d_width,d_height);

  if (vo->control(VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
    aspect(&d_width,&d_height,A_NOZOOM);
    vo_dx = (int)(vo_screenwidth - d_width) / 2;
    vo_dy = (int)(vo_screenheight - d_height) / 2;
    geometry(&vo_dx, &vo_dy, &d_width, &d_height,
             vo_screenwidth, vo_screenheight);
    geometry_xy_changed |= xinerama_screen >= 0;
    vo_dx += xinerama_x;
    vo_dy += xinerama_y;
    vo_dwidth = d_width;
    vo_dheight = d_height;
#ifdef CONFIG_GUI
    if (use_gui) {
      // GUI creates and manages window for us
      gui(GUI_SETUP_VIDEO_WINDOW, 0);
    }
#endif
  }

  return vo->config(width, height, d_width, d_height, flags, title, format);
}
int main(int argc, char *argv[]) {
  int w,h,z=DEF_ZOOM;
  //printf("argc: %d\n",argc);
  switch(argc) {
    case 10:
      z = atoi(argv[9]);
    case 9:
      monitor_aspect = (float)atoi(argv[7])/(float)atoi(argv[8]);
    case 7:
      aspect_save_prescale(atoi(argv[5]),atoi(argv[6]));
      printf("prescale size:  %sx%s\n",argv[5],argv[6]);
    case 5:
      aspect_save_screenres(atoi(argv[1]),atoi(argv[2]));
      printf("screenres:      %sx%s\n",argv[1],argv[2]);
      aspect_save_orig(atoi(argv[3]),atoi(argv[4]));
      printf("original size:  %sx%s\n",argv[3],argv[4]);
      w=atoi(argv[3]); h=atoi(argv[4]);
    break;
    default:
      printf("USAGE: %s <screenw> <screenh> <origw> <origh>\n[<prescalew> "
             "<prescaleh>] [<screenaspectw> <screenaspecth>] [<zoom 0/1>]\n",
        argv[0]);
      return 1;
  }
  printf("monitor_aspect: %f\n",monitor_aspect);
  aspect(&w,&h,z); 
  printf("new size:       %dx%d\n",w,h);
  return 0;
}
Exemple #4
0
    void filterEntities()
    {
        //QSKIP("Skipping until TestAspect can be registered");
        QFETCH(Qt3DCore::QEntity *, entitySubtree);
        QFETCH(Qt3DCore::QNodeIdVector, layerFilterIds);
        QFETCH(Qt3DCore::QNodeIdVector, expectedSelectedEntities);


        // GIVEN
        QScopedPointer<Qt3DRender::TestAspect> aspect(new Qt3DRender::TestAspect(entitySubtree));

        // WHEN
        Qt3DRender::Render::Entity *backendRoot = aspect->nodeManagers()->renderNodesManager()->getOrCreateResource(entitySubtree->id());
        Qt3DRender::Render::UpdateTreeEnabledJob updateTreeEnabledJob;
        updateTreeEnabledJob.setRoot(backendRoot);
        updateTreeEnabledJob.run();

        // WHEN
        Qt3DRender::Render::FilterLayerEntityJob filterJob;
        filterJob.setLayerFilters(layerFilterIds);
        filterJob.setManager(aspect->nodeManagers());
        filterJob.run();

        // THEN
        const QVector<Qt3DRender::Render::Entity *> filterEntities = filterJob.filteredEntities();
        QCOMPARE(filterEntities.size(), expectedSelectedEntities.size());
        for (auto i = 0, m = expectedSelectedEntities.size(); i < m; ++i)
            QCOMPARE(filterEntities.at(i)->peerId(), expectedSelectedEntities.at(i));
    }
bool PresentationKB::setupNewImage(int idx)
{
    assert(idx >= 0 && idx < 2);

    if ( !d->haveImages)
        return false;

    bool ok  = false;
    d->zoomIn = !d->zoomIn;

    if (d->imageLoadThread->grabImage())
    {
        delete d->image[idx];

        // we have the image lock and there is an image
        float imageAspect            = d->imageLoadThread->imageAspect();
        KBViewTrans* const viewTrans = new KBViewTrans(d->zoomIn, aspect() / imageAspect);
        d->image[idx]                = new KBImage(viewTrans, imageAspect);

        applyTexture(d->image[idx], d->imageLoadThread->image());
        ok = true;

    }
    else
    {
        d->haveImages = false;
    }

    // don't forget to release the lock on the copy of the image
    // owned by the image loader thread
    d->imageLoadThread->ungrabImage();

    return ok;
}
Exemple #6
0
static uint32_t fullscreen(void) {
  vo_fs ^= 1;
  aspect(&dst_width,&dst_height,vo_fs ? A_ZOOM : A_NOZOOM);
  // This does not work :((
  //clear_screen();
  return VO_TRUE;
}
static uint32_t setup_vidix(void){
  int x=vo_dx,y=vo_dy;
  aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM);  
  if(vo_fs || center){
    if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2;
    else x=0;
    if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2;
    else y=0;
  }
  if(vo_config_count)vidix_stop();
  if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){
    mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno));
    return 1;
  }
  vidix_start();
  if(vidix_grkey_support()){
    vidix_grkey_get(&gr_key);
    gr_key.key_op = KEYS_PUT;
    if (!vo_fs && !(vo_colorkey & 0xff000000)){
	  gr_key.ckey.op = CKEY_TRUE;
	  gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
	  gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
	  gr_key.ckey.blue = vo_colorkey & 0x000000FF;
    }
    else gr_key.ckey.op = CKEY_FALSE;
static void resize(int x,int y){
  // simple orthogonal projection for 0-1;0-1
  static const float matrix[16] = {
     2,  0, 0, 0,
     0, -2, 0, 0,
     0,  0, 0, 0,
    -1,  1, 0, 1,
  };
  mp_msg(MSGT_VO,MSGL_V,"[gl_tiled] Resize: %dx%d\n",x,y);
  if(aspect_scaling()) {
    glClear(GL_COLOR_BUFFER_BIT);
    aspect(&x, &y, A_WINZOOM);
    panscan_calc_windowed();
    x += vo_panscan_x;
    y += vo_panscan_y;
    glViewport( (vo_dwidth-x)/2, (vo_dheight-y)/2, x, y);
  } else {
    //aspect(x, y, A_NOZOOM);
    if (WinID >= 0) {
      int left = 0, top = 0, w = x, h = y;
      geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight);
      top = y - h - top;
      glViewport(left, top, w, h);
    } else
      glViewport( 0, 0, x, y );
  }

  glLoadMatrixf(matrix);
}
void RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentFinished()
{
    QPushButton *button = fetchButton();
    disconnect(button, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
    connect(button, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
    button->setText(FetchEnvButtonText);
    aspect()->setRemoteEnvironment(deviceEnvReader->remoteEnvironment());
}
Exemple #10
0
/* Setup output screen dimensions etc */
static void setup_screen(uint32_t full)
{
    aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);

    geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight);
    vo_fs = full;
    clear_screen();
}
void RemoteLinuxEnvironmentAspectWidget::fetchEnvironment()
{
    QPushButton *button = fetchButton();
    disconnect(button, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
    connect(button, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
    button->setText(tr("Cancel Fetch Operation"));
    deviceEnvReader->start(aspect()->runConfiguration()->environmentPreparationCommand());
}
Exemple #12
0
void Camera::update()
{
    m_projection = glm::perspective(m_fovy, aspect(), m_zNear, m_zFar);
   
    setTransform(m_projection * m_view);

    m_invalidated = false;
}
Exemple #13
0
static void mga_fullscreen(void)
{
	uint32_t w,h;
	if ( !vo_fs ) {
		vo_fs=VO_TRUE;
		w=vo_screenwidth; h=vo_screenheight;
		aspect(&w,&h,A_ZOOM);
	} else {
		vo_fs=VO_FALSE;
		w=vo_dwidth; h=vo_dheight;
		aspect(&w,&h,A_NOZOOM);
	}
	mga_vid_config.dest_width = w;
	mga_vid_config.dest_height= h;
	mga_vid_config.x_org=(vo_screenwidth-w)/2;
	mga_vid_config.y_org=(vo_screenheight-h)/2;
	if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
		mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ErrorInConfigIoctl );
}
Exemple #14
0
static void resize(void)
{
	aspect(&vo_dwidth, &vo_dheight, vo_fs ? A_ZOOM : A_NOZOOM);
	panscan_calc();
	
	vo_dwidth += vo_panscan_x;
	vo_dheight += vo_panscan_y;
	
	mpgxSetSquare(vo_dwidth / 2.0, vo_dheight / 2.0);
}
  virtual GLFWwindow * createRenderingTarget(glm::uvec2 & outSize, glm::ivec2 & outPosition) {
    outSize = glm::uvec2(800, 600);
    outPosition = glm::ivec2(100, 100);
    Stacks::projection().top() = glm::perspective(
      PI / 3.0f, aspect(outSize),
      0.01f, 10000.0f);
    Stacks::modelview().top() = glm::lookAt(
      glm::vec3(0.0f, 0.0f, 3.5f),
      Vectors::ORIGIN, Vectors::UP);

    return glfw::createWindow(outSize, outPosition);
  }
Exemple #16
0
void djvVectorUtilTest::run(int &, char **)
{
    DJV_DEBUG("djvVectorUtilTest::run");
    
    abs();
    swap();
    range();
    isSizeValid();
    length();
    normalize();
    dot();
    aspect();
    convert();
}
Exemple #17
0
static void resize(int x,int y){
  // simple orthogonal projection for 0-image_width;0-image_height
  float matrix[16] = {
    2.0/image_width,   0, 0, 0,
    0, -2.0/image_height, 0, 0,
    0, 0, 0, 0,
    -1, 1, 0, 1
  };
  mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
  if (WinID >= 0) {
    int left = 0, top = 0, w = x, h = y;
    geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight);
    top = y - h - top;
    mpglViewport(left, top, w, h);
  } else
    mpglViewport( 0, 0, x, y );

  mpglMatrixMode(GL_PROJECTION);
  ass_border_x = ass_border_y = 0;
  if (aspect_scaling() && use_aspect) {
    int new_w, new_h;
    GLdouble scale_x, scale_y;
    aspect(&new_w, &new_h, A_WINZOOM);
    panscan_calc_windowed();
    new_w += vo_panscan_x;
    new_h += vo_panscan_y;
    scale_x = (GLdouble)new_w / (GLdouble)x;
    scale_y = (GLdouble)new_h / (GLdouble)y;
    matrix[0]  *= scale_x;
    matrix[12] *= scale_x;
    matrix[5]  *= scale_y;
    matrix[13] *= scale_y;
    ass_border_x = (vo_dwidth - new_w) / 2;
    ass_border_y = (vo_dheight - new_h) / 2;
  }
  mpglLoadMatrixf(matrix);

  mpglMatrixMode(GL_MODELVIEW);
  mpglLoadIdentity();

  if (!scaled_osd) {
#ifdef CONFIG_FREETYPE
    // adjust font size to display size
    force_load_font = 1;
#endif
    vo_osd_changed(OSDTYPE_OSD);
  }
  mpglClear(GL_COLOR_BUFFER_BIT);
  redraw();
}
Exemple #18
0
void SceneViewCommon3D::mouseMoveEvent(QMouseEvent *event)
{
    int dx = event->x() - m_lastPos.x();
    int dy = event->y() - m_lastPos.y();

    m_lastPos = event->pos();

    setToolTip("");

    // pan
    if ((event->buttons() & Qt::MidButton)
            || ((event->buttons() & Qt::LeftButton)
                && (((event->modifiers() & Qt::ShiftModifier) && !(event->modifiers() & Qt::ControlModifier)))))

    {
        setCursor(Qt::PointingHandCursor);

        m_offset3d.x -= 2.0/width() * dx*aspect();
        m_offset3d.y += 2.0/height() * dy;

        emit mouseSceneModeChanged(MouseSceneMode_Pan);

        updateGL();
    }

    // rotate
    if ((event->buttons() & Qt::LeftButton)
            && (!(event->modifiers() & Qt::ShiftModifier) && !(event->modifiers() & Qt::ControlModifier)))
    {
        setCursor(Qt::PointingHandCursor);

        m_rotation3d.x -= dy;
        m_rotation3d.y += dx;

        emit mouseSceneModeChanged(MouseSceneMode_Rotate);

        updateGL();
    }
    if ((event->buttons() & Qt::LeftButton)
            && (!(event->modifiers() & Qt::ShiftModifier) && (event->modifiers() & Qt::ControlModifier)))
    {
        setCursor(Qt::PointingHandCursor);

        m_rotation3d.z -= dy;

        emit mouseSceneModeChanged(MouseSceneMode_Rotate);

        updateGL();
    }
}
// Method to render a string on the OR
void RenderUtils::RenderMessageAt(std::string str, glm::uvec2 windowSize, glm::vec2  pos){
  windowAspect = aspect(windowSize);
  windowAspectInverse = 1.0f / windowAspect;
  MatrixStack & mv = Stacks::modelview();
  MatrixStack & pr = Stacks::projection();
  mv.push().identity();
  pr.push().top() = glm::ortho(
    -1.0f, 1.0f,
    -windowAspectInverse, windowAspectInverse,
    -100.0f, 100.0f);
  glm::vec2 cursor(pos.x, windowAspectInverse * pos.y);
  oria::renderString(str, cursor, 12.0f);
  pr.pop();
  mv.pop();
}
Exemple #20
0
static int draw_slice(uint8_t * src[], int stride[], int w, int h,
                           int x, int y)
{
    uint8_t *dst[MP_MAX_PLANES] = {NULL};
    int dstStride[MP_MAX_PLANES] = {0};

    if ((old_vo_dwidth != vo_dwidth
         || old_vo_dheight != vo_dheight) /*&& y==0 */  && zoomFlag)
    {
        int newW = vo_dwidth;
        int newH = vo_dheight;
        struct SwsContext *oldContext = swsContext;

        old_vo_dwidth = vo_dwidth;
        old_vo_dheight = vo_dheight;

        if (vo_fs)
            aspect(&newW, &newH, A_ZOOM);
        if (sws_flags == 0)
            newW &= (~31);      // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed

        swsContext = sws_getContextFromCmdLine(srcW, srcH, in_format,
                                               newW, newH, out_format);
        if (swsContext)
        {
            image_width = (newW + 7) & (~7);
            image_height = newH;

            freeMyXImage();
            getMyXImage();
            sws_freeContext(oldContext);
        } else
        {
            swsContext = oldContext;
        }
        dst_width = newW;
    }

    dstStride[0] = image_width * ((bpp + 7) / 8);
    dst[0] = ImageData;
    if (Flip_Flag)
    {
        dst[0] += dstStride[0] * (image_height - 1);
        dstStride[0] = -dstStride[0];
    }
    sws_scale(swsContext, src, stride, y, h, dst, dstStride);
    return 0;
}
void panscan_calc( void )
{
 int fwidth,fheight;
 int vo_panscan_area;

 if (vo_panscanrange > 0) {
 aspect(&fwidth,&fheight,A_ZOOM);
 vo_panscan_area = (aspdat.scrh-fheight);
   vo_panscan_area *= vo_panscanrange;
 } else
   vo_panscan_area = -vo_panscanrange * aspdat.scrh;

 vo_panscan_amount = vo_fs ? vo_panscan : 0;
 vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
 vo_panscan_y = vo_panscan_area * vo_panscan_amount;
}
void QgsRasterTerrainAnalysisPlugin::aspect()
{
  QgsRasterTerrainAnalysisDialog d( QgsRasterTerrainAnalysisDialog::NoParameter, mIface->mainWindow() );
  d.setWindowTitle( tr( "Aspect" ) );
  if ( d.exec() == QDialog::Accepted )
  {
    QString outputFile = d.outputFile();
    QgsAspectFilter aspect( d.inputFile(), outputFile, d.outputFormat() );
    aspect.setZFactor( d.zFactor() );
    QProgressDialog p( tr( "Calculating aspect..." ), tr( "Abort" ), 0, 0 );
    p.setWindowModality( Qt::WindowModal );
    aspect.processRaster( &p );
    if ( d.addResultToProject( ) )
    {
      mIface->addRasterLayer( outputFile, QFileInfo( outputFile ).baseName() );
    }
  }
}
Exemple #23
0
void SceneViewCommon3D::loadProjection3d(bool setScene, bool plane)
{
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-0.5, 0.5, -0.5, 0.5, 4.0, 15.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    if (setScene)
    {
        // set max and min zoom
        if (m_scale3d < 1e-9) m_scale3d = 1e-9;
        if (m_scale3d > 1e6) m_scale3d = 1e6;

        glScaled(1.0/aspect(), 1.0, 0.1);

        // move to origin
        glTranslated(-m_offset3d.x, -m_offset3d.y, 1.0);

        glRotated(m_rotation3d.x, 1.0, 0.0, 0.0);
        glRotated(m_rotation3d.z, 0.0, 1.0, 0.0);
        glRotated(m_rotation3d.y, 0.0, 0.0, 1.0);

        RectPoint rect = Agros2D::scene()->boundingBox();
        if (plane)
        {
            glTranslated(- m_scale3d * (rect.start.x + rect.end.x) / 2.0, - m_scale3d * (rect.start.y + rect.end.y) / 2.0, 0.0);
        }
        else
        {
            if (Agros2D::problem()->config()->coordinateType() == CoordinateType_Planar)
            {
                glTranslated(- m_scale3d * (rect.start.x + rect.end.x) / 2.0, - m_scale3d * (rect.start.y + rect.end.y) / 2.0, 0.0);
            }
            else
            {
                glTranslated(0.0, - m_scale3d * (rect.start.y + rect.end.y) / 2.0, 0.0);
            }
        }

        glScaled(m_scale3d, m_scale3d, m_scale3d);
    }
}
static void panscan_calc_internal(int zoom)
{
 int fwidth,fheight;
 int vo_panscan_area;
 int max_w, max_h;
 get_max_dims(&max_w, &max_h, zoom);

 if (vo_panscanrange > 0) {
   aspect(&fwidth,&fheight,zoom);
   vo_panscan_area = max_h - fheight;
   if (!vo_panscan_area)
     vo_panscan_area = max_w - fwidth;
   vo_panscan_area *= vo_panscanrange;
 } else
   vo_panscan_area = -vo_panscanrange * max_h;

 vo_panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0;
 vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
 vo_panscan_y = vo_panscan_area * vo_panscan_amount;
}
/* Setup output screen dimensions etc */
static void setup_screen(uint32_t full)
{
  int inpageoffset;
   
  aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);

  // center picture
  vidx = (screenwidth - vidwidth) / 2;
  vidy = (screenheight - vidheight) / 2;

  geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight);
  vo_fs = full;
   
  inpageoffset = yuv_on(in_s3_format, in_width, in_height, vidx, vidy, vidwidth, vidheight, 0, screenwidth, screenheight, screenstride, 0);
  inpage0 = smem + inpageoffset;
  inpage = inpage0;
  mp_msg(MSGT_VO, MSGL_INFO, "s3fb: output is at %dx%d +%dx%d\n", vidx, vidy, vidwidth, vidheight);
   
  clear_screen();
}
  virtual GLFWwindow * createRenderingTarget(glm::uvec2 & outSize, glm::ivec2 & outPosition) {
    outSize = glm::uvec2(800, 600);
    outPosition = glm::ivec2(100, 100);
    Stacks::projection().top() = glm::perspective(
        PI / 3.0f, aspect(outSize),
        0.01f, 10000.0f);
    Stacks::modelview().top() = glm::lookAt(
        glm::vec3(0.0f, 0.0f, 3.5f),
        Vectors::ORIGIN, Vectors::UP);

    GLFWwindow * result = glfw::createWindow(outSize, outPosition);

    ovr_Initialize();
    hmd = ovrHmd_Create(0);

    if (!hmd || !ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation, 0)) {
      FAIL("Unable to locate Rift sensors");
    }
    return result;
  }
Exemple #27
0
int config_video_out(vo_functions_t *vo, uint32_t width, uint32_t height,
                     uint32_t d_width, uint32_t d_height, uint32_t flags,
                     char *title, uint32_t format) {
  panscan_init();
  aspect_save_orig(width,height);
  aspect_save_prescale(d_width,d_height);

  if (vo->control(VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
  aspect(&d_width,&d_height,A_NOZOOM);
  vo_dx = (int)(vo_screenwidth - d_width) / 2;
  vo_dy = (int)(vo_screenheight - d_height) / 2;
  geometry(&vo_dx, &vo_dy, &d_width, &d_height,
           vo_screenwidth, vo_screenheight);
  vo_dx += xinerama_x;
  vo_dy += xinerama_y;
  vo_dwidth = d_width;
  vo_dheight = d_height;
  }

  return vo->config(width, height, d_width, d_height, flags, title, format);
}
Exemple #28
0
static void resize(int x,int y){
  mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
  if (WinID >= 0) {
    int top = 0, left = 0, w = x, h = y;
    geometry(&top, &left, &w, &h, vo_screenwidth, vo_screenheight);
    Viewport(top, left, w, h);
  } else
  Viewport( 0, 0, x, y );

  MatrixMode(GL_PROJECTION);
  LoadIdentity();
  ass_border_x = ass_border_y = 0;
  if (aspect_scaling() && use_aspect) {
    int new_w, new_h;
    GLdouble scale_x, scale_y;
    aspect(&new_w, &new_h, A_WINZOOM);
    panscan_calc_windowed();
    new_w += vo_panscan_x;
    new_h += vo_panscan_y;
    scale_x = (GLdouble)new_w / (GLdouble)x;
    scale_y = (GLdouble)new_h / (GLdouble)y;
    Scaled(scale_x, scale_y, 1);
    ass_border_x = (vo_dwidth - new_w) / 2;
    ass_border_y = (vo_dheight - new_h) / 2;
  }
  Ortho(0, image_width, image_height, 0, -1,1);

  MatrixMode(GL_MODELVIEW);
  LoadIdentity();

  if (!scaled_osd) {
#ifdef CONFIG_FREETYPE
  // adjust font size to display size
  force_load_font = 1;
#endif
  vo_osd_changed(OSDTYPE_OSD);
  }
  Clear(GL_COLOR_BUFFER_BIT);
  redraw();
}
Exemple #29
0
/**
 * Calculate the appropriate source and destination rectangle to
 * get a correctly scaled picture, including pan-scan.
 * Can be extended to take future cropping support into account.
 *
 * \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
 * \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
 *                may be NULL and only left and top are currently valid.
 */
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
                        struct vo_rect *borders, const struct vo_rect *crop) {
  static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
  int scaled_width  = 0;
  int scaled_height = 0;
  if (!crop) crop = &no_crop;
  src_width  -= crop->left + crop->right;
  src_height -= crop->top  + crop->bottom;
  if (src_width  < 2) src_width  = 2;
  if (src_height < 2) src_height = 2;
  dst->left = 0; dst->right  = vo_dwidth;
  dst->top  = 0; dst->bottom = vo_dheight;
  src->left = 0; src->right  = src_width;
  src->top  = 0; src->bottom = src_height;
  if (borders) {
    borders->left = 0; borders->top = 0;
  }
  if (aspect_scaling()) {
    aspect(&scaled_width, &scaled_height, A_WINZOOM);
    panscan_calc_windowed();
    scaled_width  += vo_panscan_x;
    scaled_height += vo_panscan_y;
    if (borders) {
      borders->left = (vo_dwidth  - scaled_width ) / 2;
      borders->top  = (vo_dheight - scaled_height) / 2;
    }
    src_dst_split_scaling(src_width, vo_dwidth, scaled_width,
                          &src->left, &src->right, &dst->left, &dst->right);
    src_dst_split_scaling(src_height, vo_dheight, scaled_height,
                          &src->top, &src->bottom, &dst->top, &dst->bottom);
  }
  src->left += crop->left; src->right  += crop->left;
  src->top  += crop->top;  src->bottom += crop->top;
  src->width  = src->right  - src->left;
  src->height = src->bottom - src->top;
  dst->width  = dst->right  - dst->left;
  dst->height = dst->bottom - dst->top;
}
static void
resize(void){
    /*
     * this function is called by aa lib if windows resizes
     * further during init, because here we have to calculate
     * a little bit
     */

    aa_resize(c);

    aspect_save_screenres(aa_imgwidth(c),aa_imgheight(c));
    image_height =  aa_imgheight(c); //src_height;
    image_width = aa_imgwidth(c); //src_width;

    aspect(&image_width,&image_height,A_ZOOM);

    image_x = (aa_imgwidth(c) - image_width) / 2;
    image_y = (aa_imgheight(c) - image_height) / 2;
    screen_w = image_width * aa_scrwidth(c) / aa_imgwidth(c);
    screen_h = image_height * aa_scrheight(c) / aa_imgheight(c);
    screen_x = (aa_scrwidth(c) - screen_w) / 2;
    screen_y = (aa_scrheight(c) - screen_h) / 2;

    if(sws) sws_freeContext(sws);
    sws = sws_getContextFromCmdLine(src_width,src_height,image_format,
				   image_width,image_height,IMGFMT_Y8);

    memset(image, 0, sizeof(image));
    image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x;

    memset(image_stride, 0, sizeof(image_stride));
    image_stride[0] = aa_imgwidth(c);

    showosdmessage=0;

}