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

Side by Side Diff: cc/scheduler/texture_uploader.cc

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 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
« no previous file with comments | « cc/scheduler/texture_uploader.h ('k') | cc/test/fake_content_layer_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/scheduler/texture_uploader.h" 5 #include "cc/scheduler/texture_uploader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 available_queries_.front()->Begin(); 122 available_queries_.front()->Begin();
123 } 123 }
124 124
125 void TextureUploader::EndQuery() { 125 void TextureUploader::EndQuery() {
126 available_queries_.front()->End(); 126 available_queries_.front()->End();
127 pending_queries_.push_back(available_queries_.take_front()); 127 pending_queries_.push_back(available_queries_.take_front());
128 num_blocking_texture_uploads_++; 128 num_blocking_texture_uploads_++;
129 } 129 }
130 130
131 void TextureUploader::Upload(const uint8* image, 131 void TextureUploader::Upload(const uint8* image,
132 gfx::Rect image_rect, 132 const gfx::Rect& image_rect,
133 gfx::Rect source_rect, 133 const gfx::Rect& source_rect,
134 gfx::Vector2d dest_offset, 134 gfx::Vector2d dest_offset,
135 ResourceFormat format, 135 ResourceFormat format,
136 gfx::Size size) { 136 gfx::Size size) {
137 CHECK(image_rect.Contains(source_rect)); 137 CHECK(image_rect.Contains(source_rect));
138 138
139 bool is_full_upload = dest_offset.IsZero() && source_rect.size() == size; 139 bool is_full_upload = dest_offset.IsZero() && source_rect.size() == size;
140 140
141 if (is_full_upload) 141 if (is_full_upload)
142 BeginQuery(); 142 BeginQuery();
143 143
(...skipping 22 matching lines...) Expand all
166 166
167 num_texture_uploads_since_last_flush_ = 0; 167 num_texture_uploads_since_last_flush_ = 0;
168 } 168 }
169 169
170 void TextureUploader::ReleaseCachedQueries() { 170 void TextureUploader::ReleaseCachedQueries() {
171 ProcessQueries(); 171 ProcessQueries();
172 available_queries_.clear(); 172 available_queries_.clear();
173 } 173 }
174 174
175 void TextureUploader::UploadWithTexSubImage(const uint8* image, 175 void TextureUploader::UploadWithTexSubImage(const uint8* image,
176 gfx::Rect image_rect, 176 const gfx::Rect& image_rect,
177 gfx::Rect source_rect, 177 const gfx::Rect& source_rect,
178 gfx::Vector2d dest_offset, 178 gfx::Vector2d dest_offset,
179 ResourceFormat format) { 179 ResourceFormat format) {
180 TRACE_EVENT0("cc", "TextureUploader::UploadWithTexSubImage"); 180 TRACE_EVENT0("cc", "TextureUploader::UploadWithTexSubImage");
181 181
182 // Early-out if this is a no-op, and assert that |image| be valid if this is 182 // Early-out if this is a no-op, and assert that |image| be valid if this is
183 // not a no-op. 183 // not a no-op.
184 if (source_rect.IsEmpty()) 184 if (source_rect.IsEmpty())
185 return; 185 return;
186 DCHECK(image); 186 DCHECK(image);
187 187
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 dest_offset.x(), 220 dest_offset.x(),
221 dest_offset.y(), 221 dest_offset.y(),
222 source_rect.width(), 222 source_rect.width(),
223 source_rect.height(), 223 source_rect.height(),
224 GLDataFormat(format), 224 GLDataFormat(format),
225 GLDataType(format), 225 GLDataType(format),
226 pixel_source); 226 pixel_source);
227 } 227 }
228 228
229 void TextureUploader::UploadWithMapTexSubImage(const uint8* image, 229 void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
230 gfx::Rect image_rect, 230 const gfx::Rect& image_rect,
231 gfx::Rect source_rect, 231 const gfx::Rect& source_rect,
232 gfx::Vector2d dest_offset, 232 gfx::Vector2d dest_offset,
233 ResourceFormat format) { 233 ResourceFormat format) {
234 TRACE_EVENT0("cc", "TextureUploader::UploadWithMapTexSubImage"); 234 TRACE_EVENT0("cc", "TextureUploader::UploadWithMapTexSubImage");
235 235
236 // Early-out if this is a no-op, and assert that |image| be valid if this is 236 // Early-out if this is a no-op, and assert that |image| be valid if this is
237 // not a no-op. 237 // not a no-op.
238 if (source_rect.IsEmpty()) 238 if (source_rect.IsEmpty())
239 return; 239 return;
240 DCHECK(image); 240 DCHECK(image);
241 // Compressed textures have no implementation of mapTexSubImage. 241 // Compressed textures have no implementation of mapTexSubImage.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 textures_per_second_history_.erase(textures_per_second_history_.begin()); 324 textures_per_second_history_.erase(textures_per_second_history_.begin());
325 textures_per_second_history_.erase(--textures_per_second_history_.end()); 325 textures_per_second_history_.erase(--textures_per_second_history_.end());
326 } 326 }
327 textures_per_second_history_.insert(textures_per_second); 327 textures_per_second_history_.insert(textures_per_second);
328 328
329 available_queries_.push_back(pending_queries_.take_front()); 329 available_queries_.push_back(pending_queries_.take_front());
330 } 330 }
331 } 331 }
332 332
333 } // namespace cc 333 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/texture_uploader.h ('k') | cc/test/fake_content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698