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

Side by Side Diff: content/renderer/gpu/compositor_software_output_device.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 (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/child/child_shared_bitmap_manager.h" 9 #include "content/child/child_shared_bitmap_manager.h"
10 #include "content/renderer/render_process.h" 10 #include "content/renderer/render_process.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 for (size_t i = 0; i < buffers_.size(); ++i) { 87 for (size_t i = 0; i < buffers_.size(); ++i) {
88 size_t index = (hint + i) % buffers_.size(); 88 size_t index = (hint + i) % buffers_.size();
89 if (buffers_[index]->free()) 89 if (buffers_[index]->free())
90 return index; 90 return index;
91 } 91 }
92 92
93 buffers_.push_back(CreateBuffer()); 93 buffers_.push_back(CreateBuffer());
94 return buffers_.size() - 1; 94 return buffers_.size() - 1;
95 } 95 }
96 96
97 void CompositorSoftwareOutputDevice::Resize(const gfx::Size& viewport_size) { 97 void CompositorSoftwareOutputDevice::Resize(
98 const gfx::Size& viewport_pixel_size,
99 float scale_factor) {
98 DCHECK(CalledOnValidThread()); 100 DCHECK(CalledOnValidThread());
99 101
100 if (viewport_size_ == viewport_size) 102 scale_factor_ = scale_factor;
103
104 if (viewport_size_ == viewport_pixel_size)
101 return; 105 return;
102 106
103 // Keep non-ACKed buffers in awaiting_ack_ until they get acknowledged. 107 // Keep non-ACKed buffers in awaiting_ack_ until they get acknowledged.
104 for (size_t i = 0; i < buffers_.size(); ++i) { 108 for (size_t i = 0; i < buffers_.size(); ++i) {
105 if (!buffers_[i]->free()) { 109 if (!buffers_[i]->free()) {
106 awaiting_ack_.push_back(buffers_[i]); 110 awaiting_ack_.push_back(buffers_[i]);
107 buffers_[i] = NULL; 111 buffers_[i] = NULL;
108 } 112 }
109 } 113 }
110 114
111 buffers_.clear(); 115 buffers_.clear();
112 current_index_ = -1; 116 current_index_ = -1;
113 viewport_size_ = viewport_size; 117 viewport_size_ = viewport_pixel_size;
114 } 118 }
115 119
116 void CompositorSoftwareOutputDevice::DiscardBackbuffer() { 120 void CompositorSoftwareOutputDevice::DiscardBackbuffer() {
117 // Keep non-ACKed buffers in awaiting_ack_ until they get acknowledged. 121 // Keep non-ACKed buffers in awaiting_ack_ until they get acknowledged.
118 for (size_t i = 0; i < buffers_.size(); ++i) { 122 for (size_t i = 0; i < buffers_.size(); ++i) {
119 if (!buffers_[i]->free()) { 123 if (!buffers_[i]->free()) {
120 awaiting_ack_.push_back(buffers_[i]); 124 awaiting_ack_.push_back(buffers_[i]);
121 buffers_[i] = NULL; 125 buffers_[i] = NULL;
122 } 126 }
123 } 127 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return; 220 return;
217 } else { 221 } else {
218 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(), 222 it = std::find_if(awaiting_ack_.begin(), awaiting_ack_.end(),
219 CompareById(id)); 223 CompareById(id));
220 DCHECK(it != awaiting_ack_.end()); 224 DCHECK(it != awaiting_ack_.end());
221 awaiting_ack_.erase(it); 225 awaiting_ack_.erase(it);
222 } 226 }
223 } 227 }
224 228
225 } // namespace content 229 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698