Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: content/browser/compositor/software_output_device_win.cc

Issue 1839113002: Limit manual control of platform painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; 173 SIZE size = {wr.right - wr.left, wr.bottom - wr.top};
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 HDC dib_dc = skia::BeginPlatformPaint(contents_.get()); 183 skia::ScopedPlatformPaint spp (contents_.get());
f(malita) 2016/03/29 17:31:07 Nit: extra space
tomhudson 2016/03/29 17:47:31 Done.
184 HDC dib_dc = spp.GetPlatformSurface();
184 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, 185 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero,
185 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); 186 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
186 skia::EndPlatformPaint(contents_.get());
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_.clear(); 199 contents_.clear();
200 } 200 }
201 201
202 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | skia/ext/bitmap_platform_device_cairo.h » ('j') | skia/ext/bitmap_platform_device_cairo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698