예제 #1
0
Rect DesktopServerProto::readRect(BlockingGate *gate)
{
  Rect rect;
  rect.left =  gate->readInt32();
  rect.top = gate->readInt32();
  rect.setWidth(gate->readInt32());
  rect.setHeight(gate->readInt32());

  checkRectangle(&rect);
  return rect;
}
예제 #2
0
bool Texture::setDataBlock(int x, int y, int width, int height, BytePtr input) noexcept
{
  if (checkRectangle(x, y, width, height) && input != nullptr) {
    int srcStride = width * 4;
    int dstStride = getWidth() * 4;
    int srcOfs = 0;
    int dstOfs = (y*getWidth() + x) * 4;
    for (int row = 0; row < height; row++) {
      std::memcpy(m_data.get() + dstOfs, input.get() + srcOfs, srcStride);
      srcOfs += srcStride;
      dstOfs += dstStride;
    }
    return true;
  }
  return false;
}
예제 #3
0
void Rectangle::showResult()
{
	checkRectangle();

	cout << endl;
	cout << "SideAB = " << getSideAB() << endl;
	cout << "SideBC = " << getSideBC() << endl;
	cout << "SideCD = " << getSideCD() << endl;
	cout << "SideDA = " << getSideDA() << endl;

	cout << endl;
	cout << "Length of figure is " << length() << endl;
	cout << "Width of figure is " << width() << endl;
	cout << "Parameter of figure is " << perimeterOfRectangle() << endl;
	cout << "Area of figure is " << areaOfRectangle() << endl;
}