summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h')
-rw-r--r--chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h b/chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h
new file mode 100644
index 00000000000..e25e7322163
--- /dev/null
+++ b/chromium/third_party/blink/renderer/platform/graphics/gpu_memory_buffer_image_copy.h
@@ -0,0 +1,38 @@
+#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GPU_MEMORY_BUFFER_IMAGE_COPY_H_
+#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GPU_MEMORY_BUFFER_IMAGE_COPY_H_
+
+#include <memory>
+#include "gpu/command_buffer/client/gles2_interface.h"
+#include "third_party/blink/renderer/platform/platform_export.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+
+namespace blink {
+
+class Image;
+
+class PLATFORM_EXPORT GpuMemoryBufferImageCopy {
+ public:
+ GpuMemoryBufferImageCopy(gpu::gles2::GLES2Interface*);
+ ~GpuMemoryBufferImageCopy();
+
+ gfx::GpuMemoryBuffer* CopyImage(Image*);
+
+ private:
+ bool EnsureMemoryBuffer(int width, int height);
+ void OnContextLost();
+ void OnContextError(const char* msg, int32_t id);
+
+ std::unique_ptr<gfx::GpuMemoryBuffer> m_currentBuffer;
+
+ int last_width_ = 0;
+ int last_height_ = 0;
+ gpu::gles2::GLES2Interface* gl_;
+ std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
+
+ // TODO(billorr): Add error handling for context loss or GL errors before we
+ // enable this by default.
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GPU_MEMORY_BUFFER_IMAGE_COPY_H_