Chromium Code Reviews| Index: pdf/paint_manager.cc |
| diff --git a/pdf/paint_manager.cc b/pdf/paint_manager.cc |
| index 7811f07d5f6ca36662be9c1089cef10c8a11be26..fde60660118fdec6d8506b22e840897a47bf9ab8 100644 |
| --- a/pdf/paint_manager.cc |
| +++ b/pdf/paint_manager.cc |
| @@ -32,6 +32,7 @@ PaintManager::PaintManager(pp::Instance* instance, |
| callback_factory_(nullptr), |
| manual_callback_pending_(false), |
| flush_pending_(false), |
| + flush_requested_(false), |
| has_pending_resize_(false), |
| graphics_need_to_be_bound_(false), |
| pending_device_scale_(1.0), |
| @@ -108,6 +109,30 @@ void PaintManager::SetSize(const pp::Size& new_size, float device_scale) { |
| Invalidate(); |
| } |
| +void PaintManager::SetTransform(float scale, |
| + pp::Point origin, |
| + pp::Point translate) { |
| + if (!flush_pending_) { |
| + graphics_.SetLayerTransform(scale, origin, translate); |
| + flush_pending_ = true; |
| + flush_requested_ = false; |
| + graphics_.Flush( |
|
Kevin McNee - google account
2016/10/24 15:57:55
Use the return value of Flush to determine how to
Kevin McNee - google account
2016/10/24 21:11:47
Done.
|
| + callback_factory_.NewCallback(&PaintManager::OnFlushComplete)); |
| + scale_ = 1.f; |
| + origin_ = pp::Point(); |
| + transform_ = pp::Point(); |
|
Kevin McNee - google account
2016/10/24 15:57:55
Not used.
Kevin McNee - google account
2016/10/24 21:11:47
Done.
|
| + } else { |
| + flush_requested_ = true; |
| + graphics_.SetLayerTransform(scale, origin, translate); |
| + } |
| +} |
| + |
| +void PaintManager::SetTransform(float scale) { |
| + graphics_.SetLayerTransform(scale, pp::Point(), pp::Point()); |
| + |
| + EnsureCallbackPending(); |
| +} |
| + |
| void PaintManager::Invalidate() { |
| if (graphics_.is_null() && !has_pending_resize_) |
| return; |
| @@ -294,6 +319,13 @@ void PaintManager::OnFlushComplete(int32_t) { |
| DCHECK(flush_pending_); |
| flush_pending_ = false; |
| + // If there was another flush request while flushing we flush again. |
| + if (flush_requested_) { |
| + flush_requested_ = false; |
| + graphics_.Flush( |
|
Kevin McNee - google account
2016/10/24 15:57:55
See above wrt calling Flush.
Kevin McNee - google account
2016/10/24 21:11:47
Done.
|
| + callback_factory_.NewCallback(&PaintManager::OnFlushComplete)); |
| + } |
| + |
| // If more paints were enqueued while we were waiting for the flush to |
| // complete, execute them now. |
| if (aggregator_.HasPendingUpdate()) |