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

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

Issue 297573003: Make delegated software renderer work on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build Created 6 years, 7 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 "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"
(...skipping 11 matching lines...) Expand all
22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
23 23
24 LONG style = GetWindowLong(hwnd_, GWL_EXSTYLE); 24 LONG style = GetWindowLong(hwnd_, GWL_EXSTYLE);
25 is_hwnd_composited_ = !!(style & WS_EX_COMPOSITED); 25 is_hwnd_composited_ = !!(style & WS_EX_COMPOSITED);
26 } 26 }
27 27
28 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { 28 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
30 } 30 }
31 31
32 void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_size) { 32 void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_pixel_size,
33 float scale_factor) {
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
34 35
35 if (viewport_size_ == viewport_size) 36 scale_factor_ = scale_factor;
37
38 if (viewport_size_ == viewport_pixel_size)
36 return; 39 return;
37 40
38 viewport_size_ = viewport_size; 41 viewport_size_ = viewport_pixel_size;
39 contents_.reset(new gfx::Canvas(viewport_size, 1.0f, true)); 42 contents_.reset(new gfx::Canvas(viewport_pixel_size, 1.0f, true));
40 memset(&bitmap_info_, 0, sizeof(bitmap_info_)); 43 memset(&bitmap_info_, 0, sizeof(bitmap_info_));
41 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(), 44 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(),
42 &bitmap_info_.bmiHeader); 45 &bitmap_info_.bmiHeader);
43 } 46 }
44 47
45 SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) { 48 SkCanvas* SoftwareOutputDeviceWin::BeginPaint(const gfx::Rect& damage_rect) {
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
47 DCHECK(contents_); 50 DCHECK(contents_);
48 51
49 damage_rect_ = damage_rect; 52 damage_rect_ = damage_rect;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 97
95 void SoftwareOutputDeviceWin::CopyToPixels(const gfx::Rect& rect, 98 void SoftwareOutputDeviceWin::CopyToPixels(const gfx::Rect& rect,
96 void* pixels) { 99 void* pixels) {
97 DCHECK(contents_); 100 DCHECK(contents_);
98 SkImageInfo info = SkImageInfo::MakeN32Premul(rect.width(), rect.height()); 101 SkImageInfo info = SkImageInfo::MakeN32Premul(rect.width(), rect.height());
99 contents_->sk_canvas()->readPixels( 102 contents_->sk_canvas()->readPixels(
100 info, pixels, info.minRowBytes(), rect.x(), rect.y()); 103 info, pixels, info.minRowBytes(), rect.x(), rect.y());
101 } 104 }
102 105
103 } // namespace content 106 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698