| OLD | NEW |
| 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 Loading... |
| 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 void* DriBuffer::GetEGLClientBuffer() { |
| 99 NOTREACHED(); |
| 100 return NULL; |
| 101 } |
| 102 |
| 103 int DriBuffer::GetDmaBufFd() { |
| 104 NOTREACHED(); |
| 105 return 0; |
| 106 } |
| 107 |
| 108 DriBufferGenerator::DriBufferGenerator(DriWrapper* dri) : dri_(dri) {} |
| 109 |
| 110 DriBufferGenerator::~DriBufferGenerator() {} |
| 111 |
| 112 scoped_refptr<ScanoutBuffer> DriBufferGenerator::Create(const gfx::Size& size) { |
| 113 scoped_refptr<DriBuffer> buffer(new DriBuffer(dri_)); |
| 114 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
| 115 if (!buffer->Initialize(info)) |
| 116 return NULL; |
| 117 |
| 118 return buffer; |
| 119 } |
| 120 |
| 82 } // namespace ui | 121 } // namespace ui |
| OLD | NEW |