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

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

Issue 13261005: Fixed a rendering glitch with window borders for Aura on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/software_output_device_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer_host/software_output_device_win.h" 5 #include "content/browser/renderer_host/software_output_device_win.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkDevice.h" 9 #include "third_party/skia/include/core/SkDevice.h"
10 #include "ui/compositor/compositor.h" 10 #include "ui/compositor/compositor.h"
11 #include "ui/gfx/gdi_util.h" 11 #include "ui/gfx/gdi_util.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(ui::Compositor* compositor) 15 SoftwareOutputDeviceWin::SoftwareOutputDeviceWin(ui::Compositor* compositor)
16 : compositor_(compositor) { 16 : compositor_(compositor) {
17 // TODO(skaslev) Remove this when crbug.com/180702 is fixed. 17 // TODO(skaslev) Remove this when crbug.com/180702 is fixed.
18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
19 19
20 hdc_ = ::GetWindowDC(compositor->widget()); 20 hwnd_ = compositor->widget();
21 } 21 }
22 22
23 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { 23 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() {
24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
25
26 ::ReleaseDC(compositor_->widget(), hdc_);
27 } 25 }
28 26
29 void SoftwareOutputDeviceWin::Resize(gfx::Size viewport_size) { 27 void SoftwareOutputDeviceWin::Resize(gfx::Size viewport_size) {
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
31 29
32 cc::SoftwareOutputDevice::Resize(viewport_size); 30 cc::SoftwareOutputDevice::Resize(viewport_size);
33 memset(&bitmap_info_, 0, sizeof(bitmap_info_)); 31 memset(&bitmap_info_, 0, sizeof(bitmap_info_));
34 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(), 32 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(),
35 &bitmap_info_.bmiHeader); 33 &bitmap_info_.bmiHeader);
36 } 34 }
37 35
38 void SoftwareOutputDeviceWin::EndPaint(cc::SoftwareFrameData* frame_data) { 36 void SoftwareOutputDeviceWin::EndPaint(cc::SoftwareFrameData* frame_data) {
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
40 DCHECK(device_); 38 DCHECK(device_);
41 DCHECK(frame_data == NULL); 39 DCHECK(frame_data == NULL);
42 40
43 if (!device_) 41 if (!device_)
44 return; 42 return;
45 43
46 gfx::Rect rect = damage_rect_; 44 gfx::Rect rect = damage_rect_;
47 rect.Intersect(gfx::Rect(viewport_size_)); 45 rect.Intersect(gfx::Rect(viewport_size_));
48 if (rect.IsEmpty()) 46 if (rect.IsEmpty())
49 return; 47 return;
50 48
51 const SkBitmap& bitmap = device_->accessBitmap(false); 49 const SkBitmap& bitmap = device_->accessBitmap(false);
52 gfx::StretchDIBits(hdc_, 50 HDC hdc = ::GetDC(hwnd_);
51 gfx::StretchDIBits(hdc,
53 rect.x(), rect.y(), 52 rect.x(), rect.y(),
54 rect.width(), rect.height(), 53 rect.width(), rect.height(),
55 rect.x(), rect.y(), 54 rect.x(), rect.y(),
56 rect.width(), rect.height(), 55 rect.width(), rect.height(),
57 bitmap.getPixels(), 56 bitmap.getPixels(),
58 &bitmap_info_); 57 &bitmap_info_);
58 ::ReleaseDC(hwnd_, hdc);
59 } 59 }
60 60
61 } // namespace content 61 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/software_output_device_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698