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_BACKING_STORE_GLX_H_ | |
6 #define CHROME_GPU_GPU_BACKING_STORE_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/size.h" | |
13 #include "ipc/ipc_channel.h" | |
14 #include "gfx/size.h" | |
15 | |
16 class GpuViewX; | |
17 class GpuThread; | |
18 class SkBitmap; | |
19 | |
20 class GpuBackingStoreGLX : public IPC::Channel::Listener { | |
21 public: | |
22 GpuBackingStoreGLX(GpuViewX* view, | |
23 GpuThread* gpu_thread, | |
24 int32 routing_id, | |
25 const gfx::Size& size); | |
26 ~GpuBackingStoreGLX(); | |
27 | |
28 const gfx::Size& size() const { return size_; } | |
29 const gfx::Size& texture_size() const { return texture_size_; } | |
30 unsigned int texture_id() const { return texture_id_; } | |
31 | |
32 // IPC::Channel::Listener implementation. | |
33 virtual void OnMessageReceived(const IPC::Message& message); | |
34 virtual void OnChannelConnected(int32 peer_pid); | |
35 virtual void OnChannelError(); | |
36 | |
37 private: | |
38 // Message handlers. | |
39 void OnPaintToBackingStore(base::ProcessId source_process_id, | |
40 TransportDIB::Id id, | |
41 const gfx::Rect& bitmap_rect, | |
42 const std::vector<gfx::Rect>& copy_rects); | |
43 void OnScrollBackingStore(int dx, int dy, | |
44 const gfx::Rect& clip_rect, | |
45 const gfx::Size& view_size); | |
46 | |
47 void PaintOneRectToBackingStore(const SkBitmap& transport_bitmap, | |
48 const gfx::Rect& bitmap_rect, | |
49 const gfx::Rect& copy_rect); | |
50 | |
51 GpuViewX* view_; | |
52 GpuThread* gpu_thread_; | |
53 int32 routing_id_; | |
54 gfx::Size size_; | |
55 | |
56 unsigned int texture_id_; // 0 when uninitialized. | |
57 | |
58 // The size of the texture loaded into GL. This is 0x0 when there is no | |
59 // texture loaded. This may be different than the size of the backing store | |
60 // because we could have been resized without yet getting the updated | |
61 // bitmap. | |
62 gfx::Size texture_size_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(GpuBackingStoreGLX); | |
65 }; | |
66 | |
67 #endif // CHROME_GPU_GPU_BACKING_STORE_GLX_H_ | |
OLD | NEW |