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

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

Issue 132163009: [#6]Pass gfx structs by const ref (gfx::Vector2d) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const gfx::Rect& image_rect, 132 const gfx::Rect& image_rect,
133 const gfx::Rect& source_rect, 133 const gfx::Rect& source_rect,
134 gfx::Vector2d dest_offset, 134 const 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
144 if (format == ETC1) { 144 if (format == ETC1) {
(...skipping 23 matching lines...) Expand all
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 const gfx::Rect& image_rect, 176 const gfx::Rect& image_rect,
177 const gfx::Rect& source_rect, 177 const gfx::Rect& source_rect,
178 gfx::Vector2d dest_offset, 178 const 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
188 // Offset from image-rect to source-rect. 188 // Offset from image-rect to source-rect.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const gfx::Rect& image_rect, 230 const gfx::Rect& image_rect,
231 const gfx::Rect& source_rect, 231 const gfx::Rect& source_rect,
232 gfx::Vector2d dest_offset, 232 const 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.
242 DCHECK_NE(ETC1, format); 242 DCHECK_NE(ETC1, format);
(...skipping 81 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

Powered by Google App Engine
This is Rietveld 408576698