ozone: gbm: Update hardware cursor in GPU process
[chromium-blink-merge.git] / ui / ozone / platform / dri / dri_surface.h
blob2abae45811eff73149a2d5c4f36551236aa4dc9b
1 // Copyright 2014 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.
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/skia_util.h"
12 #include "ui/ozone/ozone_export.h"
13 #include "ui/ozone/platform/dri/scanout_surface.h"
15 class SkCanvas;
17 namespace ui {
19 class DriBuffer;
20 class DriWrapper;
22 // An implementation of ScanoutSurface which uses dumb buffers (used for
23 // software rendering).
24 class OZONE_EXPORT DriSurface : public ScanoutSurface {
25 public:
26 DriSurface(DriWrapper* dri, const gfx::Size& size);
27 virtual ~DriSurface();
29 // Get a Skia canvas for a backbuffer.
30 SkCanvas* GetDrawableForWidget();
32 // ScanoutSurface:
33 virtual bool Initialize() OVERRIDE;
34 virtual uint32_t GetFramebufferId() const OVERRIDE;
35 virtual uint32_t GetHandle() const OVERRIDE;
36 virtual void SwapBuffers() OVERRIDE;
37 virtual gfx::Size Size() const OVERRIDE;
39 private:
40 DriBuffer* frontbuffer() const { return bitmaps_[front_buffer_].get(); }
41 DriBuffer* backbuffer() const { return bitmaps_[front_buffer_ ^ 1].get(); }
43 // Used to create the backing buffers.
44 virtual DriBuffer* CreateBuffer();
46 // Stores the connection to the graphics card. Pointer not owned by this
47 // class.
48 DriWrapper* dri_;
50 // The actual buffers used for painting.
51 scoped_ptr<DriBuffer> bitmaps_[2];
53 // Keeps track of which bitmap is |buffers_| is the frontbuffer.
54 int front_buffer_;
56 // Surface size.
57 gfx::Size size_;
59 DISALLOW_COPY_AND_ASSIGN(DriSurface);
62 } // namespace ui
64 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_