Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1712)

Unified Diff: cc/test/test_gpu_memory_buffer_manager.cc

Issue 1412223009: Reland: GpuMemoryBuffer interface change: Map(**) to Map() and memory(plane); stride(plane) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win X64 compile fix Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/zero_copy_tile_task_worker_pool.cc ('k') | components/mus/gles2/mojo_gpu_memory_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_gpu_memory_buffer_manager.cc
diff --git a/cc/test/test_gpu_memory_buffer_manager.cc b/cc/test/test_gpu_memory_buffer_manager.cc
index 7f6e8d1999d80374d32d6aec546befaffe129ded..78fa6ad5aab4d3e8bc62deef44436131d7711673 100644
--- a/cc/test/test_gpu_memory_buffer_manager.cc
+++ b/cc/test/test_gpu_memory_buffer_manager.cc
@@ -23,22 +23,19 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
mapped_(false) {}
// Overridden from gfx::GpuMemoryBuffer:
- bool Map(void** data) override {
+ bool Map() override {
DCHECK(!mapped_);
if (!shared_memory_->Map(gfx::BufferSizeForBufferFormat(size_, format_)))
return false;
mapped_ = true;
- size_t offset = 0;
- int num_planes =
- static_cast<int>(gfx::NumberOfPlanesForBufferFormat(format_));
- for (int i = 0; i < num_planes; ++i) {
- data[i] = reinterpret_cast<uint8*>(shared_memory_->memory()) + offset;
- offset +=
- gfx::RowSizeForBufferFormat(size_.width(), format_, i) *
- (size_.height() / gfx::SubsamplingFactorForBufferFormat(format_, i));
- }
return true;
}
+ void* memory(size_t plane) override {
+ DCHECK(mapped_);
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
+ return reinterpret_cast<uint8_t*>(shared_memory_->memory()) +
+ gfx::BufferOffsetForBufferFormat(size_, format_, plane);
+ }
void Unmap() override {
DCHECK(mapped_);
shared_memory_->Unmap();
@@ -46,12 +43,10 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
}
gfx::Size GetSize() const override { return size_; }
gfx::BufferFormat GetFormat() const override { return format_; }
- void GetStride(int* stride) const override {
- int num_planes =
- static_cast<int>(gfx::NumberOfPlanesForBufferFormat(format_));
- for (int i = 0; i < num_planes; ++i)
- stride[i] = base::checked_cast<int>(
- gfx::RowSizeForBufferFormat(size_.width(), format_, i));
+ int stride(size_t plane) const override {
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
+ return base::checked_cast<int>(gfx::RowSizeForBufferFormat(
+ size_.width(), format_, static_cast<int>(plane)));
}
gfx::GpuMemoryBufferId GetId() const override {
NOTREACHED();
« no previous file with comments | « cc/raster/zero_copy_tile_task_worker_pool.cc ('k') | components/mus/gles2/mojo_gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698