summaryrefslogtreecommitdiffstats
path: root/ui/gl/gl_image_ozone_native_pixmap.h
blob: 469c04415af1957c265fb993e33f2043f3625512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GL_GL_IMAGE_OZONE_NATIVE_PIXMAP_H_
#define UI_GL_GL_IMAGE_OZONE_NATIVE_PIXMAP_H_

#include <stdint.h>

#include "ui/gfx/buffer_types.h"
#include "ui/gl/gl_image_egl.h"
#include "ui/ozone/public/native_pixmap.h"

namespace gfx {

class GL_EXPORT GLImageOzoneNativePixmap : public gl::GLImageEGL {
 public:
  GLImageOzoneNativePixmap(const Size& size, unsigned internalformat);

  bool Initialize(ui::NativePixmap* pixmap, BufferFormat format);

  // Overridden from GLImage:
  unsigned GetInternalFormat() override;
  void Destroy(bool have_context) override;
  bool CopyTexImage(unsigned target) override;
  bool ScheduleOverlayPlane(AcceleratedWidget widget,
                            int z_order,
                            OverlayTransform transform,
                            const Rect& bounds_rect,
                            const RectF& crop_rect) override;
  void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
                    uint64_t process_tracing_id,
                    const std::string& dump_name) override;

 protected:
  ~GLImageOzoneNativePixmap() override;

 private:
  unsigned internalformat_;
  scoped_refptr<ui::NativePixmap> pixmap_;
};

}  // namespace gfx

#endif  // UI_GL_GL_IMAGE_OZONE_NATIVE_PIXMAP_H_