Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: pdf/paint_manager.h

Issue 2400743002: Improved Pinch-Zoom for PDF. (Closed)
Patch Set: More code review changes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PDF_PAINT_MANAGER_H_ 5 #ifndef PDF_PAINT_MANAGER_H_
6 #define PDF_PAINT_MANAGER_H_ 6 #define PDF_PAINT_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // The given rect should be scrolled by the given amounts. 139 // The given rect should be scrolled by the given amounts.
140 void ScrollRect(const pp::Rect& clip_rect, const pp::Point& amount); 140 void ScrollRect(const pp::Rect& clip_rect, const pp::Point& amount);
141 141
142 // Returns the size of the graphics context for the next paint operation. 142 // Returns the size of the graphics context for the next paint operation.
143 // This is the pending size if a resize is pending (the plugin has called 143 // This is the pending size if a resize is pending (the plugin has called
144 // SetSize but we haven't actually painted it yet), or the current size of 144 // SetSize but we haven't actually painted it yet), or the current size of
145 // no resize is pending. 145 // no resize is pending.
146 pp::Size GetEffectiveSize() const; 146 pp::Size GetEffectiveSize() const;
147 float GetEffectiveDeviceScale() const; 147 float GetEffectiveDeviceScale() const;
148 148
149 // Set the transform for the graphics layer.
150 void SetTransform(float scale,
151 const pp::Point& origin,
152 const pp::Point& translate);
153 void SetTransform(float scale);
154
149 private: 155 private:
150 // Disallow copy and assign (these are unimplemented). 156 // Disallow copy and assign (these are unimplemented).
151 PaintManager(const PaintManager&); 157 PaintManager(const PaintManager&);
152 PaintManager& operator=(const PaintManager&); 158 PaintManager& operator=(const PaintManager&);
153 159
154 // Makes sure there is a callback that will trigger a paint at a later time. 160 // Makes sure there is a callback that will trigger a paint at a later time.
155 // This will be either a Flush callback telling us we're allowed to generate 161 // This will be either a Flush callback telling us we're allowed to generate
156 // more data, or, if there's no flush callback pending, a manual call back 162 // more data, or, if there's no flush callback pending, a manual call back
157 // to the message loop via ExecuteOnMainThread. 163 // to the message loop via ExecuteOnMainThread.
158 void EnsureCallbackPending(); 164 void EnsureCallbackPending();
159 165
160 // Does the client paint and executes a Flush if necessary. 166 // Does the client paint and executes a Flush if necessary.
161 void DoPaint(); 167 void DoPaint();
162 168
169 // Executes a Flush
170 void Flush();
171
163 // Callback for asynchronous completion of Flush. 172 // Callback for asynchronous completion of Flush.
164 void OnFlushComplete(int32_t); 173 void OnFlushComplete(int32_t);
165 174
166 // Callback for manual scheduling of paints when there is no flush callback 175 // Callback for manual scheduling of paints when there is no flush callback
167 // pending. 176 // pending.
168 void OnManualCallbackComplete(int32_t); 177 void OnManualCallbackComplete(int32_t);
169 178
170 pp::Instance* instance_; 179 pp::Instance* instance_;
171 180
172 // Non-owning pointer. See the constructor. 181 // Non-owning pointer. See the constructor.
173 Client* client_; 182 Client* client_;
174 183
175 bool is_always_opaque_; 184 bool is_always_opaque_;
176 185
177 pp::CompletionCallbackFactory<PaintManager> callback_factory_; 186 pp::CompletionCallbackFactory<PaintManager> callback_factory_;
178 187
179 // This graphics device will be is_null() if no graphics has been manually 188 // This graphics device will be is_null() if no graphics has been manually
180 // set yet. 189 // set yet.
181 pp::Graphics2D graphics_; 190 pp::Graphics2D graphics_;
182 191
183 PaintAggregator aggregator_; 192 PaintAggregator aggregator_;
184 193
185 // See comment for EnsureCallbackPending for more on how these work. 194 // See comment for EnsureCallbackPending for more on how these work.
186 bool manual_callback_pending_; 195 bool manual_callback_pending_;
187 bool flush_pending_; 196 bool flush_pending_;
197 bool flush_requested_;
188 198
189 // When we get a resize, we don't bind right away (see SetSize). The 199 // When we get a resize, we don't bind right away (see SetSize). The
190 // has_pending_resize_ tells us that we need to do a resize for the next 200 // has_pending_resize_ tells us that we need to do a resize for the next
191 // paint operation. When true, the new size is in pending_size_. 201 // paint operation. When true, the new size is in pending_size_.
192 bool has_pending_resize_; 202 bool has_pending_resize_;
193 bool graphics_need_to_be_bound_; 203 bool graphics_need_to_be_bound_;
194 pp::Size pending_size_; 204 pp::Size pending_size_;
195 pp::Size plugin_size_; 205 pp::Size plugin_size_;
196 float pending_device_scale_; 206 float pending_device_scale_;
197 float device_scale_; 207 float device_scale_;
198 208
199 // True iff we're in the middle of a paint. 209 // True iff we're in the middle of a paint.
200 bool in_paint_; 210 bool in_paint_;
201 211
202 // True if we haven't painted the plugin viewport yet. 212 // True if we haven't painted the plugin viewport yet.
203 bool first_paint_; 213 bool first_paint_;
204 214
205 // True when the view size just changed and we're waiting for a paint. 215 // True when the view size just changed and we're waiting for a paint.
206 bool view_size_changed_waiting_for_paint_; 216 bool view_size_changed_waiting_for_paint_;
207 }; 217 };
208 218
209 #endif // PDF_PAINT_MANAGER_H_ 219 #endif // PDF_PAINT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698