| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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 CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_ | |
| 6 #define CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "app/surface/transport_dib.h" | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/process.h" | |
| 12 #include "gfx/rect.h" | |
| 13 #include "gfx/size.h" | |
| 14 #include "ipc/ipc_channel.h" | |
| 15 #include "gfx/rect.h" | |
| 16 #include "gfx/size.h" | |
| 17 | |
| 18 class GpuViewX; | |
| 19 class GpuThread; | |
| 20 | |
| 21 class GpuVideoLayerGLX : public IPC::Channel::Listener { | |
| 22 public: | |
| 23 GpuVideoLayerGLX(GpuViewX* view, | |
| 24 GpuThread* gpu_thread, | |
| 25 int32 routing_id, | |
| 26 const gfx::Size& size); | |
| 27 virtual ~GpuVideoLayerGLX(); | |
| 28 | |
| 29 // Renders the video layer using the current GL context with respect to the | |
| 30 // given |viewport_size|. | |
| 31 // | |
| 32 // TODO(scherkus): we also need scrolling information to determine where | |
| 33 // exactly to place our quad. | |
| 34 void Render(const gfx::Size& viewport_size); | |
| 35 | |
| 36 // IPC::Channel::Listener implementation. | |
| 37 virtual void OnMessageReceived(const IPC::Message& message); | |
| 38 virtual void OnChannelConnected(int32 peer_pid); | |
| 39 virtual void OnChannelError(); | |
| 40 | |
| 41 private: | |
| 42 // Message handlers. | |
| 43 void OnPaintToVideoLayer(base::ProcessId source_process_id, | |
| 44 TransportDIB::Id id, | |
| 45 const gfx::Rect& bitmap_rect); | |
| 46 | |
| 47 // Calculates vertices for |object| relative to |world|, where |world| is | |
| 48 // assumed to represent a full-screen quad. |vertices| should be an array of | |
| 49 // 8 floats. | |
| 50 // | |
| 51 // TODO(scherkus): not sure how to describe what this does. | |
| 52 static void CalculateVertices(const gfx::Size& world, | |
| 53 const gfx::Rect& object, | |
| 54 float* vertices); | |
| 55 | |
| 56 // GPU process related. | |
| 57 GpuViewX* view_; | |
| 58 GpuThread* gpu_thread_; | |
| 59 int32 routing_id_; | |
| 60 | |
| 61 // The native size of the incoming YUV frames. | |
| 62 gfx::Size native_size_; | |
| 63 | |
| 64 // The target absolute position and size of the RGB frames. | |
| 65 gfx::Rect target_rect_; | |
| 66 | |
| 67 // The target absolute position and size expressed as quad vertices. | |
| 68 float target_vertices_[8]; | |
| 69 | |
| 70 // 3 textures, one for each plane. | |
| 71 unsigned int textures_[3]; | |
| 72 | |
| 73 // Shader program for YUV->RGB conversion. | |
| 74 unsigned int program_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(GpuVideoLayerGLX); | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_ | |
| OLD | NEW |