mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182665 - Adjust tile sizes depending on the screen size r=nical
This commit is contained in:
parent
8d409dfc36
commit
a0e96ceae4
@ -169,6 +169,10 @@ ScreenManagerParent::RecvScreenForBrowser(const TabId& aTabId,
|
||||
bool
|
||||
ScreenManagerParent::ExtractScreenDetails(nsIScreen* aScreen, ScreenDetails &aDetails)
|
||||
{
|
||||
if (!aScreen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
nsresult rv = aScreen->GetId(&id);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "gfxGraphiteShaper.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxGradientCache.h"
|
||||
#include "gfxUtils.h" // for NextPowerOfTwo
|
||||
|
||||
#include "nsUnicodeRange.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@ -387,6 +388,7 @@ gfxPlatform::gfxPlatform()
|
||||
, mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
|
||||
, mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo)
|
||||
, mCompositorBackend(layers::LayersBackend::LAYERS_NONE)
|
||||
, mScreenDepth(0)
|
||||
{
|
||||
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
|
||||
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
|
||||
@ -1014,42 +1016,25 @@ gfxPlatform::ComputeTileSize()
|
||||
int32_t w = gfxPrefs::LayersTileWidth();
|
||||
int32_t h = gfxPrefs::LayersTileHeight();
|
||||
|
||||
// TODO We may want to take the screen size into consideration here.
|
||||
if (gfxPrefs::LayersTilesAdjust()) {
|
||||
gfx::IntSize screenSize = GetScreenSize();
|
||||
if (screenSize.width > 0) {
|
||||
w = h = std::max(std::min(NextPowerOfTwo(screenSize.width) / 2, 1024), 256);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
int32_t format = android::PIXEL_FORMAT_RGBA_8888;
|
||||
android::sp<android::GraphicBuffer> alloc =
|
||||
new android::GraphicBuffer(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight(),
|
||||
format,
|
||||
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
|
||||
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
|
||||
android::GraphicBuffer::USAGE_HW_TEXTURE);
|
||||
new android::GraphicBuffer(w, h, android::PIXEL_FORMAT_RGBA_8888,
|
||||
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
|
||||
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
|
||||
android::GraphicBuffer::USAGE_HW_TEXTURE);
|
||||
|
||||
if (alloc.get()) {
|
||||
w = alloc->getStride(); // We want the tiles to be gralloc stride aligned.
|
||||
// No need to adjust the height here.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Use double sized tiles for HiDPI screens.
|
||||
nsCOMPtr<nsIScreenManager> screenManager =
|
||||
do_GetService("@mozilla.org/gfx/screenmanager;1");
|
||||
if (screenManager) {
|
||||
nsCOMPtr<nsIScreen> primaryScreen;
|
||||
screenManager->GetPrimaryScreen(getter_AddRefs(primaryScreen));
|
||||
double scaleFactor = 1.0;
|
||||
if (primaryScreen) {
|
||||
primaryScreen->GetContentsScaleFactor(&scaleFactor);
|
||||
}
|
||||
if (scaleFactor > 1.0) {
|
||||
w *= 2;
|
||||
h *= 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SetTileSize(w, h);
|
||||
}
|
||||
|
||||
@ -1061,7 +1046,10 @@ gfxPlatform::PopulateScreenInfo()
|
||||
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
manager->GetPrimaryScreen(getter_AddRefs(screen));
|
||||
MOZ_ASSERT(screen, "failed to get primary screen");
|
||||
if (!screen) {
|
||||
// This can happen in xpcshell, for instance
|
||||
return;
|
||||
}
|
||||
|
||||
screen->GetColorDepth(&mScreenDepth);
|
||||
|
||||
|
@ -2676,12 +2676,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapForJNI
|
||||
static Rect getScreenSize() {
|
||||
DisplayManager dm = (DisplayManager)getContext().getSystemService(Context.DISPLAY_SERVICE);
|
||||
if (dm == null) {
|
||||
return new Rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
Display disp = dm.getDisplay(Display.DEFAULT_DISPLAY);
|
||||
Display disp = getGeckoInterface().getActivity().getWindowManager().getDefaultDisplay();
|
||||
return new Rect(0, 0, disp.getWidth(), disp.getHeight());
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,11 @@ nsScreenManagerGtk :: EnsureInit()
|
||||
return NS_OK;
|
||||
|
||||
mRootWindow = gdk_get_default_root_window();
|
||||
if (!mRootWindow) {
|
||||
// Sometimes we don't initial X (e.g., xpcshell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
g_object_ref(mRootWindow);
|
||||
|
||||
// GDK_PROPERTY_CHANGE_MASK ==> PropertyChangeMask, for PropertyNotify
|
||||
|
Loading…
Reference in New Issue
Block a user