Ticket #7994: BScreen_style_update_and_variable_renaming_1.diff

File BScreen_style_update_and_variable_renaming_1.diff, 15.7 KB (added by jscipione, 13 years ago)

Patch to remove the documentation from the Screen.cpp file and rename some variables and other style updates. NO FUNCTIONAL CHANGE intended.

  • headers/os/interface/Screen.h

    diff --git headers/os/interface/Screen.h headers/os/interface/Screen.h
    index 58cb2e4..7d1ec94 100644
    public:  
    4444
    4545            const color_map*    ColorMap();
    4646
    47             status_t            GetBitmap(BBitmap** _bitmap,
     47            status_t            GetBitmap(BBitmap** bitmap,
    4848                                    bool drawCursor = true,
    4949                                    BRect* frame = NULL);
    5050            status_t            ReadBitmap(BBitmap* bitmap,
    public:  
    5252                                    BRect* frame = NULL);
    5353
    5454            rgb_color           DesktopColor();
    55             rgb_color           DesktopColor(uint32 index);
     55            rgb_color           DesktopColor(uint32 workspace);
    5656            void                SetDesktopColor(rgb_color color,
    5757                                    bool makeDefault = true);
    5858            void                SetDesktopColor(rgb_color color,
    59                                     uint32 index, bool makeDefault = true);
     59                                    uint32 workspace, bool makeDefault = true);
    6060
    6161            status_t            ProposeMode(display_mode* target,
    6262                                    const display_mode* low,
    6363                                    const display_mode* high);
    64             status_t            GetModeList(display_mode** _modeList,
    65                                     uint32* _count);
    66             status_t            GetMode(display_mode* _mode);
     64            status_t            GetModeList(display_mode** modeList,
     65                                    uint32* count);
     66            status_t            GetMode(display_mode* mode);
    6767            status_t            GetMode(uint32 workspace,
    68                                     display_mode* _mode);
     68                                    display_mode* mode);
    6969            status_t            SetMode(display_mode* mode,
    7070                                    bool makeDefault = false);
    7171            status_t            SetMode(uint32 workspace,
  • src/kits/interface/Screen.cpp

    diff --git src/kits/interface/Screen.cpp src/kits/interface/Screen.cpp
    index 7c75a55..bbcb695 100644
     
    88 */
    99
    1010
    11 /*! BScreen lets you retrieve and change the display settings. */
    12 
    13 
    1411#include <Screen.h>
    15 
    1612#include <Window.h>
    1713
    1814#include <PrivateScreen.h>
     
    2117using namespace BPrivate;
    2218
    2319
    24 /*! \brief Creates a BScreen object which represents the display with the given
    25         screen_id
    26     \param id The screen_id of the screen to get.
    27 
    28     In the current implementation, there is only one display (B_MAIN_SCREEN_ID).
    29     To be sure that the object was correctly constructed, call IsValid().
    30 */
    3120BScreen::BScreen(screen_id id)
    3221{
    3322    fScreen = BPrivateScreen::Get(id.id);
    3423}
    3524
    3625
    37 /*! \brief Creates a BScreen object which represents the display which contains
    38     the given BWindow.
    39     \param window A BWindow.
    40 */
    4126BScreen::BScreen(BWindow* window)
    4227{
    4328    fScreen = BPrivateScreen::Get(window);
    4429}
    4530
    4631
    47 /*! \brief Releases the resources allocated by the constructor.
    48 */
    4932BScreen::~BScreen()
    5033{
    5134    BPrivateScreen::Put(fScreen);
    5235}
    5336
    5437
    55 /*! \brief Checks if the BScreen object represents a real screen connected to
    56         the computer.
    57     \return \c true if the BScreen object is valid, \c false if not.
    58 */
    5938bool
    6039BScreen::IsValid()
    6140{
    BScreen::IsValid()  
    6342}
    6443
    6544
    66 /*! \brief In the current implementation, this function always returns B_ERROR.
    67     \return Always \c B_ERROR.
    68 */
    6945status_t
    7046BScreen::SetToNext()
    7147{
    BScreen::SetToNext()  
    8056}
    8157
    8258
    83 /*! \brief Returns the color space of the screen display.
    84     \return \c B_CMAP8, \c B_RGB15, or \c B_RGB32, or \c B_NO_COLOR_SPACE
    85         if the screen object is invalid.
    86 */
    8759color_space
    8860BScreen::ColorSpace()
    8961{
    9062    if (fScreen != NULL)
    9163        return fScreen->ColorSpace();
     64
    9265    return B_NO_COLOR_SPACE;
    9366}
    9467
    9568
    96 /*! \brief Returns the rectangle that locates the screen in the screen
    97         coordinate system.
    98     \return a BRect that locates the screen in the screen coordinate system.
    99 */
    10069BRect
    10170BScreen::Frame()
    10271{
    10372    if (fScreen != NULL)
    10473        return fScreen->Frame();
     74
    10575    return BRect(0, 0, 0, 0);
    10676}
    10777
    10878
    109 /*! \brief Returns the identifier for the screen.
    110     \return A screen_id struct that identifies the screen.
    111 
    112     In the current implementation, this function always returns
    113     \c B_MAIN_SCREEN_ID, even if the object is invalid.
    114 */
    11579screen_id
    11680BScreen::ID()
    11781{
    BScreen::ID()  
    12488}
    12589
    12690
    127 /*! \brief Blocks until the monitor has finished the current vertical retrace.
    128     \return \c B_OK, or \c B_ERROR if the screen object is invalid.
    129 */
    13091status_t
    13192BScreen::WaitForRetrace()
    13293{
    BScreen::WaitForRetrace()  
    13495}
    13596
    13697
    137 /*! \brief Blocks until the monitor has finished the current vertical retrace,
    138     or until the given timeout has passed.
    139     \param timeout A bigtime_t which indicates the time to wait before
    140         returning.
    141     \return \c B_OK if the monitor has retraced in the given amount of time,
    142         \c B_ERROR otherwise.
    143 */
    14498status_t
    14599BScreen::WaitForRetrace(bigtime_t timeout)
    146100{
    147101    if (fScreen != NULL)
    148102        return fScreen->WaitForRetrace(timeout);
     103
    149104    return B_ERROR;
    150105}
    151106
    152107
    153 /*! \brief Returns the index of the 8-bit color that,
    154         most closely matches the given 32-bit color.
    155     \param r The red value for a 32-bit color.
    156     \param g The green value for a 32-bit color.
    157     \param b The blue value for a 32-bit color.
    158     \param a The alpha value for a 32-bit color.
    159     \return An index for a 8-bit color in the screen's color map.
    160 */
    161108uint8
    162 BScreen::IndexForColor(uint8 r, uint8 g, uint8 b, uint8 a)
     109BScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha)
    163110{
    164111    if (fScreen != NULL)
    165         return fScreen->IndexForColor(r, g, b, a);
     112        return fScreen->IndexForColor(red, green, blue, alpha);
     113
    166114    return 0;
    167115}
    168116
    169117
    170 /*! \brief Returns the 32-bit color representation of a given 8-bit color index.
    171     \param index The 8-bit color index to convert.
    172     \return A rgb_color struct which represents the given 8-bit color index.
    173 */
    174118rgb_color
    175119BScreen::ColorForIndex(const uint8 index)
    176120{
    177121    if (fScreen != NULL)
    178122        return fScreen->ColorForIndex(index);
     123
    179124    return rgb_color();
    180125}
    181126
    182127
    183 /*! \brief Returns the "inversion" of the given 8-bit color.
    184     \param index An 8-bit color index.
    185     \return An 8-bit color index that represents the "inversion" of the given
    186         color.
    187 */
    188128uint8
    189129BScreen::InvertIndex(uint8 index)
    190130{
    191131    if (fScreen != NULL)
    192132        return fScreen->InvertIndex(index);
     133
    193134    return 0;
    194135}
    195136
    196137
    197 /*! \brief Returns the color map of the current display.
    198     \return A pointer to the object's color_map.
    199 */
    200138const color_map*
    201139BScreen::ColorMap()
    202140{
    203141    if (fScreen != NULL)
    204142        return fScreen->ColorMap();
     143
    205144    return NULL;
    206145}
    207146
    208147
    209 /*! \brief Copies the screen's contents into the first argument BBitmap.
    210     \param screen_shot A pointer to a BBitmap pointer, where the function will
    211         allocate a BBitmap for you.
    212     \param draw_cursor Specifies if you want the cursor to be drawn.
    213     \param bound Let you specify the area you want copied. If it's NULL, the
    214         entire screen is copied.
    215     \return \c B_OK if the operation was succesful, \c B_ERROR on failure.
    216 */
    217148status_t
    218 BScreen::GetBitmap(BBitmap** _bitmap, bool drawCursor, BRect* bounds)
     149BScreen::GetBitmap(BBitmap** bitmap, bool drawCursor, BRect* bounds)
    219150{
    220151    if (fScreen != NULL)
    221         return fScreen->GetBitmap(_bitmap, drawCursor, bounds);
     152        return fScreen->GetBitmap(bitmap, drawCursor, bounds);
     153
    222154    return B_ERROR;
    223155}
    224156
    225157
    226 /*! \brief Copies the screen's contents into the first argument BBitmap.
    227     \param screen_shot A pointer to an allocated BBitmap, where the function
    228         will store the screen's content.
    229     \param draw_cursor Specifies if you want the cursor to be drawn.
    230     \param bound Let you specify the area you want copied. If it's NULL, the
    231         entire screen is copied.
    232     \return \c B_OK if the operation was succesful, \c B_ERROR on failure.
    233 
    234     The only difference between this method and GetBitmap() is that ReadBitmap
    235     requires you to allocate a BBitmap, while the latter will allocate a BBitmap
    236     for you.
    237 */
    238158status_t
    239 BScreen::ReadBitmap(BBitmap* buffer, bool drawCursor, BRect* bounds)
     159BScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor, BRect* bounds)
    240160{
    241161    if (fScreen != NULL)
    242         return fScreen->ReadBitmap(buffer, drawCursor, bounds);
     162        return fScreen->ReadBitmap(bitmap, drawCursor, bounds);
     163
    243164    return B_ERROR;
    244165}
    245166
    246167
    247 /*! \brief Returns the color of the desktop.
    248     \return An rgb_color structure which is the color of the desktop.
    249 */
    250168rgb_color
    251169BScreen::DesktopColor()
    252170{
    BScreen::DesktopColor()  
    257175}
    258176
    259177
    260 /*! \brief Returns the color of the desktop in the given workspace.
    261     \param workspace The workspace of which you want to have the color.
    262     \return An rgb_color structure which is the color of the desktop in the
    263         given workspace.
    264 */
    265178rgb_color
    266179BScreen::DesktopColor(uint32 workspace)
    267180{
    BScreen::DesktopColor(uint32 workspace)  
    272185}
    273186
    274187
    275 /*! \brief Set the color of the desktop.
    276     \param rgb The color you want to paint the desktop background.
    277     \param stick If you pass \c true here, the color will be maintained across
    278         boots.
    279 */
    280188void
    281 BScreen::SetDesktopColor(rgb_color rgb, bool stick)
     189BScreen::SetDesktopColor(rgb_color color, bool stick)
    282190{
    283191    if (fScreen != NULL)
    284         fScreen->SetDesktopColor(rgb, B_CURRENT_WORKSPACE_INDEX, stick);
     192        fScreen->SetDesktopColor(color, B_CURRENT_WORKSPACE_INDEX, stick);
    285193}
    286194
    287195
    288 /*! \brief Set the color of the desktop in the given workspace.
    289     \param rgb The color you want to paint the desktop background.
    290     \param index The workspace you want to change the color.
    291     \param stick If you pass \c true here, the color will be maintained across
    292         boots.
    293 */
    294196void
    295 BScreen::SetDesktopColor(rgb_color rgb, uint32 index, bool stick)
     197BScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool stick)
    296198{
    297199    if (fScreen != NULL)
    298         fScreen->SetDesktopColor(rgb, index, stick);
     200        fScreen->SetDesktopColor(color, workspace, stick);
    299201}
    300202
    301203
    302 /*! \brief Attempts to adjust the supplied mode so that it's a supported mode.
    303     \param target The mode you want to be adjusted.
    304     \param low The lower limit you want target to be adjusted.
    305     \param high The higher limit you want target to be adjusted.
    306     \return
    307         - \c B_OK if target (as returned) is supported and falls into the
    308             limits.
    309         - \c B_BAD_VALUE if target (as returned) is supported but doesn't fall
    310             into the limits.
    311         - \c B_ERROR if target isn't supported.
    312 */
    313204status_t
    314205BScreen::ProposeMode(display_mode* target, const display_mode* low,
    315206    const display_mode* high)
    316207{
    317208    if (fScreen != NULL)
    318209        return fScreen->ProposeMode(target, low, high);
     210
    319211    return B_ERROR;
    320212}
    321213
    322214
    323 /*! \brief allocates and returns a list of the display_modes
    324         that the graphics card supports.
    325     \param mode_list A pointer to a mode_list pointer, where the function will
    326         allocate an array of display_mode structures.
    327     \param count A pointer to an integer, where the function will store the
    328         amount of available display modes.
    329     \return \c B_OK.
    330 */
    331215status_t
    332 BScreen::GetModeList(display_mode** _modeList, uint32* _count)
     216BScreen::GetModeList(display_mode** modeList, uint32* count)
    333217{
    334218    if (fScreen != NULL)
    335         return fScreen->GetModeList(_modeList, _count);
     219        return fScreen->GetModeList(modeList, count);
     220
    336221    return B_ERROR;
    337222}
    338223
    339224
    340 /*! \brief Copies the current display_mode into mode.
    341     \param mode A pointer to a display_mode structure,
    342         where the current display_mode will be copied.
    343     \return \c B_OK if the operation was succesful.
    344 */
    345225status_t
    346226BScreen::GetMode(display_mode* mode)
    347227{
    348228    if (fScreen != NULL)
    349229        return fScreen->GetMode(B_CURRENT_WORKSPACE_INDEX, mode);
     230
    350231    return B_ERROR;
    351232}
    352233
    353234
    354 /*! \brief Copies the current display_mode of the given workspace into mode.
    355     \param workspace The index of the workspace to query.
    356     \param mode A pointer to a display_mode structure,
    357         where the current display_mode will be copied.
    358     \return \c B_OK if the operation was succesful.
    359 */
    360235status_t
    361236BScreen::GetMode(uint32 workspace, display_mode* mode)
    362237{
    363238    if (fScreen != NULL)
    364239        return fScreen->GetMode(workspace, mode);
     240
    365241    return B_ERROR;
    366242}
    367243
    368244
    369 /*! \brief Set the screen to the given mode.
    370     \param mode A pointer to a display_mode.
    371     \param makeDefault If true, the mode becomes the default for the screen.
    372     \return \c B_OK.
    373 */
    374245status_t
    375246BScreen::SetMode(display_mode* mode, bool makeDefault)
    376247{
    377248    if (fScreen != NULL)
    378249        return fScreen->SetMode(B_CURRENT_WORKSPACE_INDEX, mode, makeDefault);
     250
    379251    return B_ERROR;
    380252}
    381253
    382254
    383 /*! \brief Set the given workspace to the given mode.
    384     \param workspace The index of the workspace that you want to change.
    385     \param mode A pointer to a display_mode.
    386     \param makeDefault If true, the mode becomes the default for the workspace.
    387     \return \c B_OK.
    388 */
    389255status_t
    390256BScreen::SetMode(uint32 workspace, display_mode* mode, bool makeDefault)
    391257{
    392258    if (fScreen != NULL)
    393259        return fScreen->SetMode(workspace, mode, makeDefault);
     260
    394261    return B_ERROR;
    395262}
    396263
    397264
    398 /*! \brief Returns information about the graphics card.
    399     \param info An accelerant_device_info struct where to store the retrieved
    400         info.
    401     \return \c B_OK if the operation went fine, otherwise an error code.
    402 */
    403265status_t
    404266BScreen::GetDeviceInfo(accelerant_device_info* info)
    405267{
    406268    if (fScreen != NULL)
    407269        return fScreen->GetDeviceInfo(info);
     270
    408271    return B_ERROR;
    409272}
    410273
    BScreen::GetMonitorInfo(monitor_info* info)  
    414277{
    415278    if (fScreen != NULL)
    416279        return fScreen->GetMonitorInfo(info);
     280
    417281    return B_ERROR;
    418282}
    419283
    420284
    421 /*! \brief Returns, in low and high, the minimum and maximum pixel clock rates
    422         that are possible for the given mode.
    423     \param mode A pointer to a display_mode.
    424     \param low A pointer to an int where the function will store the lowest
    425         available pixel clock.
    426     \param high A pointer to an int where the function wills tore the highest
    427         available pixel clock.
    428     \return \c B_OK if the operation went fine, otherwise an error code.
    429 */
    430285status_t
    431 BScreen::GetPixelClockLimits(display_mode* mode, uint32* _low, uint32* _high)
     286BScreen::GetPixelClockLimits(display_mode* mode, uint32* low, uint32* high)
    432287{
    433288    if (fScreen != NULL)
    434         return fScreen->GetPixelClockLimits(mode, _low, _high);
     289        return fScreen->GetPixelClockLimits(mode, low, high);
     290
    435291    return B_ERROR;
    436292}
    437293
    438294
    439 /*! \brief Fills out the dtc structure with the timing constraints of the
    440         current display mode.
    441     \param dtc A pointer to a display_timing_constraints structure where the
    442         function will store the timing constraints of the current mode.
    443     \return \c B_OK if the operation went fine, otherwise an error code.
    444 */
    445295status_t
    446296BScreen::GetTimingConstraints(display_timing_constraints* constraints)
    447297{
    448298    if (fScreen != NULL)
    449299        return fScreen->GetTimingConstraints(constraints);
     300
    450301    return B_ERROR;
    451302}
    452303
    453304
    454 /*! \brief Lets you set the VESA Display Power Management Signaling state for
    455         the screen.
    456     \param dpms_state The DPMS state you want to be set.
    457         valid values are:
    458         - \c B_DPMS_ON
    459         - \c B_DPMS_STAND_BY
    460         - \c B_DPMS_SUSPEND
    461         - \c B_DPMS_OFF
    462     \return \c B_OK if the operation went fine, otherwise an error code.
    463 */
    464305status_t
    465306BScreen::SetDPMS(uint32 dpmsState)
    466307{
    467308    if (fScreen != NULL)
    468309        return fScreen->SetDPMS(dpmsState);
     310
    469311    return B_ERROR;
    470312}
    471313
    472314
    473 /*! \brief Returns the current DPMS state of the screen.
    474 */
    475315uint32
    476316BScreen::DPMSState()
    477317{
    478318    if (fScreen != NULL)
    479319        return fScreen->DPMSState();
     320
    480321    return 0;
    481322}
    482323
    483324
    484 /*! \brief Indicates which DPMS modes the monitor supports.
    485 */
    486325uint32
    487326BScreen::DPMSCapabilites()
    488327{
    489328    if (fScreen != NULL)
    490329        return fScreen->DPMSCapabilites();
     330
    491331    return 0;
    492332}
    493333
    BScreen::DPMSCapabilites()  
    495335//  #pragma mark - Deprecated methods
    496336
    497337
    498 /*! \brief Returns the BPrivateScreen used by the BScreen object.
    499     \return A pointer to the BPrivateScreen class internally used by the BScreen
    500         object.
    501 */
    502338BPrivate::BPrivateScreen*
    503339BScreen::private_screen()
    504340{
    BScreen::private_screen()  
    506342}
    507343
    508344
    509 /*! \brief Deprecated, use ProposeMode() instead.
    510 */
    511345status_t
    512346BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low,
    513347    const display_mode* high)
    BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low,  
    516350}
    517351
    518352
    519 /*! \brief Returns the base address of the framebuffer.
    520 */
    521353void*
    522354BScreen::BaseAddress()
    523355{
    524356    if (fScreen != NULL)
    525357        return fScreen->BaseAddress();
     358
    526359    return NULL;
    527360}
    528361
    529362
    530 /*! \brief Returns the amount of bytes per row of the framebuffer.
    531 */
    532363uint32
    533364BScreen::BytesPerRow()
    534365{
    535366    if (fScreen != NULL)
    536367        return fScreen->BytesPerRow();
     368
    537369    return 0;
    538370}