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 "content/browser/compositor/software_output_device_x11.h" | 5 #include "content/browser/compositor/software_output_device_x11.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/Xutil.h> | 8 #include <X11/Xutil.h> |
9 | 9 |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "third_party/skia/include/core/SkDevice.h" | 12 #include "third_party/skia/include/core/SkDevice.h" |
13 #include "ui/base/x/x11_util.h" | 13 #include "ui/base/x/x11_util.h" |
14 #include "ui/base/x/x11_util_internal.h" | 14 #include "ui/base/x/x11_util_internal.h" |
15 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
16 #include "ui/gfx/x/x11_types.h" | 16 #include "ui/gfx/x/x11_types.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(ui::Compositor* compositor) | 20 SoftwareOutputDeviceX11::SoftwareOutputDeviceX11(ui::Compositor* compositor) |
21 : compositor_(compositor), display_(gfx::GetXDisplay()), gc_(NULL) { | 21 : compositor_(compositor), display_(gfx::GetXDisplay()), gc_(NULL) { |
22 // TODO(skaslev) Remove this when crbug.com/180702 is fixed. | 22 // TODO(skaslev) Remove this when crbug.com/180702 is fixed. |
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 23 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
24 | 24 |
25 gc_ = XCreateGC(display_, compositor_->widget(), 0, NULL); | 25 gc_ = XCreateGC(display_, compositor_->widget(), 0, NULL); |
26 if (!XGetWindowAttributes(display_, compositor_->widget(), &attributes_)) { | 26 if (!XGetWindowAttributes(display_, compositor_->widget(), &attributes_)) { |
27 LOG(ERROR) << "XGetWindowAttributes failed for window " | 27 LOG(ERROR) << "XGetWindowAttributes failed for window " |
28 << compositor_->widget(); | 28 << compositor_->widget(); |
29 return; | 29 return; |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 SoftwareOutputDeviceX11::~SoftwareOutputDeviceX11() { | 33 SoftwareOutputDeviceX11::~SoftwareOutputDeviceX11() { |
34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 34 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
35 | 35 |
36 XFreeGC(display_, gc_); | 36 XFreeGC(display_, gc_); |
37 } | 37 } |
38 | 38 |
39 void SoftwareOutputDeviceX11::EndPaint(cc::SoftwareFrameData* frame_data) { | 39 void SoftwareOutputDeviceX11::EndPaint(cc::SoftwareFrameData* frame_data) { |
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
41 DCHECK(surface_); | 41 DCHECK(surface_); |
42 DCHECK(frame_data); | 42 DCHECK(frame_data); |
43 | 43 |
44 if (!surface_) | 44 if (!surface_) |
45 return; | 45 return; |
46 | 46 |
47 SoftwareOutputDevice::EndPaint(frame_data); | 47 SoftwareOutputDevice::EndPaint(frame_data); |
48 | 48 |
49 gfx::Rect rect = damage_rect_; | 49 gfx::Rect rect = damage_rect_; |
50 rect.Intersect(gfx::Rect(viewport_pixel_size_)); | 50 rect.Intersect(gfx::Rect(viewport_pixel_size_)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 viewport_pixel_size_.height(), | 129 viewport_pixel_size_.height(), |
130 rect.x(), | 130 rect.x(), |
131 rect.y(), | 131 rect.y(), |
132 rect.x(), | 132 rect.x(), |
133 rect.y(), | 133 rect.y(), |
134 rect.width(), | 134 rect.width(), |
135 rect.height()); | 135 rect.height()); |
136 } | 136 } |
137 | 137 |
138 } // namespace content | 138 } // namespace content |
OLD | NEW |