OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |