| Index: content/browser/renderer_host/software_output_device_win.cc
|
| diff --git a/content/browser/renderer_host/software_output_device_win.cc b/content/browser/renderer_host/software_output_device_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..097fbb9df051d3358599f5286833fc0dba6a617e
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/software_output_device_win.cc
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/renderer_host/software_output_device.h"
|
| +
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| +#include "third_party/skia/include/core/SkDevice.h"
|
| +#include "ui/compositor/compositor.h"
|
| +#include "ui/gfx/gdi_util.h"
|
| +
|
| +namespace content {
|
| +
|
| +SoftwareOutputDevice::SoftwareOutputDevice(ui::Compositor* compositor)
|
| + : compositor_(compositor) {
|
| + hdc_ = ::GetWindowDC(compositor->widget());
|
| +}
|
| +
|
| +SoftwareOutputDevice::~SoftwareOutputDevice() {
|
| + ::ReleaseDC(compositor_->widget(), hdc_);
|
| +}
|
| +
|
| +void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) {
|
| + cc::SoftwareOutputDevice::Resize(viewport_size);
|
| + gfx::CreateBitmapHeader(viewport_size_.width(),
|
| + viewport_size_.height(), &bitmap_header_);
|
| +}
|
| +
|
| +void SoftwareOutputDevice::EndPaint(cc::SoftwareFrameData* frame_data) {
|
| + DCHECK(device_);
|
| + DCHECK(frame_data == NULL);
|
| +
|
| + if (!device_)
|
| + return;
|
| +
|
| + gfx::Rect rect = damage_rect_;
|
| + rect.Intersect(gfx::Rect(viewport_size_));
|
| + if (rect.IsEmpty())
|
| + return;
|
| +
|
| + const SkBitmap& bitmap = device_->accessBitmap(false);
|
| + gfx::StretchDIBits(hdc_,
|
| + rect.x(), rect.y(),
|
| + rect.width(), rect.height(),
|
| + rect.x(), rect.y(),
|
| + rect.width(), rect.height(),
|
| + bitmap.getPixels(),
|
| + reinterpret_cast<BITMAPINFO*>(&bitmap_header_));
|
| +}
|
| +
|
| +} // namespace content
|
|
|