| 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 "cc/output/software_output_device.h" | 5 #include "cc/output/software_output_device.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "cc/output/software_frame_data.h" | 8 #include "cc/output/software_frame_data.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkDevice.h" | 10 #include "third_party/skia/include/core/SkDevice.h" |
| 11 #include "ui/gfx/skia_util.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 SoftwareOutputDevice::SoftwareOutputDevice() {} | 15 SoftwareOutputDevice::SoftwareOutputDevice() {} |
| 15 | 16 |
| 16 SoftwareOutputDevice::~SoftwareOutputDevice() {} | 17 SoftwareOutputDevice::~SoftwareOutputDevice() {} |
| 17 | 18 |
| 18 void SoftwareOutputDevice::Resize(gfx::Size viewport_size) { | 19 void SoftwareOutputDevice::Resize(gfx::Size viewport_size) { |
| 19 if (viewport_size_ == viewport_size) | 20 if (viewport_size_ == viewport_size) |
| 20 return; | 21 return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 if (frame_data) { | 37 if (frame_data) { |
| 37 frame_data->size = viewport_size_; | 38 frame_data->size = viewport_size_; |
| 38 frame_data->damage_rect = damage_rect_; | 39 frame_data->damage_rect = damage_rect_; |
| 39 frame_data->dib_id = TransportDIB::Id(); | 40 frame_data->dib_id = TransportDIB::Id(); |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 void SoftwareOutputDevice::CopyToBitmap( | 44 void SoftwareOutputDevice::CopyToBitmap( |
| 44 gfx::Rect rect, SkBitmap* output) { | 45 gfx::Rect rect, SkBitmap* output) { |
| 45 DCHECK(device_); | 46 DCHECK(device_); |
| 46 SkIRect invert_rect = SkIRect::MakeXYWH( | |
| 47 rect.x(), viewport_size_.height() - rect.bottom(), | |
| 48 rect.width(), rect.height()); | |
| 49 const SkBitmap& bitmap = device_->accessBitmap(false); | 47 const SkBitmap& bitmap = device_->accessBitmap(false); |
| 50 bitmap.extractSubset(output, invert_rect); | 48 bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); |
| 51 } | 49 } |
| 52 | 50 |
| 53 void SoftwareOutputDevice::Scroll( | 51 void SoftwareOutputDevice::Scroll( |
| 54 gfx::Vector2d delta, gfx::Rect clip_rect) { | 52 gfx::Vector2d delta, gfx::Rect clip_rect) { |
| 55 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
| 56 } | 54 } |
| 57 | 55 |
| 58 void SoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) { | 56 void SoftwareOutputDevice::ReclaimDIB(const TransportDIB::Id& id) { |
| 59 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
| 60 } | 58 } |
| 61 | 59 |
| 62 } // namespace cc | 60 } // namespace cc |
| OLD | NEW |