panda3d/panda/src/display/displayRegion.I
2004-12-06 19:35:05 +00:00

79 lines
2.7 KiB
Plaintext

// Filename: displayRegion.I
// Created by: frang (07Mar99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: DisplayRegion::operator <
// Access: Public
// Description: Returns true if this DisplayRegion should be sorted
// before the other one, false otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool DisplayRegion::
operator < (const DisplayRegion &other) const {
return _sort < other._sort;
}
////////////////////////////////////////////////////////////////////
// Function: DisplayRegion::is_active
// Access: Published
// Description: Returns the active flag associated with the
// DisplayRegion.
////////////////////////////////////////////////////////////////////
INLINE bool DisplayRegion::
is_active() const {
return _active;
}
////////////////////////////////////////////////////////////////////
// Function: DisplayRegion::get_sort
// Access: Published
// Description: Returns the sort value associated with the
// DisplayRegion.
////////////////////////////////////////////////////////////////////
INLINE int DisplayRegion::
get_sort() const {
return _sort;
}
////////////////////////////////////////////////////////////////////
// Function: DisplayRegion::do_compute_pixels
// Access: Private
// Description: The private implementation of compute_pixels, this
// assumes that we already have the lock.
////////////////////////////////////////////////////////////////////
INLINE void DisplayRegion::
do_compute_pixels(int x_size, int y_size) {
if (display_cat.is_debug()) {
display_cat.debug()
<< "DisplayRegion::do_compute_pixels(" << x_size << ", " << y_size << ")\n";
}
_pl = int((_l * x_size) + 0.5);
_pr = int((_r * x_size) + 0.5);
_pb = int((_b * y_size) + 0.5);
_pt = int((_t * y_size) + 0.5);
_pbi = int(((1.0f - _b) * y_size) + 0.5);
_pti = int(((1.0f - _t) * y_size) + 0.5);
}
INLINE ostream &operator << (ostream &out, const DisplayRegion &dr) {
dr.output(out);
return out;
}