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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/texture_layer_unittest.cc » ('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/output/renderer.h" 10 #include "cc/output/renderer.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 texture_copy_->Free(); 104 texture_copy_->Free();
105 105
106 if (!texture_copy_->id()) { 106 if (!texture_copy_->id()) {
107 texture_copy_->Allocate(texture_mailbox_.shared_memory_size(), 107 texture_copy_->Allocate(texture_mailbox_.shared_memory_size(),
108 ResourceProvider::TextureHintImmutable, 108 ResourceProvider::TextureHintImmutable,
109 resource_provider->best_texture_format()); 109 resource_provider->best_texture_format());
110 } 110 }
111 111
112 if (texture_copy_->id()) { 112 if (texture_copy_->id()) {
113 std::vector<uint8> swizzled; 113 std::vector<uint8> swizzled;
114 uint8* pixels = 114 uint8* pixels = texture_mailbox_.shared_bitmap()->pixels();
115 static_cast<uint8*>(texture_mailbox_.shared_memory()->memory());
116 115
117 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) { 116 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) {
118 // Swizzle colors. This is slow, but should be really uncommon. 117 // Swizzle colors. This is slow, but should be really uncommon.
119 size_t bytes = texture_mailbox_.SharedMemorySizeInBytes(); 118 size_t bytes = texture_mailbox_.SharedMemorySizeInBytes();
120 swizzled.resize(bytes); 119 swizzled.resize(bytes);
121 for (size_t i = 0; i < bytes; i += 4) { 120 for (size_t i = 0; i < bytes; i += 4) {
122 swizzled[i] = pixels[i + 2]; 121 swizzled[i] = pixels[i + 2];
123 swizzled[i + 1] = pixels[i + 1]; 122 swizzled[i + 1] = pixels[i + 1];
124 swizzled[i + 2] = pixels[i]; 123 swizzled[i + 2] = pixels[i];
125 swizzled[i + 3] = pixels[i + 3]; 124 swizzled[i + 3] = pixels[i + 3];
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } else if (external_texture_resource_) { 256 } else if (external_texture_resource_) {
258 DCHECK(!own_mailbox_); 257 DCHECK(!own_mailbox_);
259 ResourceProvider* resource_provider = 258 ResourceProvider* resource_provider =
260 layer_tree_impl()->resource_provider(); 259 layer_tree_impl()->resource_provider();
261 resource_provider->DeleteResource(external_texture_resource_); 260 resource_provider->DeleteResource(external_texture_resource_);
262 external_texture_resource_ = 0; 261 external_texture_resource_ = 0;
263 } 262 }
264 } 263 }
265 264
266 } // namespace cc 265 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698