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" |
| 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. |
| 19 class CompositorSoftwareOutputDevice |
| 20 : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), |
| 21 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 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(const TransportDIB::Id& id) OVERRIDE; |
| 32 |
| 33 private: |
| 34 TransportDIB* CreateDIB(); |
| 35 |
| 36 static const size_t kNumBuffers = 2; |
| 37 int front_buffer_; |
| 38 int last_buffer_; |
| 39 int num_free_buffers_; |
| 40 ScopedVector<TransportDIB> dibs_; |
| 41 SkBitmap bitmap_; |
| 42 uint32 sequence_num_; |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ |
OLD | NEW |