mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add screen pixel to screen DIP conversion methods.
On Windows these new CefDisplay methods convert between screen pixel coordinates and screen DIP coordinates. On macOS and Linux these methods just return a copy of the input coordinates.
This commit is contained in:
committed by
Marshall Greenblatt
parent
fa643b269e
commit
485f0b9caf
@@ -51,6 +51,30 @@ void CefDisplay::GetAllDisplays(std::vector<CefRefPtr<CefDisplay>>& displays) {
|
||||
displays.push_back(new CefDisplayImpl(vec[i]));
|
||||
}
|
||||
|
||||
// static
|
||||
CefPoint CefDisplay::ConvertScreenPointToPixels(const CefPoint& point) {
|
||||
CEF_REQUIRE_UIT_RETURN(CefPoint());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
const gfx::Point pix_point =
|
||||
view_util::ConvertPointToPixels(gfx::Point(point.x, point.y));
|
||||
return CefPoint(pix_point.x(), pix_point.y());
|
||||
#else
|
||||
return point;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
CefPoint CefDisplay::ConvertScreenPointFromPixels(const CefPoint& point) {
|
||||
CEF_REQUIRE_UIT_RETURN(CefPoint());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
const gfx::Point dip_point =
|
||||
view_util::ConvertPointFromPixels(gfx::Point(point.x, point.y));
|
||||
return CefPoint(dip_point.x(), dip_point.y());
|
||||
#else
|
||||
return point;
|
||||
#endif
|
||||
}
|
||||
|
||||
CefDisplayImpl::CefDisplayImpl(const display::Display& display)
|
||||
: display_(display) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
Reference in New Issue
Block a user