blob: e9a09bee452474db1e01dfadd002321f7fbf5fbd (
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
|
// Copyright 2014 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.
#include "cc/test/test_image_factory.h"
#include <stddef.h>
#include "base/numerics/safe_conversions.h"
#include "ui/gl/gl_image_shared_memory.h"
namespace cc {
TestImageFactory::TestImageFactory() {
}
TestImageFactory::~TestImageFactory() {
}
scoped_refptr<gl::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
unsigned internalformat,
int client_id) {
DCHECK_EQ(handle.type, gfx::SHARED_MEMORY_BUFFER);
scoped_refptr<gl::GLImageSharedMemory> image(
new gl::GLImageSharedMemory(size, internalformat));
if (!image->Initialize(handle.handle, handle.id, format, handle.offset,
base::checked_cast<size_t>(handle.stride)))
return nullptr;
return image;
}
} // namespace cc
|