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/screen_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
6 | 6 |
7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
8 | 8 |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 // Don't copy anything if the sizes mismatch. This can happen when the user | 53 // Don't copy anything if the sizes mismatch. This can happen when the user |
54 // changes modes. | 54 // changes modes. |
55 if (saved_buffer.canvas()->getBaseLayerSize() != | 55 if (saved_buffer.canvas()->getBaseLayerSize() != |
56 modeset_buffer.canvas()->getBaseLayerSize()) { | 56 modeset_buffer.canvas()->getBaseLayerSize()) { |
57 VLOG(2) << "Previous buffer has a different size than modeset buffer"; | 57 VLOG(2) << "Previous buffer has a different size than modeset buffer"; |
58 return; | 58 return; |
59 } | 59 } |
60 | 60 |
61 skia::RefPtr<SkImage> image = saved_buffer.image(); | 61 sk_sp<SkImage> image = saved_buffer.image(); |
62 SkPaint paint; | 62 SkPaint paint; |
63 // Copy the source buffer. Do not perform any blending. | 63 // Copy the source buffer. Do not perform any blending. |
64 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 64 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
65 modeset_buffer.canvas()->drawImage(image.get(), 0, 0, &paint); | 65 modeset_buffer.canvas()->drawImage(image.get(), 0, 0, &paint); |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 ScreenManager::ScreenManager(ScanoutBufferGenerator* buffer_generator) | 70 ScreenManager::ScreenManager(ScanoutBufferGenerator* buffer_generator) |
71 : buffer_generator_(buffer_generator) { | 71 : buffer_generator_(buffer_generator) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 339 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
340 for (auto pair : window_map_) { | 340 for (auto pair : window_map_) { |
341 if (pair.second->bounds() == bounds) | 341 if (pair.second->bounds() == bounds) |
342 return pair.second; | 342 return pair.second; |
343 } | 343 } |
344 | 344 |
345 return nullptr; | 345 return nullptr; |
346 } | 346 } |
347 | 347 |
348 } // namespace ui | 348 } // namespace ui |
OLD | NEW |