/// Screen座標系のRectとIntersectを取り、新しいClipping領域に設定する。 /// @param nextScreenRect 新しいClipping領域(Intersect前) public void SetClippingRectByScreenRect(ScreenRect nextScreenRect) { Debug.Assert(this.IsWindowValid, "Invalid Window", "LayoutElement.SetClippingRectByScreenRect"); // Screen座標系でのウィンドウのクライアント領域とIntersectをとる var boundScreenRect = Utilities.GetWindowScreenRect(this.WindowType, this.Window); if (!nextScreenRect.IntersectsWith(boundScreenRect)) { Debug.WriteLine("No Intersection", "LayoutElement.SetClippingRectByScreenRect"); return; } /// @warning nextScreenRectが更新されるので注意 nextScreenRect.Intersect(boundScreenRect); // プロパティを変更 this.Fit = false; switch (this.WindowType) { case WindowTypes.Normal: case WindowTypes.DXGI: { // Screen->Client座標系変換 this.ClippingXWithoutFit = nextScreenRect.X - boundScreenRect.X; this.ClippingYWithoutFit = nextScreenRect.Y - boundScreenRect.Y; break; } case WindowTypes.Desktop: { // 変換の必要なし this.ClippingXWithoutFit = nextScreenRect.X; this.ClippingYWithoutFit = nextScreenRect.Y; break; } default: Debug.Fail("switch"); throw new System.ArgumentException(); } // Width/Heightは共通 this.ClippingWidthWithoutFit = nextScreenRect.Width; this.ClippingHeightWithoutFit = nextScreenRect.Height; }