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

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

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 1, 4, 2 59 1, 4, 2
60 }; 60 };
61 61
62 static const int kIdxsPerQuad = SK_ARRAY_COUNT(kQuadIdxBufPattern); 62 static const int kIdxsPerQuad = SK_ARRAY_COUNT(kQuadIdxBufPattern);
63 static const int kQuadNumVertices = 5; 63 static const int kQuadNumVertices = 5;
64 static const int kQuadsNumInIdxBuffer = 256; 64 static const int kQuadsNumInIdxBuffer = 256;
65 GR_DECLARE_STATIC_UNIQUE_KEY(gQuadsIndexBufferKey); 65 GR_DECLARE_STATIC_UNIQUE_KEY(gQuadsIndexBufferKey);
66 66
67 static const GrIndexBuffer* ref_quads_index_buffer(GrResourceProvider* resourceP rovider) { 67 static const GrIndexBuffer* ref_quads_index_buffer(GrResourceProvider* resourceP rovider) {
68 GR_DEFINE_STATIC_UNIQUE_KEY(gQuadsIndexBufferKey); 68 GR_DEFINE_STATIC_UNIQUE_KEY(gQuadsIndexBufferKey);
69 return resourceProvider->refOrCreateInstancedIndexBuffer( 69 return resourceProvider->findOrCreateInstancedIndexBuffer(
70 kQuadIdxBufPattern, kIdxsPerQuad, kQuadsNumInIdxBuffer, kQuadNumVertices , 70 kQuadIdxBufPattern, kIdxsPerQuad, kQuadsNumInIdxBuffer, kQuadNumVertices ,
71 gQuadsIndexBufferKey); 71 gQuadsIndexBufferKey);
72 } 72 }
73 73
74 74
75 // Each line segment is rendered as two quads and two triangles. 75 // Each line segment is rendered as two quads and two triangles.
76 // p0 and p1 have alpha = 1 while all other points have alpha = 0. 76 // p0 and p1 have alpha = 1 while all other points have alpha = 0.
77 // The four external points are offset 1 pixel perpendicular to the 77 // The four external points are offset 1 pixel perpendicular to the
78 // line and half a pixel parallel to the line. 78 // line and half a pixel parallel to the line.
79 // 79 //
(...skipping 13 matching lines...) Expand all
93 }; 93 };
94 94
95 static const int kIdxsPerLineSeg = SK_ARRAY_COUNT(kLineSegIdxBufPattern); 95 static const int kIdxsPerLineSeg = SK_ARRAY_COUNT(kLineSegIdxBufPattern);
96 static const int kLineSegNumVertices = 6; 96 static const int kLineSegNumVertices = 6;
97 static const int kLineSegsNumInIdxBuffer = 256; 97 static const int kLineSegsNumInIdxBuffer = 256;
98 98
99 GR_DECLARE_STATIC_UNIQUE_KEY(gLinesIndexBufferKey); 99 GR_DECLARE_STATIC_UNIQUE_KEY(gLinesIndexBufferKey);
100 100
101 static const GrIndexBuffer* ref_lines_index_buffer(GrResourceProvider* resourceP rovider) { 101 static const GrIndexBuffer* ref_lines_index_buffer(GrResourceProvider* resourceP rovider) {
102 GR_DEFINE_STATIC_UNIQUE_KEY(gLinesIndexBufferKey); 102 GR_DEFINE_STATIC_UNIQUE_KEY(gLinesIndexBufferKey);
103 return resourceProvider->refOrCreateInstancedIndexBuffer( 103 return resourceProvider->findOrCreateInstancedIndexBuffer(
104 kLineSegIdxBufPattern, kIdxsPerLineSeg, kLineSegsNumInIdxBuffer, kLineS egNumVertices, 104 kLineSegIdxBufPattern, kIdxsPerLineSeg, kLineSegsNumInIdxBuffer, kLineS egNumVertices,
105 gLinesIndexBufferKey); 105 gLinesIndexBufferKey);
106 } 106 }
107 107
108 // Takes 178th time of logf on Z600 / VC2010 108 // Takes 178th time of logf on Z600 / VC2010
109 static int get_float_exp(float x) { 109 static int get_float_exp(float x) {
110 GR_STATIC_ASSERT(sizeof(int) == sizeof(float)); 110 GR_STATIC_ASSERT(sizeof(int) == sizeof(float));
111 #ifdef SK_DEBUG 111 #ifdef SK_DEBUG
112 static bool tested; 112 static bool tested;
113 if (!tested) { 113 if (!tested) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 GrColor color = GrRandomColor(random); 989 GrColor color = GrRandomColor(random);
990 SkMatrix viewMatrix = GrTest::TestMatrix(random); 990 SkMatrix viewMatrix = GrTest::TestMatrix(random);
991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
992 SkPath path = GrTest::TestPath(random); 992 SkPath path = GrTest::TestPath(random);
993 SkIRect devClipBounds; 993 SkIRect devClipBounds;
994 devClipBounds.setEmpty(); 994 devClipBounds.setEmpty();
995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
996 } 996 }
997 997
998 #endif 998 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698