| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "cc/ipc/compositor_frame.mojom.h" |
| 12 #include "components/mus/public/cpp/gles2_context.h" | 13 #include "components/mus/public/cpp/gles2_context.h" |
| 13 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" | 14 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" |
| 14 #include "components/mus/public/cpp/surfaces/surfaces_utils.h" | 15 #include "components/mus/public/cpp/surfaces/surfaces_utils.h" |
| 15 #include "components/mus/public/cpp/window.h" | 16 #include "components/mus/public/cpp/window.h" |
| 16 #include "components/mus/public/cpp/window_surface.h" | 17 #include "components/mus/public/cpp/window_surface.h" |
| 17 | 18 |
| 18 namespace bitmap_uploader { | 19 namespace bitmap_uploader { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const uint32_t g_transparent_color = 0x00000000; | 22 const uint32_t g_transparent_color = 0x00000000; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 height_ = height; | 66 height_ = height; |
| 66 bitmap_ = std::move(data); | 67 bitmap_ = std::move(data); |
| 67 format_ = format; | 68 format_ = format; |
| 68 if (surface_) | 69 if (surface_) |
| 69 Upload(); | 70 Upload(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void BitmapUploader::Upload() { | 73 void BitmapUploader::Upload() { |
| 73 const gfx::Rect bounds(window_->bounds()); | 74 const gfx::Rect bounds(window_->bounds()); |
| 74 cc::mojom::RenderPassPtr pass = mojo::CreateDefaultPass(1, bounds); | 75 cc::mojom::RenderPassPtr pass = mojo::CreateDefaultPass(1, bounds); |
| 75 mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New(); | 76 cc::mojom::CompositorFramePtr frame = cc::mojom::CompositorFrame::New(); |
| 76 | 77 |
| 77 // TODO(rjkroege): Support device scale factor in PDF viewer | 78 // TODO(rjkroege): Support device scale factor in PDF viewer |
| 78 frame->metadata.device_scale_factor = 1.0f; | 79 frame->metadata.device_scale_factor = 1.0f; |
| 79 | 80 |
| 80 frame->resources.resize(0u); | 81 frame->resources.resize(0u); |
| 81 | 82 |
| 82 pass->quads.resize(0u); | 83 pass->quads.resize(0u); |
| 83 // The SharedQuadState is owned by the SharedQuadStateList shared_quad_states. | 84 // The SharedQuadState is owned by the SharedQuadStateList shared_quad_states. |
| 84 cc::SharedQuadState* sqs = | 85 cc::SharedQuadState* sqs = |
| 85 pass->shared_quad_states.AllocateAndConstruct<cc::SharedQuadState>(); | 86 pass->shared_quad_states.AllocateAndConstruct<cc::SharedQuadState>(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 DCHECK_EQ(1, resource.count); | 207 DCHECK_EQ(1, resource.count); |
| 207 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); | 208 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); |
| 208 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; | 209 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; |
| 209 DCHECK_NE(0u, texture_id); | 210 DCHECK_NE(0u, texture_id); |
| 210 resource_to_texture_id_map_.erase(resource.id); | 211 resource_to_texture_id_map_.erase(resource.id); |
| 211 gl->DeleteTextures(1, &texture_id); | 212 gl->DeleteTextures(1, &texture_id); |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 } // namespace bitmap_uploader | 216 } // namespace bitmap_uploader |
| OLD | NEW |