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/memory/ref_counted.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/skia_util.h"
12 #include "ui/ozone/public/surface_ozone_canvas.h"
20 class DriWindowDelegate
;
22 class HardwareDisplayController
;
24 class DriSurface
: public SurfaceOzoneCanvas
{
26 DriSurface(DriWindowDelegate
* window_delegate
, DriWrapper
* dri
);
27 ~DriSurface() override
;
29 // SurfaceOzoneCanvas:
30 skia::RefPtr
<SkCanvas
> GetCanvas() override
;
31 void ResizeCanvas(const gfx::Size
& viewport_size
) override
;
32 void PresentCanvas(const gfx::Rect
& damage
) override
;
33 scoped_ptr
<gfx::VSyncProvider
> CreateVSyncProvider() override
;
36 void UpdateNativeSurface(const gfx::Rect
& damage
);
38 DriWindowDelegate
* window_delegate_
;
40 // Stores the connection to the graphics card. Pointer not owned by this
44 // The actual buffers used for painting.
45 scoped_refptr
<DriBuffer
> buffers_
[2];
47 // Keeps track of which bitmap is |buffers_| is the frontbuffer.
50 skia::RefPtr
<SkSurface
> surface_
;
51 gfx::Rect last_damage_
;
53 DISALLOW_COPY_AND_ASSIGN(DriSurface
);
58 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_