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_(0), | 41 id_namespace_(0), |
42 weak_factory_(this) { | 42 weak_factory_(this) { |
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), |
49 ServiceProviderPtr()); | |
darin (slow to review)
2015/01/13 07:54:51
note for a future CL: we could make nullptr work i
| |
49 ConnectToService(surfaces_service_provider.get(), &surfaces_service_); | 50 ConnectToService(surfaces_service_provider.get(), &surfaces_service_); |
50 ServiceProviderPtr gpu_service_provider; | 51 ServiceProviderPtr gpu_service_provider; |
51 shell->ConnectToApplication("mojo:native_viewport_service", | 52 shell->ConnectToApplication("mojo:native_viewport_service", |
52 GetProxy(&gpu_service_provider)); | 53 GetProxy(&gpu_service_provider), |
54 ServiceProviderPtr()); | |
53 ConnectToService(gpu_service_provider.get(), &gpu_service_); | 55 ConnectToService(gpu_service_provider.get(), &gpu_service_); |
54 | 56 |
55 surfaces_service_->CreateSurfaceConnection(base::Bind( | 57 surfaces_service_->CreateSurfaceConnection(base::Bind( |
56 &BitmapUploader::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); | 58 &BitmapUploader::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); |
57 CommandBufferPtr gles2_client; | 59 CommandBufferPtr gles2_client; |
58 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); | 60 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
59 gles2_context_ = | 61 gles2_context_ = |
60 MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), | 62 MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), |
61 &LostContext, | 63 &LostContext, |
62 NULL, | 64 NULL, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 0); | 271 0); |
270 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 272 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
271 return texture; | 273 return texture; |
272 } | 274 } |
273 | 275 |
274 uint32_t BitmapUploader::TextureFormat() { | 276 uint32_t BitmapUploader::TextureFormat() { |
275 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; | 277 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; |
276 } | 278 } |
277 | 279 |
278 } // namespace mojo | 280 } // namespace mojo |
OLD | NEW |