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

Side by Side Diff: gpu/tools/compositor_model_bench/shaders.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/tools/compositor_model_bench/shaders.h" 5 #include "gpu/tools/compositor_model_bench/shaders.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "gpu/tools/compositor_model_bench/render_model_utils.h" 9 #include "gpu/tools/compositor_model_bench/render_model_utils.h"
10 #include "gpu/tools/compositor_model_bench/render_tree.h" 10 #include "gpu/tools/compositor_model_bench/render_tree.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 static void TranslateInPlace(float* m, float tx, float ty, float tz) { 76 static void TranslateInPlace(float* m, float tx, float ty, float tz) {
77 m[12] += tx; 77 m[12] += tx;
78 m[13] += ty; 78 m[13] += ty;
79 m[14] += tz; 79 m[14] += tz;
80 } 80 }
81 81
82 /////////////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////////////
83 83
84 ShaderID ShaderIDFromString(std::string name) { 84 ShaderID ShaderIDFromString(const std::string& name) {
85 if (name == "VertexShaderPosTexYUVStretch") 85 if (name == "VertexShaderPosTexYUVStretch")
86 return VERTEX_SHADER_POS_TEX_YUV_STRETCH; 86 return VERTEX_SHADER_POS_TEX_YUV_STRETCH;
87 if (name == "VertexShaderPosTex") 87 if (name == "VertexShaderPosTex")
88 return VERTEX_SHADER_POS_TEX; 88 return VERTEX_SHADER_POS_TEX;
89 if (name == "VertexShaderPosTexTransform") 89 if (name == "VertexShaderPosTexTransform")
90 return VERTEX_SHADER_POS_TEX_TRANSFORM; 90 return VERTEX_SHADER_POS_TEX_TRANSFORM;
91 if (name == "FragmentShaderYUVVideo") 91 if (name == "FragmentShaderYUVVideo")
92 return FRAGMENT_SHADER_YUV_VIDEO; 92 return FRAGMENT_SHADER_YUV_VIDEO;
93 if (name == "FragmentShaderRGBATexFlipAlpha") 93 if (name == "FragmentShaderRGBATexFlipAlpha")
94 return FRAGMENT_SHADER_RGBA_TEX_FLIP_ALPHA; 94 return FRAGMENT_SHADER_RGBA_TEX_FLIP_ALPHA;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 float center_y = (top+bottom)/2 - g_current_tile_layer_height/2; 441 float center_y = (top+bottom)/2 - g_current_tile_layer_height/2;
442 TranslateInPlace(mv_transform, center_x, center_y, 0.0); 442 TranslateInPlace(mv_transform, center_x, center_y, 0.0);
443 443
444 Project(mv_transform, proj_transform); 444 Project(mv_transform, proj_transform);
445 GLint mat = glGetUniformLocationARB(prog, "matrix"); 445 GLint mat = glGetUniformLocationARB(prog, "matrix");
446 glUniformMatrix4fvARB(mat, 1, GL_TRUE, proj_transform); 446 glUniformMatrix4fvARB(mat, 1, GL_TRUE, proj_transform);
447 447
448 glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0); 448 glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
449 } 449 }
450 450
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698