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/drm/gpu/drm_buffer.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 8 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 if (should_register_framebuffer && | 67 if (should_register_framebuffer && |
68 !drm_->AddFramebuffer( | 68 !drm_->AddFramebuffer( |
69 info.width(), info.height(), GetColorDepth(info.colorType()), | 69 info.width(), info.height(), GetColorDepth(info.colorType()), |
70 info.bytesPerPixel() << 3, stride_, handle_, &framebuffer_)) { | 70 info.bytesPerPixel() << 3, stride_, handle_, &framebuffer_)) { |
71 PLOG(ERROR) << "DrmBuffer: AddFramebuffer: handle " << handle_; | 71 PLOG(ERROR) << "DrmBuffer: AddFramebuffer: handle " << handle_; |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 surface_ = | 75 surface_ = SkSurface::MakeRasterDirect(info, mmap_base_, stride_); |
76 skia::AdoptRef(SkSurface::NewRasterDirect(info, mmap_base_, stride_)); | |
77 if (!surface_) { | 76 if (!surface_) { |
78 LOG(ERROR) << "DrmBuffer: Failed to create SkSurface: handle " << handle_; | 77 LOG(ERROR) << "DrmBuffer: Failed to create SkSurface: handle " << handle_; |
79 return false; | 78 return false; |
80 } | 79 } |
81 | 80 |
82 return true; | 81 return true; |
83 } | 82 } |
84 | 83 |
85 SkCanvas* DrmBuffer::GetCanvas() const { | 84 SkCanvas* DrmBuffer::GetCanvas() const { |
86 return surface_->getCanvas(); | 85 return surface_->getCanvas(); |
(...skipping 22 matching lines...) Expand all Loading... |
109 const gfx::Size& size) { | 108 const gfx::Size& size) { |
110 scoped_refptr<DrmBuffer> buffer(new DrmBuffer(drm)); | 109 scoped_refptr<DrmBuffer> buffer(new DrmBuffer(drm)); |
111 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 110 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
112 if (!buffer->Initialize(info, true /* should_register_framebuffer */)) | 111 if (!buffer->Initialize(info, true /* should_register_framebuffer */)) |
113 return NULL; | 112 return NULL; |
114 | 113 |
115 return buffer; | 114 return buffer; |
116 } | 115 } |
117 | 116 |
118 } // namespace ui | 117 } // namespace ui |
OLD | NEW |