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

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

Issue 12340015: [CLOSED] Big patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/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(const gfx::Size& size) OVERRIDE;
27
28 virtual SkCanvas* BeginPaint(const 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 return dib;
43 }
44
45 static const int kNumBuffers = 2;
46 int front_buffer_;
47 int last_buffer_;
48 int num_free_buffers_;
49 ScopedVector<TransportDIB> dibs_;
50 SkBitmap bitmap_; // TODO(skaslev) can we get rid of this?
51 uint32 sequence_num_;
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.cc ('k') | content/renderer/gpu/compositor_software_output_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698