| OLD | NEW | 
|    1  |    1  | 
|    2 /* |    2 /* | 
|    3  * Copyright 2011 Google Inc. |    3  * Copyright 2011 Google Inc. | 
|    4  * |    4  * | 
|    5  * Use of this source code is governed by a BSD-style license that can be |    5  * Use of this source code is governed by a BSD-style license that can be | 
|    6  * found in the LICENSE file. |    6  * found in the LICENSE file. | 
|    7  */ |    7  */ | 
|    8  |    8  | 
|    9 #include "GrAAHairLinePathRenderer.h" |    9 #include "GrAAHairLinePathRenderer.h" | 
|   10  |   10  | 
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  809         // the edge effects share this stage with glyph rendering |  809         // the edge effects share this stage with glyph rendering | 
|  810         // (kGlyphMaskStage in GrTextContext) && SW path rendering |  810         // (kGlyphMaskStage in GrTextContext) && SW path rendering | 
|  811         // (kPathMaskStage in GrSWMaskHelper) |  811         // (kPathMaskStage in GrSWMaskHelper) | 
|  812         kEdgeEffectStage = GrPaint::kTotalStages, |  812         kEdgeEffectStage = GrPaint::kTotalStages, | 
|  813     }; |  813     }; | 
|  814     static const int kEdgeAttrIndex = 1; |  814     static const int kEdgeAttrIndex = 1; | 
|  815  |  815  | 
|  816     GrEffectRef* hairLineEffect = HairLineEdgeEffect::Create(); |  816     GrEffectRef* hairLineEffect = HairLineEdgeEffect::Create(); | 
|  817     GrEffectRef* hairQuadEffect = HairQuadEdgeEffect::Create(); |  817     GrEffectRef* hairQuadEffect = HairQuadEdgeEffect::Create(); | 
|  818  |  818  | 
 |  819     SkRect devBounds; | 
 |  820     GetPathDevBounds(path, drawState->getRenderTarget(), adcd.getOriginalMatrix(
     ), &devBounds); | 
 |  821  | 
|  819     target->setIndexSourceToBuffer(fLinesIndexBuffer); |  822     target->setIndexSourceToBuffer(fLinesIndexBuffer); | 
|  820     int lines = 0; |  823     int lines = 0; | 
|  821     int nBufLines = fLinesIndexBuffer->maxQuads(); |  824     int nBufLines = fLinesIndexBuffer->maxQuads(); | 
|  822     drawState->setEffect(kEdgeEffectStage, hairLineEffect, kEdgeAttrIndex)->unre
     f(); |  825     drawState->setEffect(kEdgeEffectStage, hairLineEffect, kEdgeAttrIndex)->unre
     f(); | 
|  823     while (lines < lineCnt) { |  826     while (lines < lineCnt) { | 
|  824         int n = GrMin(lineCnt - lines, nBufLines); |  827         int n = GrMin(lineCnt - lines, nBufLines); | 
|  825         target->drawIndexed(kTriangles_GrPrimitiveType, |  828         target->drawIndexed(kTriangles_GrPrimitiveType, | 
|  826                             kVertsPerLineSeg*lines,    // startV |  829                             kVertsPerLineSeg*lines,    // startV | 
|  827                             0,                         // startI |  830                             0,                         // startI | 
|  828                             kVertsPerLineSeg*n,        // vCount |  831                             kVertsPerLineSeg*n,        // vCount | 
|  829                             kIdxsPerLineSeg*n);        // iCount |  832                             kIdxsPerLineSeg*n, | 
 |  833                             &devBounds);        // iCount | 
|  830         lines += n; |  834         lines += n; | 
|  831     } |  835     } | 
|  832  |  836  | 
|  833     target->setIndexSourceToBuffer(fQuadsIndexBuffer); |  837     target->setIndexSourceToBuffer(fQuadsIndexBuffer); | 
|  834     int quads = 0; |  838     int quads = 0; | 
|  835     drawState->setEffect(kEdgeEffectStage, hairQuadEffect, kEdgeAttrIndex)->unre
     f(); |  839     drawState->setEffect(kEdgeEffectStage, hairQuadEffect, kEdgeAttrIndex)->unre
     f(); | 
|  836     while (quads < quadCnt) { |  840     while (quads < quadCnt) { | 
|  837         int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer); |  841         int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer); | 
|  838         target->drawIndexed(kTriangles_GrPrimitiveType, |  842         target->drawIndexed(kTriangles_GrPrimitiveType, | 
|  839                             4 * lineCnt + kVertsPerQuad*quads, // startV |  843                             4 * lineCnt + kVertsPerQuad*quads, // startV | 
|  840                             0,                                 // startI |  844                             0,                                 // startI | 
|  841                             kVertsPerQuad*n,                   // vCount |  845                             kVertsPerQuad*n,                   // vCount | 
|  842                             kIdxsPerQuad*n);                   // iCount |  846                             kIdxsPerQuad*n,                    // iCount | 
 |  847                             &devBounds); | 
|  843         quads += n; |  848         quads += n; | 
|  844     } |  849     } | 
|  845     target->resetIndexSource(); |  850     target->resetIndexSource(); | 
|  846  |  851  | 
|  847     return true; |  852     return true; | 
|  848 } |  853 } | 
| OLD | NEW |