| 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_window.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) { | 30 void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) { |
| 31 SkRect damage; | 31 SkRect damage; |
| 32 image.getBounds(&damage); | 32 image.getBounds(&damage); |
| 33 | 33 |
| 34 // Clear to transparent in case |image| is smaller than the canvas. | 34 // Clear to transparent in case |image| is smaller than the canvas. |
| 35 SkCanvas* canvas = cursor->GetCanvas(); | 35 SkCanvas* canvas = cursor->GetCanvas(); |
| 36 canvas->clear(SK_ColorTRANSPARENT); | 36 canvas->clear(SK_ColorTRANSPARENT); |
| 37 | |
| 38 SkRect clip; | |
| 39 clip.set(0, 0, canvas->getBaseLayerSize().width(), | |
| 40 canvas->getBaseLayerSize().height()); | |
| 41 canvas->clipRect(clip, SkRegion::kReplace_Op); | |
| 42 canvas->drawBitmapRect(image, damage, NULL); | 37 canvas->drawBitmapRect(image, damage, NULL); |
| 43 } | 38 } |
| 44 | 39 |
| 45 } // namespace | 40 } // namespace |
| 46 | 41 |
| 47 DrmWindow::DrmWindow(gfx::AcceleratedWidget widget, | 42 DrmWindow::DrmWindow(gfx::AcceleratedWidget widget, |
| 48 DrmDeviceManager* device_manager, | 43 DrmDeviceManager* device_manager, |
| 49 ScreenManager* screen_manager) | 44 ScreenManager* screen_manager) |
| 50 : widget_(widget), | 45 : widget_(widget), |
| 51 device_manager_(device_manager), | 46 device_manager_(device_manager), |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!cursor_buffers_[i]->Initialize( | 246 if (!cursor_buffers_[i]->Initialize( |
| 252 info, false /* should_register_framebuffer */)) { | 247 info, false /* should_register_framebuffer */)) { |
| 253 LOG(FATAL) << "Failed to initialize cursor buffer"; | 248 LOG(FATAL) << "Failed to initialize cursor buffer"; |
| 254 return; | 249 return; |
| 255 } | 250 } |
| 256 } | 251 } |
| 257 } | 252 } |
| 258 } | 253 } |
| 259 | 254 |
| 260 } // namespace ui | 255 } // namespace ui |
| OLD | NEW |