OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // TODO(rjkroege): Support device scale factor in PDF viewer | 87 // TODO(rjkroege): Support device scale factor in PDF viewer |
88 mus::mojom::CompositorFrameMetadataPtr meta = | 88 mus::mojom::CompositorFrameMetadataPtr meta = |
89 mus::mojom::CompositorFrameMetadata::New(); | 89 mus::mojom::CompositorFrameMetadata::New(); |
90 meta->device_scale_factor = 1.0f; | 90 meta->device_scale_factor = 1.0f; |
91 frame->metadata = std::move(meta); | 91 frame->metadata = std::move(meta); |
92 | 92 |
93 frame->resources.resize(0u); | 93 frame->resources.resize(0u); |
94 | 94 |
95 pass->quads.resize(0u); | 95 pass->quads.resize(0u); |
96 pass->shared_quad_states.push_back( | 96 pass->shared_quad_states.push_back(mojo::CreateDefaultSQS(bounds.size())); |
97 mojo::CreateDefaultSQS(bounds.size())); | |
98 | 97 |
99 if (bitmap_.get()) { | 98 if (bitmap_.get()) { |
100 gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); | 99 gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); |
101 gfx::Size bitmap_size(width_, height_); | 100 gfx::Size bitmap_size(width_, height_); |
102 GLuint texture_id = BindTextureForSize(bitmap_size); | 101 GLuint texture_id = BindTextureForSize(bitmap_size); |
103 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(), | 102 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width(), |
104 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE, | 103 bitmap_size.height(), TextureFormat(), GL_UNSIGNED_BYTE, |
105 &((*bitmap_)[0])); | 104 &((*bitmap_)[0])); |
106 | 105 |
107 gpu::Mailbox mailbox; | 106 gpu::Mailbox mailbox; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 DCHECK_EQ(1, resource.count); | 218 DCHECK_EQ(1, resource.count); |
220 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); | 219 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); |
221 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; | 220 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; |
222 DCHECK_NE(0u, texture_id); | 221 DCHECK_NE(0u, texture_id); |
223 resource_to_texture_id_map_.erase(resource.id); | 222 resource_to_texture_id_map_.erase(resource.id); |
224 gl->DeleteTextures(1, &texture_id); | 223 gl->DeleteTextures(1, &texture_id); |
225 } | 224 } |
226 } | 225 } |
227 | 226 |
228 } // namespace bitmap_uploader | 227 } // namespace bitmap_uploader |
OLD | NEW |