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

Unified Diff: o3d/gpu_plugin/system_services/shared_memory.cc

Issue 234001: GPUProcessor uses O3D command buffer service to render to a window.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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: o3d/gpu_plugin/system_services/shared_memory.cc
===================================================================
--- o3d/gpu_plugin/system_services/shared_memory.cc (revision 26879)
+++ o3d/gpu_plugin/system_services/shared_memory.cc (working copy)
@@ -65,15 +65,22 @@
if (!ptr)
return false;
- if (offset < 0 || offset + sizeof(value) >= size)
+ if (offset < 0 || offset * sizeof(value) >= size)
return false;
- if ((offset % sizeof(value)) != 0)
+ reinterpret_cast<int32*>(ptr)[offset] = value;
+ return true;
+}
+
+bool SharedMemory::SetFloat(int32 offset, float value) {
+ if (!ptr)
return false;
- *reinterpret_cast<int32*>(static_cast<int8*>(ptr) + offset) = value;
+ if (offset < 0 || offset * sizeof(value) >= size)
+ return false;
+
+ reinterpret_cast<float*>(ptr)[offset] = value;
return true;
}
-
} // namespace gpu_plugin
} // namespace o3d
« no previous file with comments | « o3d/gpu_plugin/system_services/shared_memory.h ('k') | o3d/gpu_plugin/system_services/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698