Chromium Code Reviews

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_surface.cc

Issue 2011713003: Roll skia to 8cc209111876b7c78b5ec577c9221d8ed5e21024 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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/drm/gpu/drm_surface.h" 5 #include "ui/ozone/platform/drm/gpu/drm_surface.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 25 matching lines...)
36 } // namespace 36 } // namespace
37 37
38 DrmSurface::DrmSurface(DrmWindow* window_delegate) 38 DrmSurface::DrmSurface(DrmWindow* window_delegate)
39 : window_delegate_(window_delegate), 39 : window_delegate_(window_delegate),
40 weak_ptr_factory_(this) { 40 weak_ptr_factory_(this) {
41 } 41 }
42 42
43 DrmSurface::~DrmSurface() { 43 DrmSurface::~DrmSurface() {
44 } 44 }
45 45
46 skia::RefPtr<SkSurface> DrmSurface::GetSurface() { 46 sk_sp<SkSurface> DrmSurface::GetSurface() {
47 return surface_; 47 return surface_;
48 } 48 }
49 49
50 void DrmSurface::ResizeCanvas(const gfx::Size& viewport_size) { 50 void DrmSurface::ResizeCanvas(const gfx::Size& viewport_size) {
51 SkImageInfo info = SkImageInfo::MakeN32( 51 SkImageInfo info = SkImageInfo::MakeN32(
52 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); 52 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType);
53 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); 53 surface_ = SkSurface::MakeRaster(info);
54 54
55 HardwareDisplayController* controller = window_delegate_->GetController(); 55 HardwareDisplayController* controller = window_delegate_->GetController();
56 if (!controller) 56 if (!controller)
57 return; 57 return;
58 58
59 // For the display buffers use the mode size since a |viewport_size| smaller 59 // For the display buffers use the mode size since a |viewport_size| smaller
60 // than the display size will not scanout. 60 // than the display size will not scanout.
61 front_buffer_ = AllocateBuffer(controller->GetAllocationDrmDevice(), 61 front_buffer_ = AllocateBuffer(controller->GetAllocationDrmDevice(),
62 controller->GetModeSize()); 62 controller->GetModeSize());
63 back_buffer_ = AllocateBuffer(controller->GetAllocationDrmDevice(), 63 back_buffer_ = AllocateBuffer(controller->GetAllocationDrmDevice(),
64 controller->GetModeSize()); 64 controller->GetModeSize());
65 } 65 }
66 66
67 void DrmSurface::PresentCanvas(const gfx::Rect& damage) { 67 void DrmSurface::PresentCanvas(const gfx::Rect& damage) {
68 DCHECK(base::MessageLoopForUI::IsCurrent()); 68 DCHECK(base::MessageLoopForUI::IsCurrent());
69 69
70 // Create a snapshot of the requested drawing. If we get here again before 70 // Create a snapshot of the requested drawing. If we get here again before
71 // presenting, just add the additional damage. 71 // presenting, just add the additional damage.
72 pending_image_damage_.Union(damage); 72 pending_image_damage_.Union(damage);
73 pending_image_ = skia::AdoptRef(surface_->newImageSnapshot()); 73 pending_image_ = surface_->makeImageSnapshot();
74 74
75 if (!pending_pageflip_) 75 if (!pending_pageflip_)
76 SchedulePageFlip(); 76 SchedulePageFlip();
77 } 77 }
78 78
79 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() { 79 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() {
80 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_)); 80 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_));
81 } 81 }
82 82
83 void DrmSurface::SchedulePageFlip() { 83 void DrmSurface::SchedulePageFlip() {
(...skipping 23 matching lines...)
107 107
108 void DrmSurface::OnPageFlip(gfx::SwapResult result) { 108 void DrmSurface::OnPageFlip(gfx::SwapResult result) {
109 pending_pageflip_ = false; 109 pending_pageflip_ = false;
110 if (!pending_image_) 110 if (!pending_image_)
111 return; 111 return;
112 112
113 SchedulePageFlip(); 113 SchedulePageFlip();
114 } 114 }
115 115
116 } // namespace ui 116 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_surface.h ('k') | ui/ozone/platform/drm/gpu/drm_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine