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; }
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; }
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; }