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

Side by Side Diff: pdf/paint_manager.h

Issue 2400743002: Improved Pinch-Zoom for PDF. (Closed)
Patch Set: 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, pp::Point Origin, pp::Point Transform);
Lei Zhang 2016/10/27 16:56:36 Pass pp:Points by const reference.
Kevin McNee - google account 2016/10/27 21:40:30 Done.
151 void SetTransform(float scale);
152
149 private: 153 private:
150 // Disallow copy and assign (these are unimplemented). 154 // Disallow copy and assign (these are unimplemented).
151 PaintManager(const PaintManager&); 155 PaintManager(const PaintManager&);
152 PaintManager& operator=(const PaintManager&); 156 PaintManager& operator=(const PaintManager&);
153 157
154 // Makes sure there is a callback that will trigger a paint at a later time. 158 // 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 159 // 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 160 // more data, or, if there's no flush callback pending, a manual call back
157 // to the message loop via ExecuteOnMainThread. 161 // to the message loop via ExecuteOnMainThread.
158 void EnsureCallbackPending(); 162 void EnsureCallbackPending();
159 163
160 // Does the client paint and executes a Flush if necessary. 164 // Does the client paint and executes a Flush if necessary.
161 void DoPaint(); 165 void DoPaint();
162 166
167 // Executes a Flush
168 void Flush();
169
163 // Callback for asynchronous completion of Flush. 170 // Callback for asynchronous completion of Flush.
164 void OnFlushComplete(int32_t); 171 void OnFlushComplete(int32_t);
165 172
166 // Callback for manual scheduling of paints when there is no flush callback 173 // Callback for manual scheduling of paints when there is no flush callback
167 // pending. 174 // pending.
168 void OnManualCallbackComplete(int32_t); 175 void OnManualCallbackComplete(int32_t);
169 176
170 pp::Instance* instance_; 177 pp::Instance* instance_;
171 178
172 // Non-owning pointer. See the constructor. 179 // Non-owning pointer. See the constructor.
173 Client* client_; 180 Client* client_;
174 181
175 bool is_always_opaque_; 182 bool is_always_opaque_;
176 183
177 pp::CompletionCallbackFactory<PaintManager> callback_factory_; 184 pp::CompletionCallbackFactory<PaintManager> callback_factory_;
178 185
179 // This graphics device will be is_null() if no graphics has been manually 186 // This graphics device will be is_null() if no graphics has been manually
180 // set yet. 187 // set yet.
181 pp::Graphics2D graphics_; 188 pp::Graphics2D graphics_;
182 189
183 PaintAggregator aggregator_; 190 PaintAggregator aggregator_;
184 191
185 // See comment for EnsureCallbackPending for more on how these work. 192 // See comment for EnsureCallbackPending for more on how these work.
186 bool manual_callback_pending_; 193 bool manual_callback_pending_;
187 bool flush_pending_; 194 bool flush_pending_;
195 bool flush_requested_;
188 196
189 // When we get a resize, we don't bind right away (see SetSize). The 197 // 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 198 // 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_. 199 // paint operation. When true, the new size is in pending_size_.
192 bool has_pending_resize_; 200 bool has_pending_resize_;
193 bool graphics_need_to_be_bound_; 201 bool graphics_need_to_be_bound_;
194 pp::Size pending_size_; 202 pp::Size pending_size_;
195 pp::Size plugin_size_; 203 pp::Size plugin_size_;
196 float pending_device_scale_; 204 float pending_device_scale_;
197 float device_scale_; 205 float device_scale_;
198 206
199 // True iff we're in the middle of a paint. 207 // True iff we're in the middle of a paint.
200 bool in_paint_; 208 bool in_paint_;
201 209
202 // True if we haven't painted the plugin viewport yet. 210 // True if we haven't painted the plugin viewport yet.
203 bool first_paint_; 211 bool first_paint_;
204 212
205 // True when the view size just changed and we're waiting for a paint. 213 // True when the view size just changed and we're waiting for a paint.
206 bool view_size_changed_waiting_for_paint_; 214 bool view_size_changed_waiting_for_paint_;
207 }; 215 };
208 216
209 #endif // PDF_PAINT_MANAGER_H_ 217 #endif // PDF_PAINT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698