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

Side by Side Diff: command_buffer/service/win/d3d9/d3d9_utils.h

Issue 332036: move all O3D specific command buffer stuff to command_buffer::o3d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return float_and_dword.dword_value; 82 return float_and_dword.dword_value;
83 } 83 }
84 84
85 // Clamps a float to [0 .. 1] and maps it to [0 .. 255] 85 // Clamps a float to [0 .. 1] and maps it to [0 .. 255]
86 inline unsigned int FloatToClampedByte(float value) { 86 inline unsigned int FloatToClampedByte(float value) {
87 value = std::min(1.f, std::max(0.f, value)); 87 value = std::min(1.f, std::max(0.f, value));
88 return static_cast<unsigned int>(value * 255); 88 return static_cast<unsigned int>(value * 255);
89 } 89 }
90 90
91 // Converts a RGBA color into a D3DCOLOR 91 // Converts a RGBA color into a D3DCOLOR
92 inline D3DCOLOR RGBAToD3DCOLOR(const RGBA &color) { 92 inline D3DCOLOR RGBAToD3DCOLOR(const o3d::RGBA &color) {
93 return D3DCOLOR_RGBA(FloatToClampedByte(color.red), 93 return D3DCOLOR_RGBA(FloatToClampedByte(color.red),
94 FloatToClampedByte(color.green), 94 FloatToClampedByte(color.green),
95 FloatToClampedByte(color.blue), 95 FloatToClampedByte(color.blue),
96 FloatToClampedByte(color.alpha)); 96 FloatToClampedByte(color.alpha));
97 } 97 }
98 98
99 static bool D3DSemanticToCBSemantic( 99 static bool D3DSemanticToCBSemantic(
100 D3DDECLUSAGE semantic, 100 D3DDECLUSAGE semantic,
101 unsigned int semantic_index, 101 unsigned int semantic_index,
102 vertex_struct::Semantic *out_semantic, 102 vertex_struct::Semantic *out_semantic,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 *out_semantic_index = semantic_index; 138 *out_semantic_index = semantic_index;
139 return true; 139 return true;
140 default: 140 default:
141 return false; 141 return false;
142 } 142 }
143 } 143 }
144 } // namespace command_buffer 144 } // namespace command_buffer
145 } // namespace o3d 145 } // namespace o3d
146 146
147 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_ 147 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_
OLDNEW
« no previous file with comments | « command_buffer/service/cross/gl/texture_gl.cc ('k') | command_buffer/service/win/d3d9/effect_d3d9.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698