* added ProfileMessageSupport.h/cpp to translate server message codes to
a string * fixed profiling of message processsing in ServerWindow (didn't take batch processing into account) * accelerated ViewLayer::RebuildClipping() by a factor of two by avoiding BRegion::Exclude(clipping_rect) for each child, and instead building one region with all children, and excluding that. RebuildClipping() is quite a common operation and is quite slow for views with many children git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21646 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0379077f09
commit
67f3be42b0
@ -2248,15 +2248,7 @@ BView::GetClippingRegion(BRegion* region) const
|
||||
int32 code;
|
||||
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
||||
&& code == B_OK) {
|
||||
int32 count;
|
||||
fOwner->fLink->Read<int32>(&count);
|
||||
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
BRect rect;
|
||||
fOwner->fLink->Read<BRect>(&rect);
|
||||
|
||||
region->Include(rect);
|
||||
}
|
||||
fOwner->fLink->ReadRegion(region);
|
||||
fState->valid_flags |= B_VIEW_CLIP_REGION_BIT;
|
||||
}
|
||||
}
|
||||
@ -2273,8 +2265,7 @@ BView::ConstrainClippingRegion(BRegion* region)
|
||||
if (region) {
|
||||
int32 count = region->CountRects();
|
||||
fOwner->fLink->Attach<int32>(count);
|
||||
for (int32 i = 0; i < count; i++)
|
||||
fOwner->fLink->Attach<clipping_rect>(region->RectAtInt(i));
|
||||
fOwner->fLink->AttachRegion(*region);
|
||||
} else {
|
||||
fOwner->fLink->Attach<int32>(-1);
|
||||
// '-1' means that in the app_server, there won't be any 'local'
|
||||
@ -3318,21 +3309,15 @@ BView::Invalidate(BRect invalRect)
|
||||
|
||||
|
||||
void
|
||||
BView::Invalidate(const BRegion *invalRegion)
|
||||
BView::Invalidate(const BRegion* region)
|
||||
{
|
||||
if (invalRegion == NULL || fOwner == NULL)
|
||||
if (region == NULL || fOwner == NULL)
|
||||
return;
|
||||
|
||||
check_lock();
|
||||
|
||||
int32 count = 0;
|
||||
count = const_cast<BRegion*>(invalRegion)->CountRects();
|
||||
|
||||
fOwner->fLink->StartMessage(AS_LAYER_INVALIDATE_REGION);
|
||||
fOwner->fLink->Attach<int32>(count);
|
||||
|
||||
for (int32 i = 0; i < count; i++)
|
||||
fOwner->fLink->Attach<BRect>( const_cast<BRegion *>(invalRegion)->RectAt(i));
|
||||
fOwner->fLink->AttachRegion(*region);
|
||||
|
||||
fOwner->fLink->Flush();
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ Server app_server :
|
||||
OffscreenServerWindow.cpp
|
||||
OffscreenWindowLayer.cpp
|
||||
PNGDump.cpp
|
||||
ProfileMessageSupport.cpp
|
||||
RAMLinkMsgReader.cpp
|
||||
RGBColor.cpp
|
||||
RegionPool.cpp
|
||||
|
286
src/servers/app/ProfileMessageSupport.cpp
Normal file
286
src/servers/app/ProfileMessageSupport.cpp
Normal file
@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright 2007: string = ""; break; Haiku: string = ""; break; Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
|
||||
#include "ProfileMessageSupport.h"
|
||||
|
||||
#include "ServerProtocol.h"
|
||||
|
||||
|
||||
void
|
||||
string_for_message_code(uint32 code, BString& string)
|
||||
{
|
||||
string = "";
|
||||
|
||||
switch (code) {
|
||||
case AS_GET_DESKTOP: string = "AS_GET_DESKTOP"; break;
|
||||
case AS_REGISTER_INPUT_SERVER: string = "AS_REGISTER_INPUT_SERVER"; break;
|
||||
case AS_EVENT_STREAM_CLOSED: string = "AS_EVENT_STREAM_CLOSED"; break;
|
||||
|
||||
// Desktop definitions (through the ServerApp, though)
|
||||
case AS_GET_WINDOW_LIST: string = "AS_GET_WINDOW_LIST"; break;
|
||||
case AS_GET_WINDOW_INFO: string = "AS_GET_WINDOW_INFO"; break;
|
||||
case AS_MINIMIZE_TEAM: string = "AS_MINIMIZE_TEAM"; break;
|
||||
case AS_BRING_TEAM_TO_FRONT: string = "AS_BRING_TEAM_TO_FRONT"; break;
|
||||
case AS_WINDOW_ACTION: string = "AS_WINDOW_ACTION"; break;
|
||||
|
||||
// Application definitions
|
||||
case AS_CREATE_APP: string = "AS_CREATE_APP"; break;
|
||||
case AS_DELETE_APP: string = "AS_DELETE_APP"; break;
|
||||
case AS_QUIT_APP: string = "AS_QUIT_APP"; break;
|
||||
case AS_ACTIVATE_APP: string = "AS_ACTIVATE_APP"; break;
|
||||
case AS_APP_CRASHED: string = "AS_APP_CRASHED"; break;
|
||||
|
||||
case AS_CREATE_WINDOW: string = "AS_CREATE_WINDOW"; break;
|
||||
case AS_CREATE_OFFSCREEN_WINDOW: string = "AS_CREATE_OFFSCREEN_WINDOW"; break;
|
||||
case AS_DELETE_WINDOW: string = "AS_DELETE_WINDOW"; break;
|
||||
case AS_CREATE_BITMAP: string = "AS_CREATE_BITMAP"; break;
|
||||
case AS_DELETE_BITMAP: string = "AS_DELETE_BITMAP"; break;
|
||||
case AS_GET_BITMAP_OVERLAY_RESTRICTIONS: string = "AS_GET_BITMAP_OVERLAY_RESTRICTIONS"; break;
|
||||
|
||||
// Cursor commands
|
||||
case AS_SET_CURSOR: string = "AS_SET_CURSOR"; break;
|
||||
|
||||
case AS_SHOW_CURSOR: string = "AS_SHOW_CURSOR"; break;
|
||||
case AS_HIDE_CURSOR: string = "AS_HIDE_CURSOR"; break;
|
||||
case AS_OBSCURE_CURSOR: string = "AS_OBSCURE_CURSOR"; break;
|
||||
case AS_QUERY_CURSOR_HIDDEN: string = "AS_QUERY_CURSOR_HIDDEN"; break;
|
||||
|
||||
case AS_CREATE_CURSOR: string = "AS_CREATE_CURSOR"; break;
|
||||
case AS_DELETE_CURSOR: string = "AS_DELETE_CURSOR"; break;
|
||||
|
||||
case AS_BEGIN_RECT_TRACKING: string = "AS_BEGIN_RECT_TRACKING"; break;
|
||||
case AS_END_RECT_TRACKING: string = "AS_END_RECT_TRACKING"; break;
|
||||
|
||||
// Window definitions
|
||||
case AS_SHOW_WINDOW: string = "AS_SHOW_WINDOW"; break;
|
||||
case AS_HIDE_WINDOW: string = "AS_HIDE_WINDOW"; break;
|
||||
case AS_MINIMIZE_WINDOW: string = "AS_MINIMIZE_WINDOW"; break;
|
||||
case AS_QUIT_WINDOW: string = "AS_QUIT_WINDOW"; break;
|
||||
case AS_SEND_BEHIND: string = "AS_SEND_BEHIND"; break;
|
||||
case AS_SET_LOOK: string = "AS_SET_LOOK"; break;
|
||||
case AS_SET_FEEL: string = "AS_SET_FEEL"; break;
|
||||
case AS_SET_FLAGS: string = "AS_SET_FLAGS"; break;
|
||||
case AS_DISABLE_UPDATES: string = "AS_DISABLE_UPDATES"; break;
|
||||
case AS_ENABLE_UPDATES: string = "AS_ENABLE_UPDATES"; break;
|
||||
case AS_BEGIN_UPDATE: string = "AS_BEGIN_UPDATE"; break;
|
||||
case AS_END_UPDATE: string = "AS_END_UPDATE"; break;
|
||||
case AS_NEEDS_UPDATE: string = "AS_NEEDS_UPDATE"; break;
|
||||
case AS_SET_WINDOW_TITLE: string = "AS_SET_WINDOW_TITLE"; break;
|
||||
case AS_ADD_TO_SUBSET: string = "AS_ADD_TO_SUBSET"; break;
|
||||
case AS_REMOVE_FROM_SUBSET: string = "AS_REMOVE_FROM_SUBSET"; break;
|
||||
case AS_SET_ALIGNMENT: string = "AS_SET_ALIGNMENT"; break;
|
||||
case AS_GET_ALIGNMENT: string = "AS_GET_ALIGNMENT"; break;
|
||||
case AS_GET_WORKSPACES: string = "AS_GET_WORKSPACES"; break;
|
||||
case AS_SET_WORKSPACES: string = "AS_SET_WORKSPACES"; break;
|
||||
case AS_WINDOW_RESIZE: string = "AS_WINDOW_RESIZE"; break;
|
||||
case AS_WINDOW_MOVE: string = "AS_WINDOW_MOVE"; break;
|
||||
case AS_SET_SIZE_LIMITS: string = "AS_SET_SIZE_LIMITS"; break;
|
||||
case AS_ACTIVATE_WINDOW: string = "AS_ACTIVATE_WINDOW"; break;
|
||||
case AS_IS_FRONT_WINDOW: string = "AS_IS_FRONT_WINDOW"; break;
|
||||
|
||||
// BPicture definitions
|
||||
case AS_CREATE_PICTURE: string = "AS_CREATE_PICTURE"; break;
|
||||
case AS_DELETE_PICTURE: string = "AS_DELETE_PICTURE"; break;
|
||||
case AS_CLONE_PICTURE: string = "AS_CLONE_PICTURE"; break;
|
||||
case AS_DOWNLOAD_PICTURE: string = "AS_DOWNLOAD_PICTURE"; break;
|
||||
|
||||
// Font-related server communications
|
||||
case AS_SET_SYSTEM_FONT: string = "AS_SET_SYSTEM_FONT"; break;
|
||||
case AS_GET_SYSTEM_FONTS: string = "AS_GET_SYSTEM_FONTS"; break;
|
||||
case AS_GET_SYSTEM_DEFAULT_FONT: string = "AS_GET_SYSTEM_DEFAULT_FONT"; break;
|
||||
|
||||
case AS_GET_FONT_LIST_REVISION: string = "AS_GET_FONT_LIST_REVISION"; break;
|
||||
case AS_GET_FAMILY_AND_STYLES: string = "AS_GET_FAMILY_AND_STYLES"; break;
|
||||
|
||||
case AS_GET_FAMILY_AND_STYLE: string = "AS_GET_FAMILY_AND_STYLE"; break;
|
||||
case AS_GET_FAMILY_AND_STYLE_IDS: string = "AS_GET_FAMILY_AND_STYLE_IDS"; break;
|
||||
case AS_GET_FONT_BOUNDING_BOX: string = "AS_GET_FONT_BOUNDING_BOX"; break;
|
||||
case AS_GET_TUNED_COUNT: string = "AS_GET_TUNED_COUNT"; break;
|
||||
case AS_GET_TUNED_INFO: string = "AS_GET_TUNED_INFO"; break;
|
||||
case AS_GET_FONT_HEIGHT: string = "AS_GET_FONT_HEIGHT"; break;
|
||||
case AS_GET_FONT_FILE_FORMAT: string = "AS_GET_FONT_FILE_FORMAT"; break;
|
||||
case AS_GET_EXTRA_FONT_FLAGS: string = "AS_GET_EXTRA_FONT_FLAGS"; break;
|
||||
|
||||
case AS_GET_STRING_WIDTHS: string = "AS_GET_STRING_WIDTHS"; break;
|
||||
case AS_GET_EDGES: string = "AS_GET_EDGES"; break;
|
||||
case AS_GET_ESCAPEMENTS: string = "AS_GET_ESCAPEMENTS"; break;
|
||||
case AS_GET_ESCAPEMENTS_AS_FLOATS: string = "AS_GET_ESCAPEMENTS_AS_FLOATS"; break;
|
||||
case AS_GET_BOUNDINGBOXES_CHARS: string = "AS_GET_BOUNDINGBOXES_CHARS"; break;
|
||||
case AS_GET_BOUNDINGBOXES_STRINGS: string = "AS_GET_BOUNDINGBOXES_STRINGS"; break;
|
||||
case AS_GET_HAS_GLYPHS: string = "AS_GET_HAS_GLYPHS"; break;
|
||||
case AS_GET_GLYPH_SHAPES: string = "AS_GET_GLYPH_SHAPES"; break;
|
||||
case AS_GET_TRUNCATED_STRINGS: string = "AS_GET_TRUNCATED_STRINGS"; break;
|
||||
|
||||
// Screen methods
|
||||
case AS_VALID_SCREEN_ID: string = "AS_VALID_SCREEN_ID"; break;
|
||||
case AS_GET_NEXT_SCREEN_ID: string = "AS_GET_NEXT_SCREEN_ID"; break;
|
||||
case AS_SCREEN_GET_MODE: string = "AS_SCREEN_GET_MODE"; break;
|
||||
case AS_SCREEN_SET_MODE: string = "AS_SCREEN_SET_MODE"; break;
|
||||
case AS_PROPOSE_MODE: string = "AS_PROPOSE_MODE"; break;
|
||||
case AS_GET_MODE_LIST: string = "AS_GET_MODE_LIST"; break;
|
||||
|
||||
case AS_GET_PIXEL_CLOCK_LIMITS: string = "AS_GET_PIXEL_CLOCK_LIMITS"; break;
|
||||
case AS_GET_TIMING_CONSTRAINTS: string = "AS_GET_TIMING_CONSTRAINTS"; break;
|
||||
|
||||
case AS_SCREEN_GET_COLORMAP: string = "AS_SCREEN_GET_COLORMAP"; break;
|
||||
case AS_GET_DESKTOP_COLOR: string = "AS_GET_DESKTOP_COLOR"; break;
|
||||
case AS_SET_DESKTOP_COLOR: string = "AS_SET_DESKTOP_COLOR"; break;
|
||||
case AS_GET_SCREEN_ID_FROM_WINDOW: string = "AS_GET_SCREEN_ID_FROM_WINDOW"; break;
|
||||
|
||||
case AS_READ_BITMAP: string = "AS_READ_BITMAP"; break;
|
||||
|
||||
case AS_GET_RETRACE_SEMAPHORE: string = "AS_GET_RETRACE_SEMAPHORE"; break;
|
||||
case AS_GET_ACCELERANT_INFO: string = "AS_GET_ACCELERANT_INFO"; break;
|
||||
case AS_GET_FRAME_BUFFER_CONFIG: string = "AS_GET_FRAME_BUFFER_CONFIG"; break;
|
||||
|
||||
case AS_SET_DPMS: string = "AS_SET_DPMS"; break;
|
||||
case AS_GET_DPMS_STATE: string = "AS_GET_DPMS_STATE"; break;
|
||||
case AS_GET_DPMS_CAPABILITIES: string = "AS_GET_DPMS_CAPABILITIES"; break;
|
||||
|
||||
// Misc stuff
|
||||
case AS_GET_ACCELERANT_PATH: string = "AS_GET_ACCELERANT_PATH"; break;
|
||||
case AS_GET_DRIVER_PATH: string = "AS_GET_DRIVER_PATH"; break;
|
||||
|
||||
// Global function call defs
|
||||
case AS_SET_UI_COLORS: string = "AS_SET_UI_COLORS"; break;
|
||||
case AS_SET_UI_COLOR: string = "AS_SET_UI_COLOR"; break;
|
||||
case AS_SET_DECORATOR: string = "AS_SET_DECORATOR"; break;
|
||||
case AS_GET_DECORATOR: string = "AS_GET_DECORATOR"; break;
|
||||
case AS_R5_SET_DECORATOR: string = "AS_R5_SET_DECORATOR"; break;
|
||||
case AS_COUNT_DECORATORS: string = "AS_COUNT_DECORATORS"; break;
|
||||
case AS_GET_DECORATOR_NAME: string = "AS_GET_DECORATOR_NAME"; break;
|
||||
|
||||
case AS_COUNT_WORKSPACES: string = "AS_COUNT_WORKSPACES"; break;
|
||||
case AS_SET_WORKSPACE_COUNT: string = "AS_SET_WORKSPACE_COUNT"; break;
|
||||
case AS_CURRENT_WORKSPACE: string = "AS_CURRENT_WORKSPACE"; break;
|
||||
case AS_ACTIVATE_WORKSPACE: string = "AS_ACTIVATE_WORKSPACE"; break;
|
||||
case AS_GET_SCROLLBAR_INFO: string = "AS_GET_SCROLLBAR_INFO"; break;
|
||||
case AS_SET_SCROLLBAR_INFO: string = "AS_SET_SCROLLBAR_INFO"; break;
|
||||
case AS_GET_MENU_INFO: string = "AS_GET_MENU_INFO"; break;
|
||||
case AS_SET_MENU_INFO: string = "AS_SET_MENU_INFO"; break;
|
||||
case AS_IDLE_TIME: string = "AS_IDLE_TIME"; break;
|
||||
case AS_SET_MOUSE_MODE: string = "AS_SET_MOUSE_MODE"; break;
|
||||
case AS_GET_MOUSE_MODE: string = "AS_GET_MOUSE_MODE"; break;
|
||||
case AS_GET_MOUSE: string = "AS_GET_MOUSE"; break;
|
||||
case AS_SET_DECORATOR_SETTINGS: string = "AS_SET_DECORATOR_SETTINGS"; break;
|
||||
case AS_GET_DECORATOR_SETTINGS: string = "AS_GET_DECORATOR_SETTINGS"; break;
|
||||
case AS_GET_SHOW_ALL_DRAGGERS: string = "AS_GET_SHOW_ALL_DRAGGERS"; break;
|
||||
case AS_SET_SHOW_ALL_DRAGGERS: string = "AS_SET_SHOW_ALL_DRAGGERS"; break;
|
||||
|
||||
// Graphics calls
|
||||
case AS_SET_HIGH_COLOR: string = "AS_SET_HIGH_COLOR"; break;
|
||||
case AS_SET_LOW_COLOR: string = "AS_SET_LOW_COLOR"; break;
|
||||
case AS_SET_VIEW_COLOR: string = "AS_SET_VIEW_COLOR"; break;
|
||||
|
||||
case AS_STROKE_ARC: string = "AS_STROKE_ARC"; break;
|
||||
case AS_STROKE_BEZIER: string = "AS_STROKE_BEZIER"; break;
|
||||
case AS_STROKE_ELLIPSE: string = "AS_STROKE_ELLIPSE"; break;
|
||||
case AS_STROKE_LINE: string = "AS_STROKE_LINE"; break;
|
||||
case AS_STROKE_LINEARRAY: string = "AS_STROKE_LINEARRAY"; break;
|
||||
case AS_STROKE_POLYGON: string = "AS_STROKE_POLYGON"; break;
|
||||
case AS_STROKE_RECT: string = "AS_STROKE_RECT"; break;
|
||||
case AS_STROKE_ROUNDRECT: string = "AS_STROKE_ROUNDRECT"; break;
|
||||
case AS_STROKE_SHAPE: string = "AS_STROKE_SHAPE"; break;
|
||||
case AS_STROKE_TRIANGLE: string = "AS_STROKE_TRIANGLE"; break;
|
||||
|
||||
case AS_FILL_ARC: string = "AS_FILL_ARC"; break;
|
||||
case AS_FILL_BEZIER: string = "AS_FILL_BEZIER"; break;
|
||||
case AS_FILL_ELLIPSE: string = "AS_FILL_ELLIPSE"; break;
|
||||
case AS_FILL_POLYGON: string = "AS_FILL_POLYGON"; break;
|
||||
case AS_FILL_RECT: string = "AS_FILL_RECT"; break;
|
||||
case AS_FILL_REGION: string = "AS_FILL_REGION"; break;
|
||||
case AS_FILL_ROUNDRECT: string = "AS_FILL_ROUNDRECT"; break;
|
||||
case AS_FILL_SHAPE: string = "AS_FILL_SHAPE"; break;
|
||||
case AS_FILL_TRIANGLE: string = "AS_FILL_TRIANGLE"; break;
|
||||
|
||||
case AS_DRAW_STRING: string = "AS_DRAW_STRING"; break;
|
||||
case AS_SET_FONT: string = "AS_SET_FONT"; break;
|
||||
case AS_SET_FONT_SIZE: string = "AS_SET_FONT_SIZE"; break;
|
||||
|
||||
case AS_SYNC: string = "AS_SYNC"; break;
|
||||
|
||||
case AS_LAYER_CREATE: string = "AS_LAYER_CREATE"; break;
|
||||
case AS_LAYER_DELETE: string = "AS_LAYER_DELETE"; break;
|
||||
case AS_LAYER_CREATE_ROOT: string = "AS_LAYER_CREATE_ROOT"; break;
|
||||
case AS_LAYER_SHOW: string = "AS_LAYER_SHOW"; break;
|
||||
case AS_LAYER_HIDE: string = "AS_LAYER_HIDE"; break;
|
||||
case AS_LAYER_MOVE: string = "AS_LAYER_MOVE"; break;
|
||||
case AS_LAYER_RESIZE: string = "AS_LAYER_RESIZE"; break;
|
||||
case AS_LAYER_DRAW: string = "AS_LAYER_DRAW"; break;
|
||||
|
||||
// View/Layer definitions
|
||||
case AS_LAYER_GET_COORD: string = "AS_LAYER_GET_COORD"; break;
|
||||
case AS_LAYER_SET_FLAGS: string = "AS_LAYER_SET_FLAGS"; break;
|
||||
case AS_LAYER_SET_ORIGIN: string = "AS_LAYER_SET_ORIGIN"; break;
|
||||
case AS_LAYER_GET_ORIGIN: string = "AS_LAYER_GET_ORIGIN"; break;
|
||||
case AS_LAYER_RESIZE_MODE: string = "AS_LAYER_RESIZE_MODE"; break;
|
||||
case AS_LAYER_SET_CURSOR: string = "AS_LAYER_SET_CURSOR"; break;
|
||||
case AS_LAYER_BEGIN_RECT_TRACK: string = "AS_LAYER_BEGIN_RECT_TRACK"; break;
|
||||
case AS_LAYER_END_RECT_TRACK: string = "AS_LAYER_END_RECT_TRACK"; break;
|
||||
case AS_LAYER_DRAG_RECT: string = "AS_LAYER_DRAG_RECT"; break;
|
||||
case AS_LAYER_DRAG_IMAGE: string = "AS_LAYER_DRAG_IMAGE"; break;
|
||||
case AS_LAYER_SCROLL: string = "AS_LAYER_SCROLL"; break;
|
||||
case AS_LAYER_SET_LINE_MODE: string = "AS_LAYER_SET_LINE_MODE"; break;
|
||||
case AS_LAYER_GET_LINE_MODE: string = "AS_LAYER_GET_LINE_MODE"; break;
|
||||
case AS_LAYER_PUSH_STATE: string = "AS_LAYER_PUSH_STATE"; break;
|
||||
case AS_LAYER_POP_STATE: string = "AS_LAYER_POP_STATE"; break;
|
||||
case AS_LAYER_SET_SCALE: string = "AS_LAYER_SET_SCALE"; break;
|
||||
case AS_LAYER_GET_SCALE: string = "AS_LAYER_GET_SCALE"; break;
|
||||
case AS_LAYER_SET_DRAWING_MODE: string = "AS_LAYER_SET_DRAWING_MODE"; break;
|
||||
case AS_LAYER_GET_DRAWING_MODE: string = "AS_LAYER_GET_DRAWING_MODE"; break;
|
||||
case AS_LAYER_SET_BLENDING_MODE: string = "AS_LAYER_SET_BLENDING_MODE"; break;
|
||||
case AS_LAYER_GET_BLENDING_MODE: string = "AS_LAYER_GET_BLENDING_MODE"; break;
|
||||
case AS_LAYER_SET_PEN_LOC: string = "AS_LAYER_SET_PEN_LOC"; break;
|
||||
case AS_LAYER_GET_PEN_LOC: string = "AS_LAYER_GET_PEN_LOC"; break;
|
||||
case AS_LAYER_SET_PEN_SIZE: string = "AS_LAYER_SET_PEN_SIZE"; break;
|
||||
case AS_LAYER_GET_PEN_SIZE: string = "AS_LAYER_GET_PEN_SIZE"; break;
|
||||
case AS_LAYER_SET_HIGH_COLOR: string = "AS_LAYER_SET_HIGH_COLOR"; break;
|
||||
case AS_LAYER_SET_LOW_COLOR: string = "AS_LAYER_SET_LOW_COLOR"; break;
|
||||
case AS_LAYER_SET_VIEW_COLOR: string = "AS_LAYER_SET_VIEW_COLOR"; break;
|
||||
case AS_LAYER_GET_HIGH_COLOR: string = "AS_LAYER_GET_HIGH_COLOR"; break;
|
||||
case AS_LAYER_GET_LOW_COLOR: string = "AS_LAYER_GET_LOW_COLOR"; break;
|
||||
case AS_LAYER_GET_VIEW_COLOR: string = "AS_LAYER_GET_VIEW_COLOR"; break;
|
||||
case AS_LAYER_PRINT_ALIASING: string = "AS_LAYER_PRINT_ALIASING"; break;
|
||||
case AS_LAYER_CLIP_TO_PICTURE: string = "AS_LAYER_CLIP_TO_PICTURE"; break;
|
||||
case AS_LAYER_GET_CLIP_REGION: string = "AS_LAYER_GET_CLIP_REGION"; break;
|
||||
case AS_LAYER_DRAW_BITMAP: string = "AS_LAYER_DRAW_BITMAP"; break;
|
||||
case AS_LAYER_SET_EVENT_MASK: string = "AS_LAYER_SET_EVENT_MASK"; break;
|
||||
case AS_LAYER_SET_MOUSE_EVENT_MASK: string = "AS_LAYER_SET_MOUSE_EVENT_MASK"; break;
|
||||
|
||||
case AS_LAYER_DRAW_STRING: string = "AS_LAYER_DRAW_STRING"; break;
|
||||
case AS_LAYER_SET_CLIP_REGION: string = "AS_LAYER_SET_CLIP_REGION"; break;
|
||||
case AS_LAYER_LINE_ARRAY: string = "AS_LAYER_LINE_ARRAY"; break;
|
||||
case AS_LAYER_BEGIN_PICTURE: string = "AS_LAYER_BEGIN_PICTURE"; break;
|
||||
case AS_LAYER_APPEND_TO_PICTURE: string = "AS_LAYER_APPEND_TO_PICTURE"; break;
|
||||
case AS_LAYER_END_PICTURE: string = "AS_LAYER_END_PICTURE"; break;
|
||||
case AS_LAYER_COPY_BITS: string = "AS_LAYER_COPY_BITS"; break;
|
||||
case AS_LAYER_DRAW_PICTURE: string = "AS_LAYER_DRAW_PICTURE"; break;
|
||||
case AS_LAYER_INVALIDATE_RECT: string = "AS_LAYER_INVALIDATE_RECT"; break;
|
||||
case AS_LAYER_INVALIDATE_REGION: string = "AS_LAYER_INVALIDATE_REGION"; break;
|
||||
case AS_LAYER_INVERT_RECT: string = "AS_LAYER_INVERT_RECT"; break;
|
||||
case AS_LAYER_MOVE_TO: string = "AS_LAYER_MOVE_TO"; break;
|
||||
case AS_LAYER_RESIZE_TO: string = "AS_LAYER_RESIZE_TO"; break;
|
||||
case AS_LAYER_SET_STATE: string = "AS_LAYER_SET_STATE"; break;
|
||||
case AS_LAYER_SET_FONT_STATE: string = "AS_LAYER_SET_FONT_STATE"; break;
|
||||
case AS_LAYER_GET_STATE: string = "AS_LAYER_GET_STATE"; break;
|
||||
case AS_LAYER_SET_VIEW_BITMAP: string = "AS_LAYER_SET_VIEW_BITMAP"; break;
|
||||
case AS_LAYER_SET_PATTERN: string = "AS_LAYER_SET_PATTERN"; break;
|
||||
case AS_SET_CURRENT_LAYER: string = "AS_SET_CURRENT_LAYER"; break;
|
||||
|
||||
// BDirectWindow codes
|
||||
case AS_DIRECT_WINDOW_GET_SYNC_DATA: string = "AS_DIRECT_WINDOW_GET_SYNC_DATA"; break;
|
||||
case AS_DIRECT_WINDOW_SET_FULLSCREEN: string = "AS_DIRECT_WINDOW_SET_FULLSCREEN"; break;
|
||||
|
||||
default:
|
||||
string << "unkown code: " << code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
18
src/servers/app/ProfileMessageSupport.h
Normal file
18
src/servers/app/ProfileMessageSupport.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef PROFILE_MESSAGE_SUPPORT_H
|
||||
#define PROFILE_MESSAGE_SUPPORT_H
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
|
||||
void string_for_message_code(uint32 code, BString& string);
|
||||
|
||||
|
||||
#endif // PROFILE_MESSAGE_SUPPORT_H
|
@ -29,6 +29,7 @@
|
||||
#include "DrawingEngine.h"
|
||||
#include "HWInterface.h"
|
||||
#include "Overlay.h"
|
||||
#include "ProfileMessageSupport.h"
|
||||
#include "RAMLinkMsgReader.h"
|
||||
#include "RenderingBuffer.h"
|
||||
#include "ServerApp.h"
|
||||
@ -58,7 +59,7 @@ using std::nothrow;
|
||||
|
||||
//#define TRACE_SERVER_WINDOW
|
||||
//#define TRACE_SERVER_WINDOW_MESSAGES
|
||||
//#define PROFILE_MESSAGE_LOOP
|
||||
#define PROFILE_MESSAGE_LOOP
|
||||
|
||||
|
||||
#ifdef TRACE_SERVER_WINDOW
|
||||
@ -76,7 +77,10 @@ using std::nothrow;
|
||||
#endif
|
||||
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
static struct profile { int32 count; bigtime_t time; } sMessageProfile[AS_LAST_CODE];
|
||||
struct profile { int32 code; int32 count; bigtime_t time; };
|
||||
static profile sMessageProfile[AS_LAST_CODE];
|
||||
static profile sRedrawProcessingTime;
|
||||
//static profile sNextMessageTime;
|
||||
#endif
|
||||
|
||||
|
||||
@ -183,6 +187,20 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
||||
fDeathSemaphore = create_sem(0, "window death");
|
||||
}
|
||||
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
static int
|
||||
compare_message_profiles(const void* _a, const void* _b)
|
||||
{
|
||||
profile* a = (profile*)*(void**)_a;
|
||||
profile* b = (profile*)*(void**)_b;
|
||||
if (a->time < b->time)
|
||||
return 1;
|
||||
if (a->time > b->time)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//! Tears down all connections the main app_server objects, and deletes some internals.
|
||||
ServerWindow::~ServerWindow()
|
||||
@ -210,13 +228,35 @@ ServerWindow::~ServerWindow()
|
||||
delete_sem(fDeathSemaphore);
|
||||
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
BList profiles;
|
||||
for (int32 i = 0; i < AS_LAST_CODE; i++) {
|
||||
if (sMessageProfile[i].count == 0)
|
||||
continue;
|
||||
printf("[%ld] called %ld times, %g secs (%Ld usecs per call)\n",
|
||||
i, sMessageProfile[i].count, sMessageProfile[i].time / 1000000.0,
|
||||
sMessageProfile[i].time / sMessageProfile[i].count);
|
||||
sMessageProfile[i].code = i;
|
||||
profiles.AddItem(&sMessageProfile[i]);
|
||||
}
|
||||
|
||||
profiles.SortItems(compare_message_profiles);
|
||||
|
||||
BString codeName;
|
||||
int32 count = profiles.CountItems();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
profile* p = (profile*)profiles.ItemAtFast(i);
|
||||
string_for_message_code(p->code, codeName);
|
||||
printf("[%s] called %ld times, %g secs (%Ld usecs per call)\n",
|
||||
codeName.String(), p->count, p->time / 1000000.0,
|
||||
p->time / p->count);
|
||||
}
|
||||
if (sRedrawProcessingTime.count > 0) {
|
||||
printf("average redraw processing time: %g secs, count: %ld (%lld usecs per call)\n",
|
||||
sRedrawProcessingTime.time / 1000000.0, sRedrawProcessingTime.count,
|
||||
sRedrawProcessingTime.time / sRedrawProcessingTime.count);
|
||||
}
|
||||
// if (sNextMessageTime.count > 0) {
|
||||
// printf("average NextMessage() time: %g secs, count: %ld (%lld usecs per call)\n",
|
||||
// sNextMessageTime.time / 1000000.0, sNextMessageTime.count,
|
||||
// sNextMessageTime.time / sNextMessageTime.count);
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1711,23 +1751,15 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
||||
|
||||
// if this ViewLayer is hidden, it is clear that its visible region is void.
|
||||
fLink.StartMessage(B_OK);
|
||||
if (fCurrentLayer->IsHidden()) {
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<int32>(0L);
|
||||
fLink.Flush();
|
||||
BRegion empty;
|
||||
fLink.AttachRegion(empty);
|
||||
} else {
|
||||
BRegion drawingRegion = fCurrentLayer->LocalClipping();
|
||||
int32 rectCount = drawingRegion.CountRects();
|
||||
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<int32>(rectCount);
|
||||
|
||||
for (int32 i = 0; i < rectCount; i++) {
|
||||
fLink.Attach<BRect>(drawingRegion.RectAt(i));
|
||||
}
|
||||
|
||||
fLink.Flush();
|
||||
fLink.AttachRegion(drawingRegion);
|
||||
}
|
||||
fLink.Flush();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1741,24 +1773,20 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
// region for the current draw state,
|
||||
// but an *empty* region is actually valid!
|
||||
// even if it means no drawing is allowed
|
||||
BRegion region;
|
||||
if (status == B_OK && rectCount >= 0) {
|
||||
for (int32 i = 0; i < rectCount; i++) {
|
||||
clipping_rect r;
|
||||
status = link.Read<clipping_rect>(&r);
|
||||
if (status < B_OK)
|
||||
break;
|
||||
// TODO: optimize (use AttachRegion()+ReadRegion())
|
||||
region.Include(r);
|
||||
}
|
||||
} else
|
||||
status = B_ERROR;
|
||||
|
||||
if (status == B_OK) {
|
||||
if (status < B_OK)
|
||||
break;
|
||||
|
||||
if (rectCount >= 0) {
|
||||
// we are supposed to set the clipping region
|
||||
BRegion region;
|
||||
if (link.ReadRegion(®ion) < B_OK)
|
||||
break;
|
||||
fCurrentLayer->SetUserClipping(®ion);
|
||||
} else {
|
||||
// passing NULL sets this states region
|
||||
// to that of the previous state
|
||||
// we are supposed to unset the clipping region
|
||||
// passing NULL sets this states region to that
|
||||
// of the previous state
|
||||
fCurrentLayer->SetUserClipping(NULL);
|
||||
}
|
||||
|
||||
@ -1784,18 +1812,11 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
|
||||
// NOTE: looks like this call is NOT affected by origin and scale on R5
|
||||
// so this implementation is "correct"
|
||||
BRegion dirty;
|
||||
int32 rectCount;
|
||||
BRect rect;
|
||||
BRegion region;
|
||||
if (link.ReadRegion(®ion) < B_OK)
|
||||
break;
|
||||
|
||||
link.Read<int32>(&rectCount);
|
||||
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
link.Read<BRect>(&rect);
|
||||
dirty.Include(rect);
|
||||
}
|
||||
|
||||
fWindowLayer->InvalidateView(fCurrentLayer, dirty);
|
||||
fWindowLayer->InvalidateView(fCurrentLayer, region);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2677,14 +2698,32 @@ ServerWindow::_MessageLooper()
|
||||
lockedDesktop = true;
|
||||
}
|
||||
|
||||
if (atomic_and(&fRedrawRequested, 0) != 0)
|
||||
if (atomic_and(&fRedrawRequested, 0) != 0) {
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
bigtime_t redrawStart = system_time();
|
||||
#endif
|
||||
fWindowLayer->RedrawDirtyRegion();
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
diff = system_time() - redrawStart;
|
||||
atomic_add(&sRedrawProcessingTime.count, 1);
|
||||
# ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||
atomic_add64(&sRedrawProcessingTime.time, diff);
|
||||
# else
|
||||
sRedrawProcessingTime.time += diff;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
bigtime_t dispatchStart = system_time();
|
||||
#endif
|
||||
_DispatchMessage(code, receiver);
|
||||
|
||||
#ifdef PROFILE_MESSAGE_LOOP
|
||||
if (code >= 0 && code < AS_LAST_CODE) {
|
||||
diff = system_time() - start;
|
||||
diff = system_time() - dispatchStart;
|
||||
atomic_add(&sMessageProfile[code].count, 1);
|
||||
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||
atomic_add64(&sMessageProfile[code].time, diff);
|
||||
@ -2702,6 +2741,7 @@ ServerWindow::_MessageLooper()
|
||||
break;
|
||||
}
|
||||
|
||||
// next message
|
||||
status_t status = receiver.GetNextMessage(code);
|
||||
if (status < B_OK) {
|
||||
// that shouldn't happen, it's our port
|
||||
|
@ -1460,13 +1460,22 @@ ViewLayer::RebuildClipping(bool deep)
|
||||
// the clipping spans over the bounds area
|
||||
fLocalClipping.Set((clipping_rect)Bounds());
|
||||
|
||||
// exclude all childs from the clipping
|
||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
||||
if (child->IsVisible())
|
||||
fLocalClipping.Exclude((clipping_rect)child->Frame());
|
||||
|
||||
if (deep)
|
||||
child->RebuildClipping(deep);
|
||||
if (ViewLayer* child = FirstChild()) {
|
||||
BRegion* childrenRegion = fWindow->GetRegion();
|
||||
if (!childrenRegion)
|
||||
return;
|
||||
|
||||
// exclude all children from the clipping
|
||||
for (; child; child = child->NextSibling()) {
|
||||
if (child->IsVisible())
|
||||
childrenRegion->Include((clipping_rect)child->Frame());
|
||||
|
||||
if (deep)
|
||||
child->RebuildClipping(deep);
|
||||
}
|
||||
|
||||
fLocalClipping.Exclude(childrenRegion);
|
||||
fWindow->RecycleRegion(childrenRegion);
|
||||
}
|
||||
|
||||
// add the user clipping in case there is one
|
||||
|
@ -246,6 +246,8 @@ Painter::ConstrainClipping(const BRegion* region)
|
||||
void
|
||||
Painter::SetHighColor(const rgb_color& color)
|
||||
{
|
||||
if (fPatternHandler->HighColor().GetColor32() == color)
|
||||
return;
|
||||
fPatternHandler->SetHighColor(color);
|
||||
if (*(fPatternHandler->GetR5Pattern()) == B_SOLID_HIGH)
|
||||
_SetRendererColor(color);
|
||||
@ -1254,7 +1256,6 @@ Painter::_SetRendererColor(const rgb_color& color) const
|
||||
// color.green / 255.0,
|
||||
// color.blue / 255.0,
|
||||
// color.alpha / 255.0));
|
||||
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
@ -92,11 +92,12 @@ Server haiku_app_server :
|
||||
# Misc. Sources
|
||||
Decorator.cpp
|
||||
DebugInfoManager.cpp
|
||||
PNGDump.cpp
|
||||
RAMLinkMsgReader.cpp
|
||||
MessageLooper.cpp
|
||||
ProfileMessageSupport.cpp
|
||||
EventDispatcher.cpp
|
||||
EventStream.cpp
|
||||
MessageLooper.cpp
|
||||
PNGDump.cpp
|
||||
RAMLinkMsgReader.cpp
|
||||
|
||||
# Manager Classes
|
||||
BitmapManager.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user