OLD | NEW |
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/renderer/gpu/compositor_software_output_device.h" | 5 #include "content/renderer/gpu/compositor_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 "content/renderer/render_process.h" | 9 #include "content/renderer/render_process.h" |
| 10 #include "third_party/skia/include/core/SkBitmapDevice.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
11 #include "third_party/skia/include/core/SkDevice.h" | |
12 #include "third_party/skia/include/core/SkPixelRef.h" | 12 #include "third_party/skia/include/core/SkPixelRef.h" |
13 #include "third_party/skia/include/core/SkRegion.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
14 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 CompositorSoftwareOutputDevice::Buffer::Buffer( | 18 CompositorSoftwareOutputDevice::Buffer::Buffer( |
19 unsigned id, scoped_ptr<base::SharedMemory> mem) | 19 unsigned id, scoped_ptr<base::SharedMemory> mem) |
20 : id_(id), | 20 : id_(id), |
21 mem_(mem.Pass()), | 21 mem_(mem.Pass()), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 current_index_ = FindFreeBuffer(current_index_ + 1); | 140 current_index_ = FindFreeBuffer(current_index_ + 1); |
141 Buffer* current = buffers_[current_index_]; | 141 Buffer* current = buffers_[current_index_]; |
142 DCHECK(current->free()); | 142 DCHECK(current->free()); |
143 current->SetFree(false); | 143 current->SetFree(false); |
144 | 144 |
145 // Set up a canvas for the current front buffer. | 145 // Set up a canvas for the current front buffer. |
146 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, | 146 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, |
147 viewport_size_.width(), | 147 viewport_size_.width(), |
148 viewport_size_.height()); | 148 viewport_size_.height()); |
149 bitmap_.setPixels(current->memory()); | 149 bitmap_.setPixels(current->memory()); |
150 device_ = skia::AdoptRef(new SkDevice(bitmap_)); | 150 device_ = skia::AdoptRef(new SkBitmapDevice(bitmap_)); |
151 canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); | 151 canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); |
152 | 152 |
153 if (!previous) { | 153 if (!previous) { |
154 DCHECK(damage_rect == gfx::Rect(viewport_size_)); | 154 DCHECK(damage_rect == gfx::Rect(viewport_size_)); |
155 } else { | 155 } else { |
156 // Find the smallest damage region that needs | 156 // Find the smallest damage region that needs |
157 // to be copied from the |previous| buffer. | 157 // to be copied from the |previous| buffer. |
158 SkRegion region; | 158 SkRegion region; |
159 bool found = | 159 bool found = |
160 current->FindDamageDifferenceFrom(previous, ®ion) || | 160 current->FindDamageDifferenceFrom(previous, ®ion) || |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 return; | 219 return; |
220 } else { | 220 } else { |
221 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), | 221 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), |
222 CompareById(id)); | 222 CompareById(id)); |
223 DCHECK(it != awaiting_ack_.end()); | 223 DCHECK(it != awaiting_ack_.end()); |
224 awaiting_ack_.erase(it); | 224 awaiting_ack_.erase(it); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 } // namespace content | 228 } // namespace content |
OLD | NEW |