Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: content/renderer/gpu/compositor_software_output_device.h

Issue 13042012: Browser side changes for software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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(TransportDIB::Handle handle) OVERRIDE;
32
33 private:
34 size_t ViewportSizeInBytes() const {
35 return 4 * viewport_size_.GetArea();
36 }
37
38 TransportDIB* CreateDIB() {
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698