OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_CALAYER_MAC_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_CALAYER_MAC_H_ |
| 7 |
| 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
| 10 #include "ui/base/cocoa/remote_layer_api.h" |
| 11 #include "ui/gl/gl_bindings.h" |
| 12 #include "ui/gl/scoped_cgl.h" |
| 13 |
| 14 @interface ImageTransportLayer : CAOpenGLLayer { |
| 15 base::ScopedTypeRef<CGLContextObj> shareContext_; |
| 16 GLuint texture_; |
| 17 gfx::Size pixelSize_; |
| 18 } |
| 19 @end |
| 20 |
| 21 namespace content { |
| 22 |
| 23 // Allocate CAOpenGLLayer-backed storage for an FBO image transport surface. |
| 24 class CALayerStorageProvider |
| 25 : public ImageTransportSurfaceFBO::StorageProvider { |
| 26 public: |
| 27 CALayerStorageProvider(); |
| 28 virtual ~CALayerStorageProvider(); |
| 29 |
| 30 // ImageTransportSurfaceFBO::StorageProvider implementation: |
| 31 virtual gfx::Size GetRoundedSize(gfx::Size size) OVERRIDE; |
| 32 virtual bool AllocateColorBufferStorage( |
| 33 CGLContextObj context, GLuint texture, |
| 34 gfx::Size pixel_size, float scale_factor) OVERRIDE; |
| 35 virtual void FreeColorBufferStorage() OVERRIDE; |
| 36 virtual uint64 GetSurfaceHandle() const OVERRIDE; |
| 37 virtual void WillSwapBuffers() OVERRIDE; |
| 38 |
| 39 private: |
| 40 base::scoped_nsobject<CAContext> context_; |
| 41 base::scoped_nsobject<ImageTransportLayer> layer_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(CALayerStorageProvider); |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_CALAYER_MAC_H_ |
OLD | NEW |