| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 returner_binding_.Bind(GetProxy(&returner_ptr)); | 54 returner_binding_.Bind(GetProxy(&returner_ptr)); |
| 55 surface_->SetResourceReturner(returner_ptr.Pass()); | 55 surface_->SetResourceReturner(returner_ptr.Pass()); |
| 56 | 56 |
| 57 ServiceProviderPtr gpu_service_provider; | 57 ServiceProviderPtr gpu_service_provider; |
| 58 shell->ConnectToApplication("mojo:native_viewport_service", | 58 shell->ConnectToApplication("mojo:native_viewport_service", |
| 59 GetProxy(&gpu_service_provider), nullptr); | 59 GetProxy(&gpu_service_provider), nullptr); |
| 60 ConnectToService(gpu_service_provider.get(), &gpu_service_); | 60 ConnectToService(gpu_service_provider.get(), &gpu_service_); |
| 61 | 61 |
| 62 CommandBufferPtr gles2_client; | 62 CommandBufferPtr gles2_client; |
| 63 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); | 63 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
| 64 gles2_context_ = | 64 gles2_context_ = MojoGLES2CreateContext( |
| 65 MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), | 65 gles2_client.PassInterface().PassHandle().release().value(), |
| 66 &LostContext, | 66 &LostContext, NULL, Environment::GetDefaultAsyncWaiter()); |
| 67 NULL, | |
| 68 Environment::GetDefaultAsyncWaiter()); | |
| 69 MojoGLES2MakeCurrent(gles2_context_); | 67 MojoGLES2MakeCurrent(gles2_context_); |
| 70 } | 68 } |
| 71 | 69 |
| 72 BitmapUploader::~BitmapUploader() { | 70 BitmapUploader::~BitmapUploader() { |
| 73 MojoGLES2DestroyContext(gles2_context_); | 71 MojoGLES2DestroyContext(gles2_context_); |
| 74 } | 72 } |
| 75 | 73 |
| 76 void BitmapUploader::SetColor(uint32_t color) { | 74 void BitmapUploader::SetColor(uint32_t color) { |
| 77 if (color_ == color) | 75 if (color_ == color) |
| 78 return; | 76 return; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 0); | 265 0); |
| 268 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 266 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 269 return texture; | 267 return texture; |
| 270 } | 268 } |
| 271 | 269 |
| 272 uint32_t BitmapUploader::TextureFormat() { | 270 uint32_t BitmapUploader::TextureFormat() { |
| 273 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; | 271 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; |
| 274 } | 272 } |
| 275 | 273 |
| 276 } // namespace mojo | 274 } // namespace mojo |
| OLD | NEW |