Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / ui / gl / gl_image_memory.h
blobbe35dd7676b7257e340f5c5d1b26499e876b6e97
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 BufferFormat format,
27 size_t* stride_in_bytes);
29 bool Initialize(const unsigned char* memory, BufferFormat format);
31 // Overridden from GLImage:
32 void Destroy(bool have_context) override;
33 Size GetSize() override;
34 unsigned GetInternalFormat() override;
35 bool BindTexImage(unsigned target) override;
36 void ReleaseTexImage(unsigned target) override {}
37 bool CopyTexSubImage(unsigned target,
38 const Point& offset,
39 const Rect& rect) override;
40 void WillUseTexImage() override;
41 void DidUseTexImage() override;
42 void WillModifyTexImage() override {}
43 void DidModifyTexImage() override {}
44 bool ScheduleOverlayPlane(AcceleratedWidget widget,
45 int z_order,
46 OverlayTransform transform,
47 const Rect& bounds_rect,
48 const RectF& crop_rect) override;
49 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
50 uint64_t process_tracing_id,
51 const std::string& dump_name) override;
53 protected:
54 ~GLImageMemory() override;
56 BufferFormat format() const { return format_; }
58 private:
59 void DoBindTexImage(unsigned target);
61 const Size size_;
62 const unsigned internalformat_;
63 const unsigned char* memory_;
64 BufferFormat format_;
65 bool in_use_;
66 unsigned target_;
67 bool need_do_bind_tex_image_;
68 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
69 defined(USE_OZONE)
70 unsigned egl_texture_id_;
71 EGLImageKHR egl_image_;
72 #endif
74 DISALLOW_COPY_AND_ASSIGN(GLImageMemory);
77 } // namespace gfx
79 #endif // UI_GL_GL_IMAGE_MEMORY_H_