| 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_surface.h" | 5 #include "ui/ozone/platform/dri/dri_surface.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 DriSurface::~DriSurface() { | 29 DriSurface::~DriSurface() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool DriSurface::Initialize() { | 32 bool DriSurface::Initialize() { |
| 33 for (size_t i = 0; i < arraysize(bitmaps_); ++i) { | 33 for (size_t i = 0; i < arraysize(bitmaps_); ++i) { |
| 34 bitmaps_[i].reset(CreateBuffer()); | 34 bitmaps_[i].reset(CreateBuffer()); |
| 35 // TODO(dnicoara) Should select the configuration based on what the | 35 // TODO(dnicoara) Should select the configuration based on what the |
| 36 // underlying system supports. | 36 // underlying system supports. |
| 37 SkImageInfo info = SkImageInfo::Make(size_.width(), | 37 SkImageInfo info = SkImageInfo::MakeN32Premul(size_.width(), |
| 38 size_.height(), | 38 size_.height()); |
| 39 kPMColor_SkColorType, | |
| 40 kPremul_SkAlphaType); | |
| 41 if (!bitmaps_[i]->Initialize(info)) { | 39 if (!bitmaps_[i]->Initialize(info)) { |
| 42 return false; | 40 return false; |
| 43 } | 41 } |
| 44 } | 42 } |
| 45 | 43 |
| 46 return true; | 44 return true; |
| 47 } | 45 } |
| 48 | 46 |
| 49 uint32_t DriSurface::GetFramebufferId() const { | 47 uint32_t DriSurface::GetFramebufferId() const { |
| 50 CHECK(backbuffer()); | 48 CHECK(backbuffer()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 } | 69 } |
| 72 | 70 |
| 73 SkCanvas* DriSurface::GetDrawableForWidget() { | 71 SkCanvas* DriSurface::GetDrawableForWidget() { |
| 74 CHECK(backbuffer()); | 72 CHECK(backbuffer()); |
| 75 return backbuffer()->canvas(); | 73 return backbuffer()->canvas(); |
| 76 } | 74 } |
| 77 | 75 |
| 78 DriBuffer* DriSurface::CreateBuffer() { return new DriBuffer(dri_); } | 76 DriBuffer* DriSurface::CreateBuffer() { return new DriBuffer(dri_); } |
| 79 | 77 |
| 80 } // namespace ui | 78 } // namespace ui |
| OLD | NEW |