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

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: update document for SkVertState.h, and fix a small bug" Created 6 years, 7 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 It chooses an appropriate function to traverse the vertices according to
bsalomon 2014/05/29 18:27:04 This is a helper for drawVertices(). It is used to
15 SkCanvas::VertexMode. For example, given vertice indices{0, 1, 2, 3, 4, 5},
16 it returns vertice indices{0, 1, 2; 3, 4, 5} for kTriangles_VertexMode, but
17 returns {0, 1, 2; 0, 2, 3; 0, 3, 4; 0, 4, 5} for kTriangleFan_VertexMode.
18
19 This struct can help to draw the skeleton for a mesh.
20 */
21
22 struct VertState {
23 int f0, f1, f2;
24
25 /**
26 * Pass the indices ptr and index count to construct VertState. Otherwise,
bsalomon 2014/05/29 18:27:04 Construct a VertState from a vertex count, index a
27 * Pass the vertex count to the constructor, then the indices will be
28 * thought as {0, 1, ..., vertex count - 1}.
29 */
30 VertState(int vCount, const uint16_t indices[], int indexCount)
31 : fIndices(indices) {
32 fCurrIndex = 0;
33 if (indices) {
34 fCount = indexCount;
35 } else {
36 fCount = vCount;
37 }
38 }
39
40 typedef bool (*Proc)(VertState*);
41
42 /**
43 * Choose an appropriate function to traverse the vertices.
44 * @param mode Specifies the SkCanvas::VertexMode.
45 */
46 Proc chooseProc(SkCanvas::VertexMode mode);
47
48 private:
49 int fCount;
50 int fCurrIndex;
51 const uint16_t* fIndices;
52
53 static bool Triangles(VertState*);
54 static bool TrianglesX(VertState*);
55 static bool TriangleStrip(VertState*);
56 static bool TriangleStripX(VertState*);
57 static bool TriangleFan(VertState*);
58 static bool TriangleFanX(VertState*);
59 };
60
61 #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