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

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

Issue 2042643002: Implement cc::CompositorFrameMetadata StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment 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
« no previous file with comments | « cc/ipc/typemaps.gni ('k') | components/mus/public/cpp/surfaces/custom_surface_converter.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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (surface_) 68 if (surface_)
69 Upload(); 69 Upload();
70 } 70 }
71 71
72 void BitmapUploader::Upload() { 72 void BitmapUploader::Upload() {
73 const gfx::Rect bounds(window_->bounds()); 73 const gfx::Rect bounds(window_->bounds());
74 mus::mojom::PassPtr pass = mojo::CreateDefaultPass(1, bounds); 74 mus::mojom::PassPtr 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 mus::mojom::CompositorFrameMetadataPtr meta = 78 frame->metadata.device_scale_factor = 1.0f;
79 mus::mojom::CompositorFrameMetadata::New();
80 meta->device_scale_factor = 1.0f;
81 frame->metadata = std::move(meta);
82 79
83 frame->resources.resize(0u); 80 frame->resources.resize(0u);
84 81
85 pass->quads.resize(0u); 82 pass->quads.resize(0u);
86 pass->shared_quad_states.push_back(mojo::CreateDefaultSQS(bounds.size())); 83 pass->shared_quad_states.push_back(mojo::CreateDefaultSQS(bounds.size()));
87 84
88 if (bitmap_.get()) { 85 if (bitmap_.get()) {
89 gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); 86 gpu::gles2::GLES2Interface* gl = gles2_context_->interface();
90 gfx::Size bitmap_size(width_, height_); 87 gfx::Size bitmap_size(width_, height_);
91 GLuint texture_id = BindTextureForSize(bitmap_size); 88 GLuint texture_id = BindTextureForSize(bitmap_size);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 DCHECK_EQ(1, resource.count); 205 DCHECK_EQ(1, resource.count);
209 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); 206 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData());
210 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; 207 uint32_t texture_id = resource_to_texture_id_map_[resource.id];
211 DCHECK_NE(0u, texture_id); 208 DCHECK_NE(0u, texture_id);
212 resource_to_texture_id_map_.erase(resource.id); 209 resource_to_texture_id_map_.erase(resource.id);
213 gl->DeleteTextures(1, &texture_id); 210 gl->DeleteTextures(1, &texture_id);
214 } 211 }
215 } 212 }
216 213
217 } // namespace bitmap_uploader 214 } // namespace bitmap_uploader
OLDNEW
« no previous file with comments | « cc/ipc/typemaps.gni ('k') | components/mus/public/cpp/surfaces/custom_surface_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698