Don't unnecessarily resize windows in sk_app on X
authorbsalomon <bsalomon@google.com>
Tue, 26 Jul 2016 15:50:26 +0000 (08:50 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 Jul 2016 15:50:27 +0000 (08:50 -0700)
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2182163002

Review-Url: https://codereview.chromium.org/2182163002

tools/viewer/sk_app/Window.h
tools/viewer/sk_app/unix/Window_unix.h

index 9ced747..eab8c1d 100644 (file)
@@ -158,8 +158,8 @@ public:
     void onPaint();
     void onResize(uint32_t width, uint32_t height);
 
-    uint32_t width() { return fWidth; }
-    uint32_t height() { return fHeight;  }
+    int width() { return fWidth; }
+    int height() { return fHeight;  }
 
     virtual const DisplayParams& getDisplayParams();
     void setDisplayParams(const DisplayParams& params);
@@ -170,8 +170,8 @@ public:
 protected:
     Window();
 
-    uint32_t     fWidth;
-    uint32_t     fHeight;
+    int          fWidth;
+    int          fHeight;
 
     OnCharFunc   fCharFunc;
     void*        fCharUserData;
index fb6b22d..b6d40e6 100644 (file)
@@ -63,10 +63,12 @@ public:
         }
     }
 
-    void markPendingResize(int width, int height) { 
-        fPendingWidth = width; 
-        fPendingHeight = height;
-        fPendingResize = true;
+    void markPendingResize(int width, int height) {
+        if (width != fWidth || height != fHeight){
+            fPendingResize = true;
+            fPendingWidth = width;
+            fPendingHeight = height;
+        }
     }
     void finishResize() { 
         if (fPendingResize) {