OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ | |
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
piman
2013/03/27 21:49:28
I don't think you need this.
| |
9 #include "base/memory/scoped_vector.h" | |
10 #include "base/threading/non_thread_safe.h" | |
11 #include "cc/output/software_output_device.h" | |
12 #include "third_party/skia/include/core/SkBitmap.h" | |
13 #include "ui/surface/transport_dib.h" | |
14 | |
15 namespace content { | |
16 | |
17 // This class can be created only on the main thread, but then becomes pinned | |
18 // to a fixed thread when bindToClient is called. | |
piman
2013/03/27 21:49:28
nit: BindToClient
| |
19 class CompositorSoftwareOutputDevice | |
piman
2013/03/27 21:49:28
I don't see this class instantiated anywhere yet.
| |
20 : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), | |
21 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
piman
2013/03/27 21:49:28
If the above comment is true, you should see asser
| |
22 public: | |
23 CompositorSoftwareOutputDevice(); | |
24 virtual ~CompositorSoftwareOutputDevice(); | |
25 | |
26 virtual void Resize(gfx::Size size) OVERRIDE; | |
27 | |
28 virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; | |
29 virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; | |
30 | |
31 virtual void ReclaimDIB(TransportDIB::Handle handle) OVERRIDE; | |
32 | |
33 private: | |
34 size_t ViewportSizeInBytes() const { | |
35 return 4 * viewport_size_.GetArea(); | |
36 } | |
37 | |
38 TransportDIB* CreateDIB() { | |
piman
2013/03/27 21:49:28
This method is non-trivial, move to the .cc file?
| |
39 TransportDIB* dib = | |
40 TransportDIB::Create(ViewportSizeInBytes(), sequence_num_++); | |
41 CHECK(dib); | |
42 bool success = dib->Map(); | |
43 CHECK(success); | |
44 return dib; | |
45 } | |
46 | |
47 static const int kNumBuffers = 2; | |
48 int front_buffer_; | |
49 int last_buffer_; | |
50 int num_free_buffers_; | |
51 ScopedVector<TransportDIB> dibs_; | |
52 SkBitmap bitmap_; | |
53 uint32 sequence_num_; | |
54 }; | |
55 | |
56 } // namespace content | |
57 | |
58 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ | |
OLD | NEW |