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

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

Issue 1528373002: Replace Pass() with std::move in ui/ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 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/gbm_buffer.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <gbm.h> 9 #include <gbm.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (use_scanout && !buffer->GetFramebufferId()) 62 if (use_scanout && !buffer->GetFramebufferId())
63 return nullptr; 63 return nullptr;
64 64
65 return buffer; 65 return buffer;
66 } 66 }
67 67
68 GbmPixmap::GbmPixmap(GbmSurfaceFactory* surface_manager) 68 GbmPixmap::GbmPixmap(GbmSurfaceFactory* surface_manager)
69 : surface_manager_(surface_manager) {} 69 : surface_manager_(surface_manager) {}
70 70
71 void GbmPixmap::Initialize(base::ScopedFD dma_buf, int dma_buf_pitch) { 71 void GbmPixmap::Initialize(base::ScopedFD dma_buf, int dma_buf_pitch) {
72 dma_buf_ = dma_buf.Pass(); 72 dma_buf_ = std::move(dma_buf);
73 dma_buf_pitch_ = dma_buf_pitch; 73 dma_buf_pitch_ = dma_buf_pitch;
74 } 74 }
75 75
76 bool GbmPixmap::InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer) { 76 bool GbmPixmap::InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer) {
77 // We want to use the GBM API because it's going to call into libdrm 77 // We want to use the GBM API because it's going to call into libdrm
78 // which might do some optimizations on buffer allocation, 78 // which might do some optimizations on buffer allocation,
79 // especially when sharing buffers via DMABUF. 79 // especially when sharing buffers via DMABUF.
80 base::ScopedFD dma_buf(gbm_bo_get_fd(buffer->bo())); 80 base::ScopedFD dma_buf(gbm_bo_get_fd(buffer->bo()));
81 if (!dma_buf.is_valid()) { 81 if (!dma_buf.is_valid()) {
82 PLOG(ERROR) << "Failed to export buffer to dma_buf"; 82 PLOG(ERROR) << "Failed to export buffer to dma_buf";
83 return false; 83 return false;
84 } 84 }
85 Initialize(dma_buf.Pass(), gbm_bo_get_stride(buffer->bo())); 85 Initialize(std::move(dma_buf), gbm_bo_get_stride(buffer->bo()));
86 buffer_ = buffer; 86 buffer_ = buffer;
87 return true; 87 return true;
88 } 88 }
89 89
90 void GbmPixmap::SetProcessingCallback( 90 void GbmPixmap::SetProcessingCallback(
91 const ProcessingCallback& processing_callback) { 91 const ProcessingCallback& processing_callback) {
92 processing_callback_ = processing_callback; 92 processing_callback_ = processing_callback;
93 } 93 }
94 94
95 scoped_refptr<NativePixmap> GbmPixmap::GetProcessedPixmap( 95 scoped_refptr<NativePixmap> GbmPixmap::GetProcessedPixmap(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 gfx::Size pixmap_size = buffer_->GetSize(); 200 gfx::Size pixmap_size = buffer_->GetSize();
201 // If the required size is not integer-sized, round it to the next integer. 201 // If the required size is not integer-sized, round it to the next integer.
202 *target_size = gfx::ToCeiledSize( 202 *target_size = gfx::ToCeiledSize(
203 gfx::SizeF(display_bounds.width() / crop_rect.width(), 203 gfx::SizeF(display_bounds.width() / crop_rect.width(),
204 display_bounds.height() / crop_rect.height())); 204 display_bounds.height() / crop_rect.height()));
205 205
206 return pixmap_size != *target_size || GetBufferFormat() != *target_format; 206 return pixmap_size != *target_size || GetBufferFormat() != *target_format;
207 } 207 }
208 208
209 } // namespace ui 209 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698