1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright (c) 2010 The Chromium Authors. All rights reserved.
2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file.
4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef PDF_PAINT_MANAGER_H_
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define PDF_PAINT_MANAGER_H_
7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include <vector>
9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "pdf/paint_aggregator.h"
11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ppapi/cpp/graphics_2d.h"
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ppapi/utility/completion_callback_factory.h"
13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace pp {
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class Graphics2D;
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class Instance;
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class Point;
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class Rect;
19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Custom PaintManager for the PDF plugin.  This is branched from the Pepper
22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// version.  The difference is that this supports progressive rendering of dirty
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// rects, where multiple calls to the rendering engine are needed.  It also
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// supports having higher-priority rects flushing right away, i.e. the
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// scrollbars.
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)//
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// The client's OnPaint
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class PaintManager {
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public:
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Like PaintAggregator's version, but allows the plugin to tell us whether
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // it should be flushed to the screen immediately or when the rest of the
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // plugin viewport is ready.
33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  struct ReadyRect {
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    pp::Point offset;
35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    pp::Rect rect;
36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    pp::ImageData image_data;
37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    bool flush_now;
38cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
39cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    ReadyRect(const pp::Rect& r, const pp::ImageData& i, bool f)
40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)        : rect(r), image_data(i), flush_now(f) {}
41cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    operator PaintAggregator::ReadyRect() const {
43cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      PaintAggregator::ReadyRect rv;
44cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      rv.offset = offset;
45cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      rv.rect = rect;
46cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      rv.image_data = image_data;
47cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      return rv;
48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    }
49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  };
50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  class Client {
51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   public:
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // Paints the given invalid area of the plugin to the given graphics
53cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // device. Returns true if anything was painted.
54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    //
55cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // You are given the list of rects to paint in |paint_rects|.  You can
56cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // combine painting into less rectangles if it's more efficient.  When a
57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // rect is painted, information about that paint should be inserted into
58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // |ready|.  Otherwise if a paint needs more work, add the rect to
59cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // |pending|.  If |pending| is not empty, your OnPaint function will get
60cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // called again.  Once OnPaint is called and it returns no pending rects,
61cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // all the previously ready rects will be flushed on screen.  The exception
62cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // is for ready rects that have |flush_now| set to true.  These will be
63cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // flushed right away.
64cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    //
65cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // Do not call Flush() on the graphics device, this will be done
66cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // automatically if you return true from this function since the
67cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // PaintManager needs to handle the callback.
68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    //
69cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // Calling Invalidate/Scroll is not allowed while inside an OnPaint
70cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    virtual void OnPaint(const std::vector<pp::Rect>& paint_rects,
71cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                         std::vector<ReadyRect>* ready,
72cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                         std::vector<pp::Rect>* pending) = 0;
73cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   protected:
74cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // You shouldn't be doing deleting through this interface.
75cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    virtual ~Client() {}
76cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  };
77cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The instance is the plugin instance using this paint manager to do its
79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // painting. Painting will automatically go to this instance and you don't
80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // have to manually bind any device context (this is all handled by the
81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // paint manager).
82cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  //
83cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The Client is a non-owning pointer and must remain valid (normally the
84cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // object implementing the Client interface will own the paint manager).
85cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  //
86cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The is_always_opaque flag will be passed to the device contexts that this
87cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // class creates. Set this to true if your plugin always draws an opaque
88cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // image to the device. This is used as a hint to the browser that it does
89cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // not need to do alpha blending, which speeds up painting. If you generate
90cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // non-opqaue pixels or aren't sure, set this to false for more general
91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // blending.
92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  //
93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // If you set is_always_opaque, your alpha channel should always be set to
94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // 0xFF or there may be painting artifacts. Being opaque will allow the
95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // browser to do a memcpy rather than a blend to paint the plugin, and this
96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // means your alpha values will get set on the page backing store. If these
97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // values are incorrect, it could mess up future blending. If you aren't
98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // sure, it is always correct to specify that it it not opaque.
99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  //
100cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // You will need to call SetSize before this class will do anything. Normally
101cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // you do this from the ViewChanged method of your plugin instance.
102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PaintManager(pp::Instance* instance, Client* client, bool is_always_opaque);
103cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  ~PaintManager();
105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Returns the size of the graphics context to allocate for a given plugin
107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // size. We may allocated a slightly larger buffer than required so that we
108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // don't have to resize the context when scrollbars appear/dissapear due to
109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // zooming (which can result in flickering).
110cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  static pp::Size GetNewContextSize(const pp::Size& current_context_size,
111cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                                    const pp::Size& plugin_size);
112cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // You must call this function before using if you use the 0-arg constructor.
114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // See the constructor for what these arguments mean.
115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Initialize(pp::Instance* instance, Client* client,
116cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                  bool is_always_opaque);
117cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
118cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Sets the size of the plugin. If the size is the same as the previous call,
119cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // this will be a NOP. If the size has changed, a new device will be
120cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // allocated to the given size and a paint to that device will be scheduled.
121cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  //
122cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // This is intended to be called from ViewChanged with the size of the
123cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // plugin. Since it tracks the old size and only allocates when the size
124cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // changes, you can always call this function without worrying about whether
125cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // the size changed or ViewChanged is called for another reason (like the
126cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // position changed).
127cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void SetSize(const pp::Size& new_size, float new_device_scale);
128cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
129cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Invalidate the entire plugin.
130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Invalidate();
131cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
132cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Invalidate the given rect.
133cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void InvalidateRect(const pp::Rect& rect);
134cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
135cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The given rect should be scrolled by the given amounts.
136cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void ScrollRect(const pp::Rect& clip_rect, const pp::Point& amount);
137cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
138cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Returns the size of the graphics context for the next paint operation.
139cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // This is the pending size if a resize is pending (the plugin has called
140cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // SetSize but we haven't actually painted it yet), or the current size of
141cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // no resize is pending.
142cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::Size GetEffectiveSize() const;
143cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  float GetEffectiveDeviceScale() const;
144cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
145cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private:
146cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Disallow copy and assign (these are unimplemented).
147cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PaintManager(const PaintManager&);
148cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PaintManager& operator=(const PaintManager&);
149cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
150cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Makes sure there is a callback that will trigger a paint at a later time.
151cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // This will be either a Flush callback telling us we're allowed to generate
152cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // more data, or, if there's no flush callback pending, a manual call back
153cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // to the message loop via ExecuteOnMainThread.
154cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void EnsureCallbackPending();
155cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
156cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Does the client paint and executes a Flush if necessary.
157cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void DoPaint();
158cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
159cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Callback for asynchronous completion of Flush.
160cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void OnFlushComplete(int32_t);
161cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
162cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Callback for manual scheduling of paints when there is no flush callback
163cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // pending.
164cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void OnManualCallbackComplete(int32_t);
165cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
166cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::Instance* instance_;
167cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
168cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Non-owning pointer. See the constructor.
169cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  Client* client_;
170cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
171cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool is_always_opaque_;
172cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
173cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::CompletionCallbackFactory<PaintManager> callback_factory_;
174cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
175cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // This graphics device will be is_null() if no graphics has been manually
176cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // set yet.
177cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::Graphics2D graphics_;
178cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
179cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PaintAggregator aggregator_;
180cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // See comment for EnsureCallbackPending for more on how these work.
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool manual_callback_pending_;
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool flush_pending_;
184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
185cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // When we get a resize, we don't bind right away (see SetSize). The
186cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // has_pending_resize_ tells us that we need to do a resize for the next
187cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // paint operation. When true, the new size is in pending_size_.
188cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool has_pending_resize_;
189cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool graphics_need_to_be_bound_;
190cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::Size pending_size_;
191cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  pp::Size plugin_size_;
192cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  float pending_device_scale_;
193cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  float device_scale_;
194cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
195cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // True iff we're in the middle of a paint.
196cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool in_paint_;
197cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
198cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // True if we haven't painted the plugin viewport yet.
199cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool first_paint_;
200cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
201cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // True when the view size just changed and we're waiting for a paint.
202cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool view_size_changed_waiting_for_paint_;
203cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
204cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
205cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif  // PDF_PAINT_MANAGER_H_
206