Android. Exact dpi calculation.

This commit is contained in:
Vladimir Byko-Ianko 2015-11-13 15:37:16 +03:00
parent d806e2e60d
commit f87efd439b
2 changed files with 7 additions and 4 deletions

View file

@ -150,6 +150,7 @@ namespace android
}
params.m_density = dens[bestRangeIndex].second;
params.m_exactDensityDPI = densityDpi;
}
bool Framework::InitRenderPolicyImpl(int densityDpi, int screenWidth, int screenHeight)
@ -158,6 +159,7 @@ namespace android
rmParams.m_videoMemoryLimit = 30 * 1024 * 1024;
rmParams.m_texFormat = graphics::Data4Bpp;
rmParams.m_exactDensityDPI = densityDpi;
RenderPolicy::Params rpParams;

View file

@ -76,10 +76,11 @@ public abstract class NvEventQueueFragment extends BaseMwmFragment implements Vi
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
final DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
mDisplayDensity = metrics.densityDpi;
final DisplayMetrics dm = getActivity().getResources().getDisplayMetrics();
final float exactDensityDpi = (dm.xdpi + dm.ydpi) / 2;
mDisplayDensity = (int)exactDensityDpi;
mIsNativeLaunched = true;
onCreateNative();
if (getActivity().isChangingConfigurations())