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

Side by Side Diff: src/gpu/gl/GrGLUtil.cpp

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space Created 5 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
« no previous file with comments | « src/gpu/gl/GrGLUtil.h ('k') | src/gpu/gl/GrGLXferProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGLUtil.h" 9 #include "GrGLUtil.h"
10 #include "SkMatrix.h" 10 #include "SkMatrix.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); 299 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR));
300 return GrGLGetVendorFromString((const char*) v); 300 return GrGLGetVendorFromString((const char*) v);
301 } 301 }
302 302
303 GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) { 303 GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) {
304 const GrGLubyte* v; 304 const GrGLubyte* v;
305 GR_GL_CALL_RET(gl, v, GetString(GR_GL_RENDERER)); 305 GR_GL_CALL_RET(gl, v, GetString(GR_GL_RENDERER));
306 return GrGLGetRendererFromString((const char*) v); 306 return GrGLGetRendererFromString((const char*) v);
307 } 307 }
308 308
309 template<> void GrGLGetMatrix<3>(GrGLfloat* dest, const SkMatrix& src) { 309 template<> void GrGLGetMatrix<3>(float* dest, const SkMatrix& src) {
310 GR_STATIC_ASSERT(sizeof(float) == sizeof (GrGLfloat));
310 // Col 0 311 // Col 0
311 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]); 312 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
312 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]); 313 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
313 dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]); 314 dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
314 315
315 // Col 1 316 // Col 1
316 dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]); 317 dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
317 dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]); 318 dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
318 dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]); 319 dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
319 320
320 // Col 2 321 // Col 2
321 dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]); 322 dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]);
322 dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]); 323 dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]);
323 dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]); 324 dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
324 } 325 }
325 326
326 template<> void GrGLGetMatrix<4>(GrGLfloat* dest, const SkMatrix& src) { 327 template<> void GrGLGetMatrix<4>(float* dest, const SkMatrix& src) {
328 GR_STATIC_ASSERT(sizeof(float) == sizeof (GrGLfloat));
327 // Col 0 329 // Col 0
328 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]); 330 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
329 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]); 331 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
330 dest[2] = 0; 332 dest[2] = 0;
331 dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]); 333 dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
332 334
333 // Col 1 335 // Col 1
334 dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]); 336 dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
335 dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]); 337 dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
336 dest[6] = 0; 338 dest[6] = 0;
(...skipping 29 matching lines...) Expand all
366 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); 368 GR_STATIC_ASSERT(2 == kGreater_StencilFunc);
367 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); 369 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc);
368 GR_STATIC_ASSERT(4 == kLess_StencilFunc); 370 GR_STATIC_ASSERT(4 == kLess_StencilFunc);
369 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); 371 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc);
370 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); 372 GR_STATIC_ASSERT(6 == kEqual_StencilFunc);
371 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); 373 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc);
372 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); 374 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount);
373 375
374 return gTable[basicFunc]; 376 return gTable[basicFunc];
375 } 377 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLUtil.h ('k') | src/gpu/gl/GrGLXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698