mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Mac: Add off-screen rendering support (issue #518).
- Build with the 10.7 SDK (set GYP_DEFINES='mac_sdk=10.7') to include Retina support in the cefclient OSR example. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1226 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -120,6 +120,8 @@ struct CefWindowInfoTraits {
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->hidden = src->hidden;
|
||||
target->transparent_painting = src->transparent_painting;
|
||||
target->window_rendering_disabled = src->window_rendering_disabled;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -141,6 +143,15 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
this->height = height;
|
||||
hidden = false;
|
||||
}
|
||||
|
||||
void SetTransparentPainting(bool transparentPainting) {
|
||||
transparent_painting = transparentPainting;
|
||||
}
|
||||
|
||||
void SetAsOffScreen(NSView* view) {
|
||||
window_rendering_disabled = true;
|
||||
parent_view = view;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OS_MACOSX
|
||||
|
@@ -966,6 +966,62 @@ enum cef_jsdialog_type_t {
|
||||
JSDIALOGTYPE_PROMPT,
|
||||
};
|
||||
|
||||
///
|
||||
// Screen information used when window rendering is disabled. This structure is
|
||||
// passed as a parameter to CefRenderHandler::GetScreenInfo and should be filled
|
||||
// in by the client.
|
||||
///
|
||||
typedef struct _cef_screen_info_t {
|
||||
///
|
||||
// Device scale factor. Specifies the ratio between physical and logical
|
||||
// pixels.
|
||||
///
|
||||
float device_scale_factor;
|
||||
|
||||
///
|
||||
// The screen depth in bits per pixel.
|
||||
///
|
||||
int depth;
|
||||
|
||||
///
|
||||
// The bits per color component. This assumes that the colors are balanced
|
||||
// equally.
|
||||
///
|
||||
int depth_per_component;
|
||||
|
||||
///
|
||||
// This can be true for black and white printers.
|
||||
///
|
||||
bool is_monochrome;
|
||||
|
||||
///
|
||||
// This is set from the rcMonitor member of MONITORINFOEX, to whit:
|
||||
// "A RECT structure that specifies the display monitor rectangle,
|
||||
// expressed in virtual-screen coordinates. Note that if the monitor
|
||||
// is not the primary display monitor, some of the rectangle's
|
||||
// coordinates may be negative values."
|
||||
//
|
||||
// The |rect| and |available_rect| properties are used to determine the
|
||||
// available surface for rendering popup views.
|
||||
///
|
||||
cef_rect_t rect;
|
||||
|
||||
///
|
||||
// This is set from the rcWork member of MONITORINFOEX, to whit:
|
||||
// "A RECT structure that specifies the work area rectangle of the
|
||||
// display monitor that can be used by applications, expressed in
|
||||
// virtual-screen coordinates. Windows uses this rectangle to
|
||||
// maximize an application on the monitor. The rest of the area in
|
||||
// rcMonitor contains system windows such as the task bar and side
|
||||
// bars. Note that if the monitor is not the primary display monitor,
|
||||
// some of the rectangle's coordinates may be negative values".
|
||||
//
|
||||
// The |rect| and |available_rect| properties are used to determine the
|
||||
// available surface for rendering popup views.
|
||||
///
|
||||
cef_rect_t available_rect;
|
||||
} cef_screen_info_t;
|
||||
|
||||
///
|
||||
// Supported menu IDs. Non-English translations can be provided for the
|
||||
// IDS_MENU_* strings in CefResourceBundleHandler::GetLocalizedString().
|
||||
|
@@ -83,6 +83,14 @@ typedef struct _cef_window_info_t {
|
||||
// NSView pointer for the parent view.
|
||||
cef_window_handle_t parent_view;
|
||||
|
||||
// If window rendering is disabled no browser window will be created. Set
|
||||
// |parent_view| to the window that will act as the parent for popup menus,
|
||||
// dialog boxes, etc.
|
||||
bool window_rendering_disabled;
|
||||
|
||||
// Set to true to enable transparent painting.
|
||||
bool transparent_painting;
|
||||
|
||||
// NSView pointer for the new browser view.
|
||||
cef_window_handle_t view;
|
||||
} cef_window_info_t;
|
||||
|
@@ -174,6 +174,60 @@ inline bool operator!=(const CefRect& a, const CefRect& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
struct CefScreenInfoTraits {
|
||||
typedef cef_screen_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target,
|
||||
bool copy) {
|
||||
target->device_scale_factor = src->device_scale_factor;
|
||||
target->depth = src->depth;
|
||||
target->depth_per_component = src->depth_per_component;
|
||||
target->is_monochrome = src->is_monochrome;
|
||||
target->rect = src->rect;
|
||||
target->available_rect = src->available_rect;
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing the virtual screen information for use when window rendering
|
||||
// is disabled.
|
||||
///
|
||||
class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
|
||||
public:
|
||||
typedef CefStructBase<CefScreenInfoTraits> parent;
|
||||
|
||||
CefScreenInfo() : parent() {}
|
||||
CefScreenInfo(const cef_screen_info_t& r) : parent(r) {} // NOLINT(runtime/explicit)
|
||||
CefScreenInfo(const CefScreenInfo& r) : parent(r) {} // NOLINT(runtime/explicit)
|
||||
CefScreenInfo(float device_scale_factor,
|
||||
int depth,
|
||||
int depth_per_component,
|
||||
bool is_monochrome,
|
||||
const CefRect& rect,
|
||||
const CefRect& available_rect) : parent() {
|
||||
Set(device_scale_factor, depth, depth_per_component,
|
||||
is_monochrome, rect, available_rect);
|
||||
}
|
||||
|
||||
void Set(float device_scale_factor,
|
||||
int depth,
|
||||
int depth_per_component,
|
||||
bool is_monochrome,
|
||||
const CefRect& rect,
|
||||
const CefRect& available_rect) {
|
||||
this->device_scale_factor = device_scale_factor;
|
||||
this->depth = depth;
|
||||
this->depth_per_component = depth_per_component;
|
||||
this->is_monochrome = is_monochrome;
|
||||
this->rect = rect;
|
||||
this->available_rect = available_rect;
|
||||
}
|
||||
};
|
||||
|
||||
struct CefKeyEventTraits {
|
||||
typedef cef_key_event_t struct_type;
|
||||
|
||||
|
Reference in New Issue
Block a user