void gui_003::on_actionSave_triggered()
{
	remove( "temp_highresolution.jpg");
	Player->Stop = true;
	getCapture( 0, "temp_highresolution.jpg");
	cv::Mat highresimage;
	highresimage = cv::imread( "temp_highresolution.jpg");
	QImage save_image = QImage((const unsigned char*)(highresimage.data), highresimage.cols,highresimage.rows,QImage::Format_RGB888).rgbSwapped();
	QString fileName = QFileDialog::getSaveFileName( this, tr("Save File"), "C:/Users/Emir/Desktop", tr("Image Files (*.png *.jpg *.bmp)"));
	QPixmap::fromImage( save_image).copy().save( fileName);
	finalizeCamera();
	Player->Stop = false;
	Player->start();
}
void gui_003::onHighResolutionRegion( QRect SelectionRect)
{
	remove( "temp_highresolution.jpg");
	Player->Stop = true;
	getCapture( 0, "temp_highresolution.jpg");

	HighResInspectionWindow = new InspectionWindow();
	HighResInspectionWindow->HighResInspectionView->centerOn( 2464 * (double)SelectionRect.center().x() / GraphicsView->rect().width(),
															  1632 * (double)SelectionRect.center().y() / GraphicsView->rect().height());
	HighResInspectionWindow->HighResInspectionView->setMinimumSize( (int)( SelectionRect.width() * 2464 / (double) 640),
																	(int)( SelectionRect.height()* 1632 / (double) 426));
	HighResInspectionWindow->HighResInspectionView->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum);	
	HighResInspectionWindow->setCentralWidget( HighResInspectionWindow->HighResInspectionView);
	HighResInspectionWindow->show();

	finalizeCamera();
	Player->Stop = false;
	Player->start();
}
Esempio n. 3
0
bool
IRTranslator::tryTranslateSingletonInline(const NormalizedInstruction& i,
                                          const Func* funcd) {
  using Atom = BCPattern::Atom;
  using Captures = BCPattern::CaptureVec;

  if (!funcd) return false;

  // Make sure we have an acceptable FPush and non-null callee.
  assert(i.op() == Op::FPushFuncD ||
         i.op() == Op::FPushClsMethodD);

  auto fcall = i.nextSk();

  // Check if the next instruction is an acceptable FCall.
  if ((fcall.op() != Op::FCall && fcall.op() != Op::FCallD) ||
      funcd->isResumable() || funcd->isReturnRef()) {
    return false;
  }

  // First, check for the static local singleton pattern...

  // Lambda to check if CGetL and StaticLocInit refer to the same local.
  auto has_same_local = [] (PC pc, const Captures& captures) {
    if (captures.size() == 0) return false;

    auto cgetl = (const Op*)pc;
    auto sli = (const Op*)captures[0];

    assert(*cgetl == Op::CGetL);
    assert(*sli == Op::StaticLocInit);

    return (getImm(sli, 0).u_IVA == getImm(cgetl, 0).u_IVA);
  };

  auto cgetl = Atom(Op::CGetL).onlyif(has_same_local);
  auto retc  = Atom(Op::RetC);

  // Look for a static local singleton pattern.
  auto result = BCPattern {
    Atom(Op::Null),
    Atom(Op::StaticLocInit).capture(),
    Atom(Op::IsTypeL),
    Atom::alt(
      Atom(Op::JmpZ).taken({cgetl, retc}),
      Atom::seq(Atom(Op::JmpNZ), cgetl, retc)
    )
  }.ignore(
    {Op::AssertRATL, Op::AssertRATStk}
  ).matchAnchored(funcd);

  if (result.found()) {
    try {
      hhbcTrans().emitSingletonSLoc(
        funcd,
        (const Op*)result.getCapture(0)
      );
    } catch (const FailedIRGen& e) {
      return false;
    } catch (const FailedCodeGen& e) {
      return false;
    }
    TRACE(1, "[singleton-sloc] %s <- %s\n",
        funcd->fullName()->data(),
        fcall.func()->fullName()->data());
    return true;
  }

  // Not found; check for the static property pattern.

  // Factory for String atoms that are required to match another captured
  // String opcode.
  auto same_string_as = [&] (int i) {
    return Atom(Op::String).onlyif([=] (PC pc, const Captures& captures) {
      auto string1 = (const Op*)pc;
      auto string2 = (const Op*)captures[i];
      assert(*string1 == Op::String);
      assert(*string2 == Op::String);

      auto const unit = funcd->unit();
      auto sd1 = unit->lookupLitstrId(getImmPtr(string1, 0)->u_SA);
      auto sd2 = unit->lookupLitstrId(getImmPtr(string2, 0)->u_SA);

      return (sd1 && sd1 == sd2);
    });
  };

  auto stringProp = same_string_as(0);
  auto stringCls  = same_string_as(1);
  auto agetc = Atom(Op::AGetC);
  auto cgets = Atom(Op::CGetS);

  // Look for a class static singleton pattern.
  result = BCPattern {
    Atom(Op::String).capture(),
    Atom(Op::String).capture(),
    Atom(Op::AGetC),
    Atom(Op::CGetS),
    Atom(Op::IsTypeC),
    Atom::alt(
      Atom(Op::JmpZ).taken({stringProp, stringCls, agetc, cgets, retc}),
      Atom::seq(Atom(Op::JmpNZ), stringProp, stringCls, agetc, cgets, retc)
    )
  }.ignore(
    {Op::AssertRATL, Op::AssertRATStk}
  ).matchAnchored(funcd);

  if (result.found()) {
    try {
      hhbcTrans().emitSingletonSProp(
        funcd,
        (const Op*)result.getCapture(1),
        (const Op*)result.getCapture(0)
      );
    } catch (const FailedIRGen& e) {
      return false;
    } catch (const FailedCodeGen& e) {
      return false;
    }
    TRACE(1, "[singleton-sprop] %s <- %s\n",
        funcd->fullName()->data(),
        fcall.func()->fullName()->data());
    return true;
  }

  return false;
}