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

Side by Side Diff: components/bitmap_uploader/bitmap_uploader.cc

Issue 2075853004: Implement SharedQuadStateList StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sky's comments Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/bitmap_uploader/bitmap_uploader.h" 5 #include "components/bitmap_uploader/bitmap_uploader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const gfx::Rect bounds(window_->bounds()); 73 const gfx::Rect bounds(window_->bounds());
74 cc::mojom::RenderPassPtr pass = mojo::CreateDefaultPass(1, bounds); 74 cc::mojom::RenderPassPtr pass = mojo::CreateDefaultPass(1, bounds);
75 mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New(); 75 mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New();
76 76
77 // TODO(rjkroege): Support device scale factor in PDF viewer 77 // TODO(rjkroege): Support device scale factor in PDF viewer
78 frame->metadata.device_scale_factor = 1.0f; 78 frame->metadata.device_scale_factor = 1.0f;
79 79
80 frame->resources.resize(0u); 80 frame->resources.resize(0u);
81 81
82 pass->quads.resize(0u); 82 pass->quads.resize(0u);
83 pass->shared_quad_states.push_back(mojo::CreateDefaultSQS(bounds.size())); 83 // The SharedQuadState is owned by the SharedQuadStateList shared_quad_states.
84 cc::SharedQuadState* sqs =
85 pass->shared_quad_states.AllocateAndConstruct<cc::SharedQuadState>();
86 mojo::ConfigureSharedQuadState(bounds.size(), sqs);
84 87
85 if (bitmap_.get()) { 88 if (bitmap_.get()) {
86 gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); 89 gpu::gles2::GLES2Interface* gl = gles2_context_->interface();
87 gfx::Size bitmap_size(width_, height_); 90 gfx::Size bitmap_size(width_, height_);
88 GLuint texture_id = BindTextureForSize(bitmap_size); 91 GLuint texture_id = BindTextureForSize(bitmap_size);
89 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(), 92 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(),
90 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE, 93 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE,
91 &((*bitmap_)[0])); 94 &((*bitmap_)[0]));
92 95
93 gpu::Mailbox mailbox; 96 gpu::Mailbox mailbox;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DCHECK_EQ(1, resource.count); 206 DCHECK_EQ(1, resource.count);
204 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); 207 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData());
205 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; 208 uint32_t texture_id = resource_to_texture_id_map_[resource.id];
206 DCHECK_NE(0u, texture_id); 209 DCHECK_NE(0u, texture_id);
207 resource_to_texture_id_map_.erase(resource.id); 210 resource_to_texture_id_map_.erase(resource.id);
208 gl->DeleteTextures(1, &texture_id); 211 gl->DeleteTextures(1, &texture_id);
209 } 212 }
210 } 213 }
211 214
212 } // namespace bitmap_uploader 215 } // namespace bitmap_uploader
OLDNEW
« no previous file with comments | « cc/ipc/shared_quad_state_struct_traits.h ('k') | components/mus/public/cpp/surfaces/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698