| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/aura/software_output_device_win.h" | 5 #include "content/browser/aura/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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); | 78 DWORD style = GetWindowLong(hwnd_, GWL_EXSTYLE); |
| 79 style &= ~WS_EX_COMPOSITED; | 79 style &= ~WS_EX_COMPOSITED; |
| 80 style |= WS_EX_LAYERED; | 80 style |= WS_EX_LAYERED; |
| 81 SetWindowLong(hwnd_, GWL_EXSTYLE, style); | 81 SetWindowLong(hwnd_, GWL_EXSTYLE, style); |
| 82 | 82 |
| 83 HDC dib_dc = skia::BeginPlatformPaint(canvas); | 83 HDC dib_dc = skia::BeginPlatformPaint(canvas); |
| 84 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, | 84 ::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero, |
| 85 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 85 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
| 86 skia::EndPlatformPaint(canvas); | 86 skia::EndPlatformPaint(canvas); |
| 87 } else { | 87 } else { |
| 88 SkDevice* device = canvas->getDevice(); | 88 SkBaseDevice* device = canvas->getDevice(); |
| 89 const SkBitmap& bitmap = device->accessBitmap(false); | 89 const SkBitmap& bitmap = device->accessBitmap(false); |
| 90 HDC hdc = ::GetDC(hwnd_); | 90 HDC hdc = ::GetDC(hwnd_); |
| 91 gfx::StretchDIBits(hdc, | 91 gfx::StretchDIBits(hdc, |
| 92 rect.x(), rect.y(), | 92 rect.x(), rect.y(), |
| 93 rect.width(), rect.height(), | 93 rect.width(), rect.height(), |
| 94 rect.x(), rect.y(), | 94 rect.x(), rect.y(), |
| 95 rect.width(), rect.height(), | 95 rect.width(), rect.height(), |
| 96 bitmap.getPixels(), | 96 bitmap.getPixels(), |
| 97 &bitmap_info_); | 97 &bitmap_info_); |
| 98 ::ReleaseDC(hwnd_, hdc); | 98 ::ReleaseDC(hwnd_, hdc); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SoftwareOutputDeviceWin::CopyToBitmap( | 102 void SoftwareOutputDeviceWin::CopyToBitmap( |
| 103 gfx::Rect rect, SkBitmap* output) { | 103 gfx::Rect rect, SkBitmap* output) { |
| 104 DCHECK(contents_); | 104 DCHECK(contents_); |
| 105 SkDevice* device = contents_->sk_canvas()->getDevice(); | 105 SkBaseDevice* device = contents_->sk_canvas()->getDevice(); |
| 106 const SkBitmap& bitmap = device->accessBitmap(false); | 106 const SkBitmap& bitmap = device->accessBitmap(false); |
| 107 bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); | 107 bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace content | 110 } // namespace content |
| OLD | NEW |