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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.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
Index: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
index 8ebd1f8da4ea2111ac61b31b0702f67bc3ee16b1..b4ab7d05e8c60366db96abc238dd2142e1f5691e 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
@@ -5,6 +5,7 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h"
#include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h"
+#include "ui/gfx/buffer_format_util.h"
#include "ui/ozone/public/client_native_pixmap_factory.h"
#include "ui/ozone/public/native_pixmap.h"
#include "ui/ozone/public/ozone_platform.h"
@@ -69,19 +70,31 @@ base::Closure GpuMemoryBufferImplOzoneNativePixmap::AllocateForTesting(
return base::Bind(&FreeNativePixmapForTesting, pixmap);
}
-bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) {
- *data = pixmap_->Map();
+bool GpuMemoryBufferImplOzoneNativePixmap::Map() {
+ DCHECK(!mapped_);
+ if (!pixmap_->Map())
+ return false;
mapped_ = true;
return mapped_;
}
+void* GpuMemoryBufferImplOzoneNativePixmap::memory(size_t plane) {
+ DCHECK(mapped_);
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
+ return pixmap_->Map();
+}
+
void GpuMemoryBufferImplOzoneNativePixmap::Unmap() {
+ DCHECK(mapped_);
pixmap_->Unmap();
mapped_ = false;
}
-void GpuMemoryBufferImplOzoneNativePixmap::GetStride(int* stride) const {
- pixmap_->GetStride(stride);
+int GpuMemoryBufferImplOzoneNativePixmap::stride(size_t plane) const {
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
+ int stride;
+ pixmap_->GetStride(&stride);
+ return stride;
}
gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle()

Powered by Google App Engine
This is Rietveld 408576698