From 953a828c4402f9ce7cff6d183a997a47440aae6d Mon Sep 17 00:00:00 2001
From: Sergey Linev <S.Linev@gsi.de>
Date: Mon, 16 Sep 2019 15:35:25 +0200
Subject: [PATCH] [rdrawable] fix drawing of subpads after changing
 RPadExt/RPadPos

---
 graf2d/gpadv7/v7/inc/ROOT/RPadDisplayItem.hxx | 5 +++++
 graf2d/gpadv7/v7/src/RPad.cxx                 | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/graf2d/gpadv7/v7/inc/ROOT/RPadDisplayItem.hxx b/graf2d/gpadv7/v7/inc/ROOT/RPadDisplayItem.hxx
index 77f46dbfffc..4f58ffb0fb4 100644
--- a/graf2d/gpadv7/v7/inc/ROOT/RPadDisplayItem.hxx
+++ b/graf2d/gpadv7/v7/inc/ROOT/RPadDisplayItem.hxx
@@ -35,6 +35,8 @@ public:
 protected:
    const RFrame *fFrame{nullptr};             ///< temporary pointer on frame object
    const RDrawableAttributes *fAttr{nullptr}; ///< temporary pointer on attributes
+   const RPadPos *fPos{nullptr};              ///< pad position
+   const RPadExtent *fSize{nullptr};          ///< pad size
    std::string fTitle;                        ///< title of the pad (used for canvas)
    std::array<int, 2> fWinSize;               ///< window size (used for canvas)
    PadPrimitives_t fPrimitives;               ///< display items for all primitives in the pad
@@ -43,6 +45,7 @@ public:
    virtual ~RPadDisplayItem() {}
    void SetFrame(const RFrame *f) { fFrame = f; }
    void SetAttributes(const RDrawableAttributes *f) { fAttr = f; }
+   void SetPadPosSize(const RPadPos *pos, const RPadExtent *size) { fPos = pos; fSize = size; }
    void SetTitle(const std::string &title) { fTitle = title; }
    void SetWindowSize(const std::array<RPadLength::Pixel, 2> &win) { fWinSize[0] = (int) win[0].fVal; fWinSize[1] = (int) win[1].fVal; }
    PadPrimitives_t &GetPrimitives() { return fPrimitives; }
@@ -51,6 +54,8 @@ public:
    {
       fFrame = nullptr;
       fAttr = nullptr;
+      fPos = nullptr;
+      fSize = nullptr;
       fTitle.clear();
       fWinSize[0] = fWinSize[1] = 0;
       fPrimitives.clear();
diff --git a/graf2d/gpadv7/v7/src/RPad.cxx b/graf2d/gpadv7/v7/src/RPad.cxx
index 98485a0e8fe..367b17cd5c0 100644
--- a/graf2d/gpadv7/v7/src/RPad.cxx
+++ b/graf2d/gpadv7/v7/src/RPad.cxx
@@ -224,6 +224,8 @@ void ROOT::Experimental::RPad::Paint(Internal::RPadPainter &toppad)
 
    painter.PaintDrawables(*this);
 
+   painter.fPadDisplayItem->SetPadPosSize(&fPos, &fSize);
+
    painter.fPadDisplayItem->SetAttributes(&fAttr);
 
    toppad.AddDisplayItem(std::move(painter.fPadDisplayItem));
-- 
GitLab