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

Side by Side Diff: include/core/SkVertState.h

Issue 189963004: Fix the rendering error of SkDraw::drawVertices in gpu path for solid color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: code rebase + update comments according to Brian's suggestions Created 6 years, 6 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 | « include/core/SkCanvas.h ('k') | src/core/SkDraw.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkVertState_DEFINED
9 #define SkVertState_DEFINED
10
11 #include "SkCanvas.h"
12
13 /** \struct VertState
14 This is a helper for drawVertices(). It is used to iterate over the triangle s
15 that are to be rendered based on an SkCanvas::VertexMode and (optionally) an
16 index array. It does not copy the index array and the client must ensure it
17 remains valid for the lifetime of the VertState object.
18 */
19
20 struct VertState {
21 int f0, f1, f2;
22
23 /**
24 * Construct a VertState from a vertex count, index array, and index count.
25 * If the vertices are unindexed pass NULL for indices.
26 */
27 VertState(int vCount, const uint16_t indices[], int indexCount)
28 : fIndices(indices) {
29 fCurrIndex = 0;
30 if (indices) {
31 fCount = indexCount;
32 } else {
33 fCount = vCount;
34 }
35 }
36
37 typedef bool (*Proc)(VertState*);
38
39 /**
40 * Choose an appropriate function to traverse the vertices.
41 * @param mode Specifies the SkCanvas::VertexMode.
42 */
43 Proc chooseProc(SkCanvas::VertexMode mode);
44
45 private:
46 int fCount;
47 int fCurrIndex;
48 const uint16_t* fIndices;
49
50 static bool Triangles(VertState*);
51 static bool TrianglesX(VertState*);
52 static bool TriangleStrip(VertState*);
53 static bool TriangleStripX(VertState*);
54 static bool TriangleFan(VertState*);
55 static bool TriangleFanX(VertState*);
56 };
57
58 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698