summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/paint_manager.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:04:58 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:04:58 +0000
commit8ccd594df1c045bc26def7ba623e262bd0d43218 (patch)
treea5a67c8cf3e2db0476de138537f832f6b7bc640c /ppapi/cpp/paint_manager.h
parentec13ca612aa5f6fed4b33b17802d8141c182b5e9 (diff)
downloadchromium_src-8ccd594df1c045bc26def7ba623e262bd0d43218.zip
chromium_src-8ccd594df1c045bc26def7ba623e262bd0d43218.tar.gz
chromium_src-8ccd594df1c045bc26def7ba623e262bd0d43218.tar.bz2
Don't copy the Graphics2D when binding a new one. This brings the
implementation in line with the interface documentation (the old behavior would clobber any content). The copying behavior was introduced to avoid flickering when resizing. To avoid this, the PaintManager now doesn't bind the new device until it's been painted to. This gives flicker-free painting. This fixes a bug in the paint manager example that made it not paint. TEST=manual BUG=86568 Review URL: http://codereview.chromium.org/7215030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/paint_manager.h')
-rw-r--r--ppapi/cpp/paint_manager.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/ppapi/cpp/paint_manager.h b/ppapi/cpp/paint_manager.h
index d8cba66..5f14862 100644
--- a/ppapi/cpp/paint_manager.h
+++ b/ppapi/cpp/paint_manager.h
@@ -146,9 +146,12 @@ class PaintManager {
// position changed).
void SetSize(const Size& new_size);
- // Provides access to the underlying device in case you need it. Note: if
- // you call Flush on this device the paint manager will get very confused,
- // don't do this!
+ // Provides access to the underlying device in case you need it. If you have
+ // done a SetSize, note that the graphics context won't be updated until
+ // right before the next OnPaint call.
+ //
+ // Note: if you call Flush on this device the paint manager will get very
+ // confused, don't do this!
const Graphics2D& graphics() const { return graphics_; }
Graphics2D& graphics() { return graphics_; }
@@ -161,6 +164,12 @@ class PaintManager {
// The given rect should be scrolled by the given amounts.
void ScrollRect(const Rect& clip_rect, const Point& amount);
+ // Returns the size of the graphics context for the next paint operation.
+ // This is the pending size if a resize is pending (the plugin has called
+ // SetSize but we haven't actually painted it yet), or the current size of
+ // no resize is pending.
+ Size GetEffectiveSize() const;
+
private:
// Disallow copy and assign (these are unimplemented).
PaintManager(const PaintManager&);
@@ -200,6 +209,12 @@ class PaintManager {
// See comment for EnsureCallbackPending for more on how these work.
bool manual_callback_pending_;
bool flush_pending_;
+
+ // When we get a resize, we don't bind right away (see SetSize). The
+ // has_pending_resize_ tells us that we need to do a resize for the next
+ // paint operation. When true, the new size is in pending_size_.
+ bool has_pending_resize_;
+ Size pending_size_;
};
} // namespace pp