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

Side by Side Diff: src/gpu/batches/GrAnalyticRectBatch.cpp

Issue 2248323003: Simplify adding attributes to GrGeometryProcessor (Closed) Base URL: https://chromium.googlesource.com/skia.git@xformhelper
Patch Set: Revert removal of fAttribNames Created 4 years, 4 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
« no previous file with comments | « src/gpu/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/batches/GrMSAAPathRenderer.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 2016 Google Inc. 2 * Copyright 2016 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 "GrAnalyticRectBatch.h" 8 #include "GrAnalyticRectBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * Half height + 0.5 48 * Half height + 0.5
49 * The center and vector are stored in a vec4 varying ("RectEdge") with the 49 * The center and vector are stored in a vec4 varying ("RectEdge") with the
50 * center in the xy components and the vector in the zw components. 50 * center in the xy components and the vector in the zw components.
51 * The munged width and height are stored in a vec2 varying ("WidthHeight") 51 * The munged width and height are stored in a vec2 varying ("WidthHeight")
52 * with the width in x and the height in y. 52 * with the width in x and the height in y.
53 */ 53 */
54 class RectGeometryProcessor : public GrGeometryProcessor { 54 class RectGeometryProcessor : public GrGeometryProcessor {
55 public: 55 public:
56 RectGeometryProcessor(const SkMatrix& localMatrix) : fLocalMatrix(localMatri x) { 56 RectGeometryProcessor(const SkMatrix& localMatrix) : fLocalMatrix(localMatri x) {
57 this->initClassID<RectGeometryProcessor>(); 57 this->initClassID<RectGeometryProcessor>();
58 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_G rVertexAttribType, 58 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAtt ribType,
59 kHigh_GrSLPrecision)); 59 kHigh_GrSLPrecision);
60 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrV ertexAttribType)); 60 fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttri bType);
61 fInRectEdge = &this->addVertexAttrib(Attribute("inRectEdge", kVec4f_G rVertexAttribType)); 61 fInRectEdge = &this->addVertexAttrib("inRectEdge", kVec4f_GrVertexAtt ribType);
62 fInWidthHeight = &this->addVertexAttrib(Attribute("inWidthHeight", 62 fInWidthHeight = &this->addVertexAttrib("inWidthHeight", kVec2f_GrVertex AttribType);
63 kVec2f_GrVertexAttribT ype));
64 } 63 }
65 64
66 bool implementsDistanceVector() const override { return true; }; 65 bool implementsDistanceVector() const override { return true; };
67 66
68 const Attribute* inPosition() const { return fInPosition; } 67 const Attribute* inPosition() const { return fInPosition; }
69 const Attribute* inColor() const { return fInColor; } 68 const Attribute* inColor() const { return fInColor; }
70 const Attribute* inRectEdge() const { return fInRectEdge; } 69 const Attribute* inRectEdge() const { return fInRectEdge; }
71 const Attribute* inWidthHeight() const { return fInWidthHeight; } 70 const Attribute* inWidthHeight() const { return fInWidthHeight; }
72 71
73 const SkMatrix& localMatrix() const { return fLocalMatrix; } 72 const SkMatrix& localMatrix() const { return fLocalMatrix; }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 DRAW_BATCH_TEST_DEFINE(AnalyticRectBatch) { 405 DRAW_BATCH_TEST_DEFINE(AnalyticRectBatch) {
407 SkMatrix viewMatrix = GrTest::TestMatrix(random); 406 SkMatrix viewMatrix = GrTest::TestMatrix(random);
408 GrColor color = GrRandomColor(random); 407 GrColor color = GrRandomColor(random);
409 SkRect rect = GrTest::TestSquare(random); 408 SkRect rect = GrTest::TestSquare(random);
410 SkRect croppedRect = GrTest::TestSquare(random); 409 SkRect croppedRect = GrTest::TestSquare(random);
411 SkRect bounds = GrTest::TestSquare(random); 410 SkRect bounds = GrTest::TestSquare(random);
412 return new AnalyticRectBatch(color, viewMatrix, rect, croppedRect, bounds); 411 return new AnalyticRectBatch(color, viewMatrix, rect, croppedRect, bounds);
413 } 412 }
414 413
415 #endif 414 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/batches/GrMSAAPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698