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