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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 POINT position = {wr.left, wr.top}; | 174 POINT position = {wr.left, wr.top}; |
175 POINT zero = {0, 0}; | 175 POINT zero = {0, 0}; |
176 BLENDFUNCTION blend = {AC_SRC_OVER, 0x00, 0xFF, AC_SRC_ALPHA}; | 176 BLENDFUNCTION blend = {AC_SRC_OVER, 0x00, 0xFF, AC_SRC_ALPHA}; |
177 | 177 |
178 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); | 178 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); |
179 style &= ~WS_EX_COMPOSITED; | 179 style &= ~WS_EX_COMPOSITED; |
180 style |= WS_EX_LAYERED; | 180 style |= WS_EX_LAYERED; |
181 SetWindowLong(hwnd_, GWL_EXSTYLE, style); | 181 SetWindowLong(hwnd_, GWL_EXSTYLE, style); |
182 | 182 |
183 skia::ScopedPlatformPaint spp(contents_.get()); | 183 skia::ScopedPlatformPaint spp(contents_.get()); |
184 HDC dib_dc = spp.GetPlatformSurface(); | 184 HDC dib_dc = spp.GetNativeDrawingContext(); |
185 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, | 185 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, |
186 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 186 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
187 } else { | 187 } else { |
188 HDC hdc = ::GetDC(hwnd_); | 188 HDC hdc = ::GetDC(hwnd_); |
189 RECT src_rect = rect.ToRECT(); | 189 RECT src_rect = rect.ToRECT(); |
190 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(), | 190 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(), |
191 &src_rect); | 191 &src_rect); |
192 ::ReleaseDC(hwnd_, hdc); | 192 ::ReleaseDC(hwnd_, hdc); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 void SoftwareOutputDeviceWin::ReleaseContents() { | 196 void SoftwareOutputDeviceWin::ReleaseContents() { |
197 DCHECK(!contents_ || contents_->unique()); | 197 DCHECK(!contents_ || contents_->unique()); |
198 DCHECK(!in_paint_); | 198 DCHECK(!in_paint_); |
199 contents_.reset(); | 199 contents_.reset(); |
200 } | 200 } |
201 | 201 |
202 } // namespace content | 202 } // namespace content |
OLD | NEW |