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

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

Issue 399213005: [Ozone-DRI] Adding ScanoutBuffer interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use RefCounted as base Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.h ('k') | ui/ozone/platform/dri/dri_surface.h » ('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_buffer.h" 5 #include "ui/ozone/platform/dri/dri_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/ozone/platform/dri/dri_wrapper.h" 8 #include "ui/ozone/platform/dri/dri_wrapper.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 surface_ = skia::AdoptRef(SkSurface::NewRasterDirect(info, pixels, stride_)); 73 surface_ = skia::AdoptRef(SkSurface::NewRasterDirect(info, pixels, stride_));
74 if (!surface_) { 74 if (!surface_) {
75 VLOG(2) << "Cannot install Skia pixels for drm buffer"; 75 VLOG(2) << "Cannot install Skia pixels for drm buffer";
76 return false; 76 return false;
77 } 77 }
78 78
79 return true; 79 return true;
80 } 80 }
81 81
82 SkCanvas* DriBuffer::GetCanvas() const {
83 return surface_->getCanvas();
84 }
85
86 uint32_t DriBuffer::GetFramebufferId() const {
87 return framebuffer_;
88 }
89
90 uint32_t DriBuffer::GetHandle() const {
91 return handle_;
92 }
93
94 gfx::Size DriBuffer::GetSize() const {
95 return gfx::Size(surface_->width(), surface_->height());
96 }
97
98 DriBufferGenerator::DriBufferGenerator(DriWrapper* dri) : dri_(dri) {}
99
100 DriBufferGenerator::~DriBufferGenerator() {}
101
102 scoped_refptr<ScanoutBuffer> DriBufferGenerator::Create(const gfx::Size& size) {
103 scoped_refptr<DriBuffer> buffer(new DriBuffer(dri_));
104 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
105 if (!buffer->Initialize(info))
106 return NULL;
107
108 return buffer;
109 }
110
82 } // namespace ui 111 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.h ('k') | ui/ozone/platform/dri/dri_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698