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

Side by Side Diff: cc/layers/texture_layer_impl.cc

Issue 221523003: cc: Remove all usage of GetArea() from production code in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: getarea: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/output/software_frame_data.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/texture_layer_impl.h" 5 #include "cc/layers/texture_layer_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "cc/layers/quad_sink.h" 10 #include "cc/layers/quad_sink.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 resource_provider->best_texture_format()); 117 resource_provider->best_texture_format());
118 } 118 }
119 119
120 if (texture_copy_->id()) { 120 if (texture_copy_->id()) {
121 std::vector<uint8> swizzled; 121 std::vector<uint8> swizzled;
122 uint8* pixels = 122 uint8* pixels =
123 static_cast<uint8*>(texture_mailbox_.shared_memory()->memory()); 123 static_cast<uint8*>(texture_mailbox_.shared_memory()->memory());
124 124
125 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) { 125 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) {
126 // Swizzle colors. This is slow, but should be really uncommon. 126 // Swizzle colors. This is slow, but should be really uncommon.
127 swizzled.resize(texture_mailbox_.SharedMemorySizeInBytes()); 127 size_t bytes = texture_mailbox_.SharedMemorySizeInBytes();
128 for (size_t i = 0; i < texture_mailbox_.SharedMemorySizeInBytes(); 128 swizzled.resize(bytes);
129 i += 4) { 129 for (size_t i = 0; i < bytes; i += 4) {
130 swizzled[i] = pixels[i + 2]; 130 swizzled[i] = pixels[i + 2];
131 swizzled[i + 1] = pixels[i + 1]; 131 swizzled[i + 1] = pixels[i + 1];
132 swizzled[i + 2] = pixels[i]; 132 swizzled[i + 2] = pixels[i];
133 swizzled[i + 3] = pixels[i + 3]; 133 swizzled[i + 3] = pixels[i + 3];
134 } 134 }
135 pixels = &swizzled[0]; 135 pixels = &swizzled[0];
136 } 136 }
137 137
138 resource_provider->SetPixels( 138 resource_provider->SetPixels(
139 texture_copy_->id(), 139 texture_copy_->id(),
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } else if (external_texture_resource_) { 287 } else if (external_texture_resource_) {
288 DCHECK(!own_mailbox_); 288 DCHECK(!own_mailbox_);
289 ResourceProvider* resource_provider = 289 ResourceProvider* resource_provider =
290 layer_tree_impl()->resource_provider(); 290 layer_tree_impl()->resource_provider();
291 resource_provider->DeleteResource(external_texture_resource_); 291 resource_provider->DeleteResource(external_texture_resource_);
292 external_texture_resource_ = 0; 292 external_texture_resource_ = 0;
293 } 293 }
294 } 294 }
295 295
296 } // namespace cc 296 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/software_frame_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698