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

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: 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 cc::SharedQuadState* sqs =
84 pass->shared_quad_states.AllocateAndConstruct<cc::SharedQuadState>();
sky 2016/06/17 23:05:36 Who owns the return value?
Fady Samuel 2016/06/18 01:27:51 Added a comment. It's owned by the shared_quad_sta
85 mojo::CreateDefaultSQS(bounds.size(), sqs);
84 86
85 if (bitmap_.get()) { 87 if (bitmap_.get()) {
86 gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); 88 gpu::gles2::GLES2Interface* gl = gles2_context_->interface();
87 gfx::Size bitmap_size(width_, height_); 89 gfx::Size bitmap_size(width_, height_);
88 GLuint texture_id = BindTextureForSize(bitmap_size); 90 GLuint texture_id = BindTextureForSize(bitmap_size);
89 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(), 91 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(),
90 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE, 92 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE,
91 &((*bitmap_)[0])); 93 &((*bitmap_)[0]));
92 94
93 gpu::Mailbox mailbox; 95 gpu::Mailbox mailbox;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DCHECK_EQ(1, resource.count); 205 DCHECK_EQ(1, resource.count);
204 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); 206 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData());
205 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; 207 uint32_t texture_id = resource_to_texture_id_map_[resource.id];
206 DCHECK_NE(0u, texture_id); 208 DCHECK_NE(0u, texture_id);
207 resource_to_texture_id_map_.erase(resource.id); 209 resource_to_texture_id_map_.erase(resource.id);
208 gl->DeleteTextures(1, &texture_id); 210 gl->DeleteTextures(1, &texture_id);
209 } 211 }
210 } 212 }
211 213
212 } // namespace bitmap_uploader 214 } // namespace bitmap_uploader
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698