Bug 1224482 (part 6) - Change nsScreenGonk::m{Virtual,Natural}Bounds to LayoutDevcieIntRect. r=kats.

This commit is contained in:
Nicholas Nethercote 2015-11-13 01:37:02 -08:00
parent 49db2e3321
commit 989819b3ac
3 changed files with 16 additions and 15 deletions

View File

@ -202,7 +202,7 @@ nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop,
return NS_OK;
}
nsIntRect
LayoutDeviceIntRect
nsScreenGonk::GetRect()
{
return mVirtualBounds;
@ -271,9 +271,9 @@ nsScreenGonk::SetRotation(uint32_t aRotation)
uint32_t rotation = EffectiveScreenRotation();
if (rotation == nsIScreen::ROTATION_90_DEG ||
rotation == nsIScreen::ROTATION_270_DEG) {
mVirtualBounds = nsIntRect(0, 0,
mNaturalBounds.height,
mNaturalBounds.width);
mVirtualBounds = LayoutDeviceIntRect(0, 0,
mNaturalBounds.height,
mNaturalBounds.width);
} else {
mVirtualBounds = mNaturalBounds;
}
@ -292,7 +292,7 @@ nsScreenGonk::SetRotation(uint32_t aRotation)
LayoutDeviceIntRect
nsScreenGonk::GetNaturalBounds()
{
return LayoutDeviceIntRect::FromUnknownRect(mNaturalBounds);
return mNaturalBounds;
}
uint32_t
@ -304,7 +304,7 @@ nsScreenGonk::EffectiveScreenRotation()
// NB: This isn't gonk-specific, but gonk is the only widget backend
// that does this calculation itself, currently.
static ScreenOrientationInternal
ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
ComputeOrientation(uint32_t aRotation, const LayoutDeviceIntSize& aScreenSize)
{
bool naturallyPortrait = (aScreenSize.height > aScreenSize.width);
switch (aRotation) {
@ -338,12 +338,12 @@ RotationToAngle(uint32_t aRotation)
ScreenConfiguration
nsScreenGonk::GetConfiguration()
{
ScreenOrientationInternal orientation = ComputeOrientation(mScreenRotation,
mNaturalBounds.Size());
ScreenOrientationInternal orientation =
ComputeOrientation(mScreenRotation, mNaturalBounds.Size());
// NB: perpetuating colorDepth == pixelDepth illusion here, for
// consistency.
return ScreenConfiguration(mVirtualBounds, orientation,
return ScreenConfiguration(mVirtualBounds.ToUnknownRect(), orientation,
RotationToAngle(mScreenRotation),
mColorDepth, mColorDepth);
}
@ -480,7 +480,7 @@ nsScreenGonk::EnableMirroring()
nsWidgetInitData initData;
initData.mScreenId = mId;
RefPtr<nsWindow> window = new nsWindow();
window->Create(nullptr, nullptr, mNaturalBounds, &initData);
window->Create(nullptr, nullptr, mNaturalBounds.ToUnknownRect(), &initData);
MOZ_ASSERT(static_cast<nsWindow*>(window)->GetScreen() == this);
// Update mMirroringWidget on compositor thread

View File

@ -53,6 +53,7 @@ class nsScreenGonk : public nsBaseScreen
{
typedef mozilla::hal::ScreenConfiguration ScreenConfiguration;
typedef mozilla::GonkDisplay GonkDisplay;
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
public:
nsScreenGonk(uint32_t aId,
@ -72,11 +73,11 @@ public:
uint32_t GetId();
NotifyDisplayChangedEvent GetEventVisibility();
nsIntRect GetRect();
LayoutDeviceIntRect GetRect();
float GetDpi();
int32_t GetSurfaceFormat();
ANativeWindow* GetNativeWindow();
mozilla::LayoutDeviceIntRect GetNaturalBounds();
LayoutDeviceIntRect GetNaturalBounds();
uint32_t EffectiveScreenRotation();
ScreenConfiguration GetConfiguration();
bool IsPrimaryScreen();
@ -127,8 +128,8 @@ protected:
android::sp<ANativeWindow> mNativeWindow;
float mDpi;
int32_t mSurfaceFormat;
nsIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account.
nsIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account.
LayoutDeviceIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account.
LayoutDeviceIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account.
uint32_t mScreenRotation;
uint32_t mPhysicalScreenRotation;
nsTArray<nsWindow*> mTopWindows;

View File

@ -353,7 +353,7 @@ nsWindow::Create(nsIWidget *aParent,
mVisible = false;
if (!aParent) {
mBounds = mScreen->GetRect();
mBounds = mScreen->GetRect().ToUnknownRect();
}
mComposer2D = HwcComposer2D::GetInstance();