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

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 1434313002: Make all GrFragmentProcessors GL independent. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrFragmentProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('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 2013 Google Inc. 2 * Copyright 2013 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 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
11 #include "GrBatchTest.h" 11 #include "GrBatchTest.h"
12 #include "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
13 #include "GrGeometryProcessor.h" 13 #include "GrGeometryProcessor.h"
14 #include "GrInvariantOutput.h" 14 #include "GrInvariantOutput.h"
15 #include "GrPipelineBuilder.h" 15 #include "GrPipelineBuilder.h"
16 #include "GrProcessor.h" 16 #include "GrProcessor.h"
17 #include "GrResourceProvider.h" 17 #include "GrResourceProvider.h"
18 #include "GrVertexBuffer.h" 18 #include "GrVertexBuffer.h"
19 #include "SkRRect.h" 19 #include "SkRRect.h"
20 #include "SkStrokeRec.h" 20 #include "SkStrokeRec.h"
21 #include "SkTLazy.h" 21 #include "SkTLazy.h"
22 #include "batches/GrVertexBatch.h" 22 #include "batches/GrVertexBatch.h"
23 #include "effects/GrRRectEffect.h" 23 #include "effects/GrRRectEffect.h"
24 #include "gl/GrGLUtil.h"
25 #include "gl/GrGLGeometryProcessor.h" 24 #include "gl/GrGLGeometryProcessor.h"
26 #include "glsl/GrGLSLFragmentShaderBuilder.h" 25 #include "glsl/GrGLSLFragmentShaderBuilder.h"
27 #include "glsl/GrGLSLProgramBuilder.h" 26 #include "glsl/GrGLSLProgramBuilder.h"
28 #include "glsl/GrGLSLProgramDataManager.h" 27 #include "glsl/GrGLSLProgramDataManager.h"
29 #include "glsl/GrGLSLVertexShaderBuilder.h" 28 #include "glsl/GrGLSLVertexShaderBuilder.h"
29 #include "glsl/GrGLSLUtil.h"
30 30
31 // TODO(joshualitt) - Break this file up during GrBatch post implementation clea nup 31 // TODO(joshualitt) - Break this file up during GrBatch post implementation clea nup
32 32
33 namespace { 33 namespace {
34 // TODO(joshualitt) add per vertex colors 34 // TODO(joshualitt) add per vertex colors
35 struct CircleVertex { 35 struct CircleVertex {
36 SkPoint fPos; 36 SkPoint fPos;
37 SkPoint fOffset; 37 SkPoint fOffset;
38 SkScalar fOuterRadius; 38 SkScalar fOuterRadius;
39 SkScalar fInnerRadius; 39 SkScalar fInnerRadius;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 b->add32(key); 500 b->add32(key);
501 } 501 }
502 502
503 void setData(const GrGLSLProgramDataManager& pdman, 503 void setData(const GrGLSLProgramDataManager& pdman,
504 const GrPrimitiveProcessor& gp) override { 504 const GrPrimitiveProcessor& gp) override {
505 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>(); 505 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
506 506
507 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) { 507 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) {
508 fViewMatrix = dee.viewMatrix(); 508 fViewMatrix = dee.viewMatrix();
509 float viewMatrix[3 * 3]; 509 float viewMatrix[3 * 3];
510 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); 510 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
511 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 511 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
512 } 512 }
513 513
514 if (dee.color() != fColor) { 514 if (dee.color() != fColor) {
515 float c[4]; 515 float c[4];
516 GrColorToRGBAFloat(dee.color(), c); 516 GrColorToRGBAFloat(dee.color(), c);
517 pdman.set4fv(fColorUniform, 1, c); 517 pdman.set4fv(fColorUniform, 1, c);
518 fColor = dee.color(); 518 fColor = dee.color();
519 } 519 }
520 } 520 }
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 } 2032 }
2033 2033
2034 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 2034 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2036 GrColor color = GrRandomColor(random); 2036 GrColor color = GrRandomColor(random);
2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
2039 } 2039 }
2040 2040
2041 #endif 2041 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698