| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 quad->visible_rect = rect; | 135 quad->visible_rect = rect; |
| 136 quad->needs_blending = true; | 136 quad->needs_blending = true; |
| 137 quad->shared_quad_state_index = 0u; | 137 quad->shared_quad_state_index = 0u; |
| 138 | 138 |
| 139 cc::mojom::TextureQuadStatePtr texture_state = | 139 cc::mojom::TextureQuadStatePtr texture_state = |
| 140 cc::mojom::TextureQuadState::New(); | 140 cc::mojom::TextureQuadState::New(); |
| 141 texture_state->resource_id = resource.id; | 141 texture_state->resource_id = resource.id; |
| 142 texture_state->premultiplied_alpha = true; | 142 texture_state->premultiplied_alpha = true; |
| 143 texture_state->uv_top_left.SetPoint(0.f, 0.f); | 143 texture_state->uv_top_left.SetPoint(0.f, 0.f); |
| 144 texture_state->uv_bottom_right.SetPoint(1.f, 1.f); | 144 texture_state->uv_bottom_right.SetPoint(1.f, 1.f); |
| 145 texture_state->background_color = cc::mojom::Color::New(); | 145 texture_state->background_color = g_transparent_color; |
| 146 texture_state->background_color->rgba = g_transparent_color; | |
| 147 for (int i = 0; i < 4; ++i) | 146 for (int i = 0; i < 4; ++i) |
| 148 texture_state->vertex_opacity.push_back(1.f); | 147 texture_state->vertex_opacity.push_back(1.f); |
| 149 texture_state->y_flipped = false; | 148 texture_state->y_flipped = false; |
| 150 | 149 |
| 151 frame->resources.push_back(std::move(resource)); | 150 frame->resources.push_back(std::move(resource)); |
| 152 quad->texture_quad_state = std::move(texture_state); | 151 quad->texture_quad_state = std::move(texture_state); |
| 153 pass->quads.push_back(std::move(quad)); | 152 pass->quads.push_back(std::move(quad)); |
| 154 } | 153 } |
| 155 | 154 |
| 156 if (color_ != g_transparent_color) { | 155 if (color_ != g_transparent_color) { |
| 157 cc::mojom::DrawQuadPtr quad = cc::mojom::DrawQuad::New(); | 156 cc::mojom::DrawQuadPtr quad = cc::mojom::DrawQuad::New(); |
| 158 quad->material = cc::mojom::Material::SOLID_COLOR; | 157 quad->material = cc::mojom::Material::SOLID_COLOR; |
| 159 quad->rect = bounds; | 158 quad->rect = bounds; |
| 160 quad->visible_rect = bounds; | 159 quad->visible_rect = bounds; |
| 161 quad->needs_blending = true; | 160 quad->needs_blending = true; |
| 162 quad->shared_quad_state_index = 0u; | 161 quad->shared_quad_state_index = 0u; |
| 163 | 162 |
| 164 cc::mojom::SolidColorQuadStatePtr color_state = | 163 cc::mojom::SolidColorQuadStatePtr color_state = |
| 165 cc::mojom::SolidColorQuadState::New(); | 164 cc::mojom::SolidColorQuadState::New(); |
| 166 color_state->color = cc::mojom::Color::New(); | 165 color_state->color = color_; |
| 167 color_state->color->rgba = color_; | |
| 168 color_state->force_anti_aliasing_off = false; | 166 color_state->force_anti_aliasing_off = false; |
| 169 | 167 |
| 170 quad->solid_color_quad_state = std::move(color_state); | 168 quad->solid_color_quad_state = std::move(color_state); |
| 171 pass->quads.push_back(std::move(quad)); | 169 pass->quads.push_back(std::move(quad)); |
| 172 } | 170 } |
| 173 | 171 |
| 174 frame->passes.push_back(std::move(pass)); | 172 frame->passes.push_back(std::move(pass)); |
| 175 | 173 |
| 176 // TODO(rjkroege, fsamuel): We should throttle frames. | 174 // TODO(rjkroege, fsamuel): We should throttle frames. |
| 177 surface_->SubmitCompositorFrame(std::move(frame), mojo::Closure()); | 175 surface_->SubmitCompositorFrame(std::move(frame), mojo::Closure()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 205 DCHECK_EQ(1, resource.count); | 203 DCHECK_EQ(1, resource.count); |
| 206 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); | 204 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); |
| 207 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; | 205 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; |
| 208 DCHECK_NE(0u, texture_id); | 206 DCHECK_NE(0u, texture_id); |
| 209 resource_to_texture_id_map_.erase(resource.id); | 207 resource_to_texture_id_map_.erase(resource.id); |
| 210 gl->DeleteTextures(1, &texture_id); | 208 gl->DeleteTextures(1, &texture_id); |
| 211 } | 209 } |
| 212 } | 210 } |
| 213 | 211 |
| 214 } // namespace bitmap_uploader | 212 } // namespace bitmap_uploader |
| OLD | NEW |