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_win.h" | 5 #include "content/browser/compositor/software_output_device_win.h" |
6 | 6 |
7 #include "base/debug/alias.h" | 7 #include "base/debug/alias.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "cc/resources/shared_bitmap.h" | 9 #include "cc/resources/shared_bitmap.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; | 171 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; |
172 POINT position = {wr.left, wr.top}; | 172 POINT position = {wr.left, wr.top}; |
173 POINT zero = {0, 0}; | 173 POINT zero = {0, 0}; |
174 BLENDFUNCTION blend = {AC_SRC_OVER, 0x00, 0xFF, AC_SRC_ALPHA}; | 174 BLENDFUNCTION blend = {AC_SRC_OVER, 0x00, 0xFF, AC_SRC_ALPHA}; |
175 | 175 |
176 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); | 176 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); |
177 style &= ~WS_EX_COMPOSITED; | 177 style &= ~WS_EX_COMPOSITED; |
178 style |= WS_EX_LAYERED; | 178 style |= WS_EX_LAYERED; |
179 SetWindowLong(hwnd_, GWL_EXSTYLE, style); | 179 SetWindowLong(hwnd_, GWL_EXSTYLE, style); |
180 | 180 |
181 skia::ScopedPlatformPaint spp(contents_.get()); | 181 HDC dib_dc = skia::GetNativeDrawingContext(contents_.get()); |
182 HDC dib_dc = spp.GetNativeDrawingContext(); | |
183 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, | 182 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, |
184 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 183 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
185 } else { | 184 } else { |
186 HDC hdc = ::GetDC(hwnd_); | 185 HDC hdc = ::GetDC(hwnd_); |
187 RECT src_rect = rect.ToRECT(); | 186 RECT src_rect = rect.ToRECT(); |
188 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(), | 187 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(), |
189 &src_rect); | 188 &src_rect); |
190 ::ReleaseDC(hwnd_, hdc); | 189 ::ReleaseDC(hwnd_, hdc); |
191 } | 190 } |
192 } | 191 } |
193 | 192 |
194 void SoftwareOutputDeviceWin::ReleaseContents() { | 193 void SoftwareOutputDeviceWin::ReleaseContents() { |
195 DCHECK(!in_paint_); | 194 DCHECK(!in_paint_); |
196 contents_.reset(); | 195 contents_.reset(); |
197 } | 196 } |
198 | 197 |
199 } // namespace content | 198 } // namespace content |
OLD | NEW |