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

Side by Side Diff: ui/ozone/platform/dri/dri_surface.cc

Issue 445163003: With the overlay path moving back to passing AcceleratedWidgets, move the implementation back into … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « no previous file | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ui/ozone/platform/dri/dri_surface.h" 5 #include "ui/ozone/platform/dri/dri_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkSurface.h" 10 #include "third_party/skia/include/core/SkSurface.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 buffers_[i] = AllocateBuffer(dri_, mode_size); 64 buffers_[i] = AllocateBuffer(dri_, mode_size);
65 } 65 }
66 66
67 void DriSurface::PresentCanvas(const gfx::Rect& damage) { 67 void DriSurface::PresentCanvas(const gfx::Rect& damage) {
68 DCHECK(base::MessageLoopForUI::IsCurrent()); 68 DCHECK(base::MessageLoopForUI::IsCurrent());
69 DCHECK(buffers_[front_buffer_ ^ 1]); 69 DCHECK(buffers_[front_buffer_ ^ 1]);
70 70
71 if (!controller_) 71 if (!controller_)
72 return; 72 return;
73 73
74 std::vector<OverlayPlane> planes( 74 controller_->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1]));
75 1, OverlayPlane(buffers_[front_buffer_ ^ 1]));
76 75
77 UpdateNativeSurface(damage); 76 UpdateNativeSurface(damage);
78 controller_->SchedulePageFlip(planes); 77 controller_->SchedulePageFlip();
79 controller_->WaitForPageFlipEvent(); 78 controller_->WaitForPageFlipEvent();
80 79
81 // Update our front buffer pointer. 80 // Update our front buffer pointer.
82 front_buffer_ ^= 1; 81 front_buffer_ ^= 1;
83 } 82 }
84 83
85 scoped_ptr<gfx::VSyncProvider> DriSurface::CreateVSyncProvider() { 84 scoped_ptr<gfx::VSyncProvider> DriSurface::CreateVSyncProvider() {
86 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); 85 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_));
87 } 86 }
88 87
89 void DriSurface::UpdateNativeSurface(const gfx::Rect& damage) { 88 void DriSurface::UpdateNativeSurface(const gfx::Rect& damage) {
90 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas(); 89 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas();
91 90
92 // The DriSurface is double buffered, so the current back buffer is 91 // The DriSurface is double buffered, so the current back buffer is
93 // missing the previous update. Expand damage region. 92 // missing the previous update. Expand damage region.
94 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); 93 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
95 94
96 // Copy damage region. 95 // Copy damage region.
97 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); 96 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
98 image->draw(canvas, &real_damage, real_damage, NULL); 97 image->draw(canvas, &real_damage, real_damage, NULL);
99 98
100 last_damage_ = damage; 99 last_damage_ = damage;
101 } 100 }
102 101
103 } // namespace ui 102 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698