Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / gl / gl_image_memory.h
blob89ccfa7eab6b424bd3ef1583e54dea620dcfd840
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_GL_GL_IMAGE_MEMORY_H_
6 #define UI_GL_GL_IMAGE_MEMORY_H_
8 #include "ui/gl/gl_image.h"
10 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
11 defined(USE_OZONE)
12 #include <EGL/egl.h>
13 #include <EGL/eglext.h>
14 #endif
16 #include "base/numerics/safe_math.h"
17 #include "ui/gfx/gpu_memory_buffer.h"
19 namespace gfx {
21 class GL_EXPORT GLImageMemory : public GLImage {
22 public:
23 GLImageMemory(const Size& size, unsigned internalformat);
25 static bool StrideInBytes(size_t width,
26 GpuMemoryBuffer::Format format,
27 size_t* stride_in_bytes);
29 bool Initialize(const unsigned char* memory,
30 GpuMemoryBuffer::Format format);
32 // Overridden from GLImage:
33 void Destroy(bool have_context) override;
34 Size GetSize() override;
35 unsigned GetInternalFormat() override;
36 bool BindTexImage(unsigned target) override;
37 void ReleaseTexImage(unsigned target) override {}
38 bool CopyTexSubImage(unsigned target,
39 const Point& offset,
40 const Rect& rect) override;
41 void WillUseTexImage() override;
42 void DidUseTexImage() override;
43 void WillModifyTexImage() override {}
44 void DidModifyTexImage() override {}
45 bool ScheduleOverlayPlane(AcceleratedWidget widget,
46 int z_order,
47 OverlayTransform transform,
48 const Rect& bounds_rect,
49 const RectF& crop_rect) override;
51 protected:
52 ~GLImageMemory() override;
54 private:
55 void DoBindTexImage(unsigned target);
57 const Size size_;
58 const unsigned internalformat_;
59 const unsigned char* memory_;
60 GpuMemoryBuffer::Format format_;
61 bool in_use_;
62 unsigned target_;
63 bool need_do_bind_tex_image_;
64 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
65 defined(USE_OZONE)
66 unsigned egl_texture_id_;
67 EGLImageKHR egl_image_;
68 #endif
70 DISALLOW_COPY_AND_ASSIGN(GLImageMemory);
73 } // namespace gfx
75 #endif // UI_GL_GL_IMAGE_MEMORY_H_