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