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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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 | « components/arc/test/fake_app_instance.cc ('k') | components/clipboard/clipboard_apptest.cc » ('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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 format_(BGRA), 45 format_(BGRA),
46 next_resource_id_(1u), 46 next_resource_id_(1u),
47 id_namespace_(0u), 47 id_namespace_(0u),
48 surface_client_binding_(this) {} 48 surface_client_binding_(this) {}
49 49
50 BitmapUploader::~BitmapUploader() { 50 BitmapUploader::~BitmapUploader() {
51 MojoGLES2DestroyContext(gles2_context_); 51 MojoGLES2DestroyContext(gles2_context_);
52 } 52 }
53 53
54 void BitmapUploader::Init(mojo::Shell* shell) { 54 void BitmapUploader::Init(mojo::Shell* shell) {
55 surface_ = window_->RequestSurface(mus::mojom::SURFACE_TYPE_DEFAULT); 55 surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT);
56 surface_->BindToThread(); 56 surface_->BindToThread();
57 57
58 mojo::ServiceProviderPtr gpu_service_provider; 58 mojo::ServiceProviderPtr gpu_service_provider;
59 mojo::URLRequestPtr request2(mojo::URLRequest::New()); 59 mojo::URLRequestPtr request2(mojo::URLRequest::New());
60 request2->url = mojo::String::From("mojo:mus"); 60 request2->url = mojo::String::From("mojo:mus");
61 shell->ConnectToApplication(std::move(request2), 61 shell->ConnectToApplication(std::move(request2),
62 mojo::GetProxy(&gpu_service_provider), nullptr, 62 mojo::GetProxy(&gpu_service_provider), nullptr,
63 mojo::CreatePermissiveCapabilityFilter(), 63 mojo::CreatePermissiveCapabilityFilter(),
64 base::Bind(&OnGotContentHandlerID)); 64 base::Bind(&OnGotContentHandlerID));
65 ConnectToService(gpu_service_provider.get(), &gpu_service_); 65 ConnectToService(gpu_service_provider.get(), &gpu_service_);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM(); 135 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM();
136 glShallowFlushCHROMIUM(); 136 glShallowFlushCHROMIUM();
137 137
138 gpu::SyncToken sync_token; 138 gpu::SyncToken sync_token;
139 glGenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 139 glGenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
140 140
141 mus::mojom::TransferableResourcePtr resource = 141 mus::mojom::TransferableResourcePtr resource =
142 mus::mojom::TransferableResource::New(); 142 mus::mojom::TransferableResource::New();
143 resource->id = next_resource_id_++; 143 resource->id = next_resource_id_++;
144 resource_to_texture_id_map_[resource->id] = texture_id; 144 resource_to_texture_id_map_[resource->id] = texture_id;
145 resource->format = mus::mojom::RESOURCE_FORMAT_RGBA_8888; 145 resource->format = mus::mojom::ResourceFormat::RGBA_8888;
146 resource->filter = GL_LINEAR; 146 resource->filter = GL_LINEAR;
147 resource->size = bitmap_size.Clone(); 147 resource->size = bitmap_size.Clone();
148 mus::mojom::MailboxHolderPtr mailbox_holder = 148 mus::mojom::MailboxHolderPtr mailbox_holder =
149 mus::mojom::MailboxHolder::New(); 149 mus::mojom::MailboxHolder::New();
150 mailbox_holder->mailbox = mus::mojom::Mailbox::New(); 150 mailbox_holder->mailbox = mus::mojom::Mailbox::New();
151 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) 151 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i)
152 mailbox_holder->mailbox->name.push_back(mailbox[i]); 152 mailbox_holder->mailbox->name.push_back(mailbox[i]);
153 mailbox_holder->texture_target = GL_TEXTURE_2D; 153 mailbox_holder->texture_target = GL_TEXTURE_2D;
154 mailbox_holder->sync_token = 154 mailbox_holder->sync_token =
155 mus::mojom::SyncToken::From<gpu::SyncToken>(sync_token); 155 mus::mojom::SyncToken::From<gpu::SyncToken>(sync_token);
156 resource->mailbox_holder = std::move(mailbox_holder); 156 resource->mailbox_holder = std::move(mailbox_holder);
157 resource->read_lock_fences_enabled = false; 157 resource->read_lock_fences_enabled = false;
158 resource->is_software = false; 158 resource->is_software = false;
159 resource->is_overlay_candidate = false; 159 resource->is_overlay_candidate = false;
160 160
161 mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); 161 mus::mojom::QuadPtr quad = mus::mojom::Quad::New();
162 quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; 162 quad->material = mus::mojom::Material::TEXTURE_CONTENT;
163 163
164 mojo::RectPtr rect = mojo::Rect::New(); 164 mojo::RectPtr rect = mojo::Rect::New();
165 if (width_ <= bounds.width() && height_ <= bounds.height()) { 165 if (width_ <= bounds.width() && height_ <= bounds.height()) {
166 rect->width = width_; 166 rect->width = width_;
167 rect->height = height_; 167 rect->height = height_;
168 } else { 168 } else {
169 // The source bitmap is larger than the viewport. Resize it while 169 // The source bitmap is larger than the viewport. Resize it while
170 // maintaining the aspect ratio. 170 // maintaining the aspect ratio.
171 float width_ratio = static_cast<float>(width_) / bounds.width(); 171 float width_ratio = static_cast<float>(width_) / bounds.width();
172 float height_ratio = static_cast<float>(height_) / bounds.height(); 172 float height_ratio = static_cast<float>(height_) / bounds.height();
(...skipping 25 matching lines...) Expand all
198 texture_state->vertex_opacity.push_back(1.f); 198 texture_state->vertex_opacity.push_back(1.f);
199 texture_state->y_flipped = false; 199 texture_state->y_flipped = false;
200 200
201 frame->resources.push_back(std::move(resource)); 201 frame->resources.push_back(std::move(resource));
202 quad->texture_quad_state = std::move(texture_state); 202 quad->texture_quad_state = std::move(texture_state);
203 pass->quads.push_back(std::move(quad)); 203 pass->quads.push_back(std::move(quad));
204 } 204 }
205 205
206 if (color_ != g_transparent_color) { 206 if (color_ != g_transparent_color) {
207 mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); 207 mus::mojom::QuadPtr quad = mus::mojom::Quad::New();
208 quad->material = mus::mojom::MATERIAL_SOLID_COLOR; 208 quad->material = mus::mojom::Material::SOLID_COLOR;
209 quad->rect = mojo::Rect::From(bounds); 209 quad->rect = mojo::Rect::From(bounds);
210 quad->opaque_rect = mojo::Rect::New(); 210 quad->opaque_rect = mojo::Rect::New();
211 quad->visible_rect = mojo::Rect::From(bounds); 211 quad->visible_rect = mojo::Rect::From(bounds);
212 quad->needs_blending = true; 212 quad->needs_blending = true;
213 quad->shared_quad_state_index = 0u; 213 quad->shared_quad_state_index = 0u;
214 214
215 mus::mojom::SolidColorQuadStatePtr color_state = 215 mus::mojom::SolidColorQuadStatePtr color_state =
216 mus::mojom::SolidColorQuadState::New(); 216 mus::mojom::SolidColorQuadState::New();
217 color_state->color = mus::mojom::Color::New(); 217 color_state->color = mus::mojom::Color::New();
218 color_state->color->rgba = color_; 218 color_state->color->rgba = color_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 glWaitSyncTokenCHROMIUM( 262 glWaitSyncTokenCHROMIUM(
263 resource->sync_token.To<gpu::SyncToken>().GetConstData()); 263 resource->sync_token.To<gpu::SyncToken>().GetConstData());
264 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; 264 uint32_t texture_id = resource_to_texture_id_map_[resource->id];
265 DCHECK_NE(0u, texture_id); 265 DCHECK_NE(0u, texture_id);
266 resource_to_texture_id_map_.erase(resource->id); 266 resource_to_texture_id_map_.erase(resource->id);
267 glDeleteTextures(1, &texture_id); 267 glDeleteTextures(1, &texture_id);
268 } 268 }
269 } 269 }
270 270
271 } // namespace bitmap_uploader 271 } // namespace bitmap_uploader
OLDNEW
« no previous file with comments | « components/arc/test/fake_app_instance.cc ('k') | components/clipboard/clipboard_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698