void CConnection::setPF(const PixelFormat& pf)
{
- if (server.pf().equal(pf) && !formatChange)
+ if (server.pf() == pf && !formatChange)
return;
nextPF = pf;
for (i = rects.begin(); i != rects.end(); i++)
missedPixels += i->area();
- if (changed.equals(newChanged))
+ if (changed == newChanged)
return false;
changed = newChanged;
extendSolidAreaByBlock(sr, colourValue, pb, &erb);
// Did we end up getting the entire rectangle?
- if (erb.equals(rect))
+ if (erb == rect)
erp = erb;
else {
// Don't bother with sending tiny rectangles
int stride;
// Do wo need to convert the data?
- if (convert && !conn->client.pf().equal(pb->getPF())) {
+ if (convert && conn->client.pf() != pb->getPF()) {
convertedPixelBuffer.setPF(conn->client.pf());
convertedPixelBuffer.setSize(rect.width(), rect.height());
ModifiablePixelBuffer* /*pb*/) {}
void reset();
- inline bool isEqualRect(const Rect &r) const { return r.equals(rect); }
+ inline bool isEqualRect(const Rect &r) const { return r == rect; }
bool isReady();
protected:
#ifdef JCS_EXTENSIONS
// Try to have libjpeg output directly to our native format
// libjpeg can only handle some "standard" formats
- if (pfRGBX.equal(pf))
+ if (pfRGBX == pf)
cinfo->in_color_space = JCS_EXT_RGBX;
- else if (pfBGRX.equal(pf))
+ else if (pfBGRX == pf)
cinfo->in_color_space = JCS_EXT_BGRX;
- else if (pfXRGB.equal(pf))
+ else if (pfXRGB == pf)
cinfo->in_color_space = JCS_EXT_XRGB;
- else if (pfXBGR.equal(pf))
+ else if (pfXBGR == pf)
cinfo->in_color_space = JCS_EXT_XBGR;
if (cinfo->in_color_space != JCS_RGB) {
#ifdef JCS_EXTENSIONS
// Try to have libjpeg output directly to our native format
// libjpeg can only handle some "standard" formats
- if (pfRGBX.equal(pf))
+ if (pfRGBX == pf)
dinfo->out_color_space = JCS_EXT_RGBX;
- else if (pfBGRX.equal(pf))
+ else if (pfBGRX == pf)
dinfo->out_color_space = JCS_EXT_BGRX;
- else if (pfXRGB.equal(pf))
+ else if (pfXRGB == pf)
dinfo->out_color_space = JCS_EXT_XRGB;
- else if (pfXBGR.equal(pf))
+ else if (pfXBGR == pf)
dinfo->out_color_space = JCS_EXT_XBGR;
if (dinfo->out_color_space != JCS_RGB) {
const uint8_t* srcBuffer;
int srcStride;
- if (format.equal(pf)) {
+ if (format == pf) {
getImage(imageBuf, r, stride);
return;
}
updateState();
}
-bool PixelFormat::equal(const PixelFormat& other) const
+bool PixelFormat::operator==(const PixelFormat& other) const
{
if (bpp != other.bpp || depth != other.depth)
return false;
return true;
}
+bool PixelFormat::operator!=(const PixelFormat& other) const
+{
+ return !(*this == other);
+}
+
void PixelFormat::read(rdr::InStream* is)
{
bpp = is->readU8();
const uint8_t* src, int w, int h,
int dstStride, int srcStride) const
{
- if (equal(srcPF)) {
+ if (*this == srcPF) {
// Trivial case
while (h--) {
memcpy(dst, src, w * bpp/8);
// Checks if the formats have identical buffer representation.
// They might still have different pixel representation, endianness
// or true colour state.
- bool equal(const PixelFormat& other) const;
+ bool operator==(const PixelFormat& other) const;
+ bool operator!=(const PixelFormat& other) const;
void read(rdr::InStream* is);
void write(rdr::OutStream* os) const;
inline Point negate() const
__attribute__ ((warn_unused_result))
{return Point(-x, -y);}
- inline bool equals(const Point &p) const {return x==p.x && y==p.y;}
+ inline bool operator==(const Point &p) const {return x==p.x && y==p.y;}
+ inline bool operator!=(const Point &p) const {return x!=p.x || y!=p.y;}
inline Point translate(const Point &p) const
__attribute__ ((warn_unused_result))
{return Point(x+p.x, y+p.y);}
{
return Rect(tl.translate(p), br.translate(p));
}
- inline bool equals(const Rect &r) const {return r.tl.equals(tl) && r.br.equals(br);}
+ inline bool operator==(const Rect &r) const {return r.tl == tl && r.br == br;}
+ inline bool operator!=(const Rect &r) const {return r.tl != tl || r.br != br;}
inline bool is_empty() const {return (tl.x >= br.x) || (tl.y >= br.y);}
inline void clear() {tl = Point(); br = Point();}
inline bool enclosed_by(const Rect &r) const {
return ret;
}
-bool rfb::Region::equals(const rfb::Region& r) const {
+bool rfb::Region::operator==(const rfb::Region& r) const {
return pixman_region_equal(rgn, r.rgn);
}
+bool rfb::Region::operator!=(const rfb::Region& r) const {
+ return !pixman_region_equal(rgn, r.rgn);
+}
+
int rfb::Region::numRects() const {
return pixman_region_n_rects(rgn);
}
Region subtract(const Region& r) const
__attribute__ ((warn_unused_result));
- bool equals(const Region& b) const;
+ bool operator==(const Region& b) const;
+ bool operator!=(const Region& b) const;
int numRects() const;
bool is_empty() const { return numRects() == 0; }
inline bool operator==(const Screen& r) const {
if (id != r.id)
return false;
- if (!dimensions.equals(r.dimensions))
+ if (dimensions != r.dimensions)
return false;
if (flags != r.flags)
return false;
uint8_t* outbuf;
int stride;
- if (pb->getPF().equal(pf)) {
+ if (pb->getPF() == pf) {
// Decode directly into the framebuffer (fast path)
directDecode = true;
} else {
if (!client.supportsLocalCursor())
return true;
- if (!server->getCursorPos().equals(pointerEventPos) &&
+ if ((server->getCursorPos() != pointerEventPos) &&
(time(0) - pointerEventTime) > 0)
return true;
void VNCServerST::setCursorPos(const Point& pos, bool warped)
{
- if (!cursorPos.equals(pos)) {
+ if (cursorPos != pos) {
cursorPos = pos;
renderedCursorInvalid = true;
std::list<VNCSConnectionST*>::iterator ci;
// Pointer move events are not sent when waiting for the timeout.
// However, we can't let the position get out of sync so when
// the pointer has moved we have to send the latest position here.
- if (!origPos.equals(lastPos)) {
+ if (origPos != lastPos) {
buttonMask = createButtonMask(buttonMask);
sendPointerEvent(lastPos, buttonMask);
}
// If nothing has changed & a recreate has not been forced, delete
// the new device context and return
if (pb && !force &&
- newScreenRect.equals(screenRect) &&
- new_device->getPF().equal(pb->getPF())) {
+ newScreenRect == screenRect &&
+ new_device->getPF() == pb->getPF()) {
delete new_device;
return;
}
DWORD flags = MOUSEEVENTF_ABSOLUTE;
// - Has the pointer moved since the last event?
- if (!last_position.equals(pos))
+ if (last_position != pos)
flags |= MOUSEEVENTF_MOVE;
// - If the system swaps left and right mouse buttons then we must
Info() : cursor(0), visible(false) {}
bool operator!=(const Info& info) {
return ((cursor != info.cursor) ||
- (!position.equals(info.position)) ||
+ (position != info.position) ||
(visible != info.visible));
}
};
if (IsWindow(window) && IsWindowVisible(window) && GetWindowRect(window, &wrect)) {
Rect winrect(wrect.left, wrect.top, wrect.right, wrect.bottom);
if (fg_window == window) {
- if (!fg_window_rect.tl.equals(winrect.tl) && ut) {
+ if (fg_window_rect.tl != winrect.tl && ut) {
// Window has moved - mark both the previous and new position as changed
// (we can't use add_copied() here because we aren't that properly synced
// with the actual state of the framebuffer)