bool ScreenManagerParent::ExtractScreenDetails(nsIScreen* aScreen, ScreenDetails &aDetails) { if (!aScreen) { return false; } uint32_t id; nsresult rv = aScreen->GetId(&id); NS_ENSURE_SUCCESS(rv, false); aDetails.id() = id; nsIntRect rect; rv = aScreen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height); NS_ENSURE_SUCCESS(rv, false); aDetails.rect() = rect; nsIntRect rectDisplayPix; rv = aScreen->GetRectDisplayPix(&rectDisplayPix.x, &rectDisplayPix.y, &rectDisplayPix.width, &rectDisplayPix.height); NS_ENSURE_SUCCESS(rv, false); aDetails.rectDisplayPix() = rectDisplayPix; nsIntRect availRect; rv = aScreen->GetAvailRect(&availRect.x, &availRect.y, &availRect.width, &availRect.height); NS_ENSURE_SUCCESS(rv, false); aDetails.availRect() = availRect; nsIntRect availRectDisplayPix; rv = aScreen->GetAvailRectDisplayPix(&availRectDisplayPix.x, &availRectDisplayPix.y, &availRectDisplayPix.width, &availRectDisplayPix.height); NS_ENSURE_SUCCESS(rv, false); aDetails.availRectDisplayPix() = availRectDisplayPix; int32_t pixelDepth = 0; rv = aScreen->GetPixelDepth(&pixelDepth); NS_ENSURE_SUCCESS(rv, false); aDetails.pixelDepth() = pixelDepth; int32_t colorDepth = 0; rv = aScreen->GetColorDepth(&colorDepth); NS_ENSURE_SUCCESS(rv, false); aDetails.colorDepth() = colorDepth; double contentsScaleFactor = 1.0; rv = aScreen->GetContentsScaleFactor(&contentsScaleFactor); NS_ENSURE_SUCCESS(rv, false); aDetails.contentsScaleFactor() = contentsScaleFactor; return true; }
void ScreenProxy::PopulateByDetails(ScreenDetails aDetails) { mId = aDetails.id(); mRect = nsIntRect(aDetails.rect()); mRectDisplayPix = nsIntRect(aDetails.rectDisplayPix()); mAvailRect = nsIntRect(aDetails.availRect()); mAvailRectDisplayPix = nsIntRect(aDetails.availRectDisplayPix()); mPixelDepth = aDetails.pixelDepth(); mColorDepth = aDetails.colorDepth(); mContentsScaleFactor = aDetails.contentsScaleFactor(); }