| 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/bitmap_uploader/bitmap_uploader.h" | 5 #include "examples/bitmap_uploader/bitmap_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 // GL_GLEXT_PROTOTYPES | 9 #endif // GL_GLEXT_PROTOTYPES |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 height_(0), | 38 height_(0), |
| 39 format_(BGRA), | 39 format_(BGRA), |
| 40 next_resource_id_(1u), | 40 next_resource_id_(1u), |
| 41 id_namespace_(0u), | 41 id_namespace_(0u), |
| 42 local_id_(0u) { | 42 local_id_(0u) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void BitmapUploader::Init(Shell* shell) { | 45 void BitmapUploader::Init(Shell* shell) { |
| 46 ServiceProviderPtr surfaces_service_provider; | 46 ServiceProviderPtr surfaces_service_provider; |
| 47 shell->ConnectToApplication("mojo:surfaces_service", | 47 shell->ConnectToApplication("mojo:surfaces_service", |
| 48 GetProxy(&surfaces_service_provider)); | 48 GetProxy(&surfaces_service_provider), nullptr); |
| 49 ConnectToService(surfaces_service_provider.get(), &surface_); | 49 ConnectToService(surfaces_service_provider.get(), &surface_); |
| 50 surface_.set_client(this); | 50 surface_.set_client(this); |
| 51 | 51 |
| 52 ServiceProviderPtr gpu_service_provider; | 52 ServiceProviderPtr gpu_service_provider; |
| 53 shell->ConnectToApplication("mojo:native_viewport_service", | 53 shell->ConnectToApplication("mojo:native_viewport_service", |
| 54 GetProxy(&gpu_service_provider)); | 54 GetProxy(&gpu_service_provider), nullptr); |
| 55 ConnectToService(gpu_service_provider.get(), &gpu_service_); | 55 ConnectToService(gpu_service_provider.get(), &gpu_service_); |
| 56 | 56 |
| 57 CommandBufferPtr gles2_client; | 57 CommandBufferPtr gles2_client; |
| 58 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); | 58 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
| 59 gles2_context_ = | 59 gles2_context_ = |
| 60 MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), | 60 MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), |
| 61 &LostContext, | 61 &LostContext, |
| 62 NULL, | 62 NULL, |
| 63 Environment::GetDefaultAsyncWaiter()); | 63 Environment::GetDefaultAsyncWaiter()); |
| 64 MojoGLES2MakeCurrent(gles2_context_); | 64 MojoGLES2MakeCurrent(gles2_context_); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 0); | 264 0); |
| 265 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 265 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 266 return texture; | 266 return texture; |
| 267 } | 267 } |
| 268 | 268 |
| 269 uint32_t BitmapUploader::TextureFormat() { | 269 uint32_t BitmapUploader::TextureFormat() { |
| 270 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; | 270 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace mojo | 273 } // namespace mojo |
| OLD | NEW |