OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "examples/ganesh_app/texture_uploader.h" | 5 #include "examples/ganesh_app/texture_uploader.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 context_->MakeCurrent(); | 69 context_->MakeCurrent(); |
70 glBindTexture(GL_TEXTURE_2D, texture->texture_id()); | 70 glBindTexture(GL_TEXTURE_2D, texture->texture_id()); |
71 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | 71 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; |
72 glGenMailboxCHROMIUM(mailbox); | 72 glGenMailboxCHROMIUM(mailbox); |
73 glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox); | 73 glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox); |
74 GLuint sync_point = glInsertSyncPointCHROMIUM(); | 74 GLuint sync_point = glInsertSyncPointCHROMIUM(); |
75 | 75 |
76 mojo::TransferableResourcePtr resource = mojo::TransferableResource::New(); | 76 mojo::TransferableResourcePtr resource = mojo::TransferableResource::New(); |
77 resource->id = next_resource_id_++; | 77 resource->id = next_resource_id_++; |
78 resource_to_texture_map_[resource->id] = texture.release(); | 78 resource_to_texture_map_[resource->id] = texture.release(); |
79 resource->format = mojo::RESOURCE_FORMAT_RGBA_8888; | 79 resource->format = mojo::ResourceFormat::RGBA_8888; |
80 resource->filter = GL_LINEAR; | 80 resource->filter = GL_LINEAR; |
81 resource->size = size.Clone(); | 81 resource->size = size.Clone(); |
82 mojo::MailboxHolderPtr mailbox_holder = mojo::MailboxHolder::New(); | 82 mojo::MailboxHolderPtr mailbox_holder = mojo::MailboxHolder::New(); |
83 mailbox_holder->mailbox = mojo::Mailbox::New(); | 83 mailbox_holder->mailbox = mojo::Mailbox::New(); |
84 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) | 84 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) |
85 mailbox_holder->mailbox->name.push_back(mailbox[i]); | 85 mailbox_holder->mailbox->name.push_back(mailbox[i]); |
86 mailbox_holder->texture_target = GL_TEXTURE_2D; | 86 mailbox_holder->texture_target = GL_TEXTURE_2D; |
87 mailbox_holder->sync_point = sync_point; | 87 mailbox_holder->sync_point = sync_point; |
88 resource->mailbox_holder = mailbox_holder.Pass(); | 88 resource->mailbox_holder = mailbox_holder.Pass(); |
89 resource->is_repeated = false; | 89 resource->is_repeated = false; |
90 resource->is_software = false; | 90 resource->is_software = false; |
91 | 91 |
92 mojo::QuadPtr quad = mojo::Quad::New(); | 92 mojo::QuadPtr quad = mojo::Quad::New(); |
93 quad->material = mojo::MATERIAL_TEXTURE_CONTENT; | 93 quad->material = mojo::Material::TEXTURE_CONTENT; |
94 | 94 |
95 mojo::RectPtr rect = mojo::Rect::New(); | 95 mojo::RectPtr rect = mojo::Rect::New(); |
96 rect->width = size.width; | 96 rect->width = size.width; |
97 rect->height = size.height; | 97 rect->height = size.height; |
98 quad->rect = rect.Clone(); | 98 quad->rect = rect.Clone(); |
99 quad->opaque_rect = rect.Clone(); | 99 quad->opaque_rect = rect.Clone(); |
100 quad->visible_rect = rect.Clone(); | 100 quad->visible_rect = rect.Clone(); |
101 quad->needs_blending = true; | 101 quad->needs_blending = true; |
102 quad->shared_quad_state_index = 0u; | 102 quad->shared_quad_state_index = 0u; |
103 | 103 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 client_->OnSurfaceIdAvailable(qualified_id.Pass()); | 163 client_->OnSurfaceIdAvailable(qualified_id.Pass()); |
164 } | 164 } |
165 | 165 |
166 void TextureUploader::SetIdNamespace(uint32_t id_namespace) { | 166 void TextureUploader::SetIdNamespace(uint32_t id_namespace) { |
167 id_namespace_ = id_namespace; | 167 id_namespace_ = id_namespace; |
168 if (local_id_ != 0u) | 168 if (local_id_ != 0u) |
169 SendFullyQualifiedID(); | 169 SendFullyQualifiedID(); |
170 } | 170 } |
171 | 171 |
172 } // namespace examples | 172 } // namespace examples |
OLD | NEW |