| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2015 Google Inc. | 2  * Copyright 2015 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 "GrAtlasTextBlob.h" | 8 #include "GrAtlasTextBlob.h" | 
| 9 | 9 | 
| 10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" | 
| 11 #include "GrContext.h" | 11 #include "GrContext.h" | 
| 12 #include "GrDrawContext.h" | 12 #include "GrDrawContext.h" | 
| 13 #include "GrPipelineBuilder.h" |  | 
| 14 #include "GrTextUtils.h" | 13 #include "GrTextUtils.h" | 
| 15 #include "SkColorFilter.h" | 14 #include "SkColorFilter.h" | 
| 16 #include "SkDrawFilter.h" | 15 #include "SkDrawFilter.h" | 
| 17 #include "SkGlyphCache.h" | 16 #include "SkGlyphCache.h" | 
| 18 #include "SkTextBlobRunIterator.h" | 17 #include "SkTextBlobRunIterator.h" | 
| 19 #include "batches/GrAtlasTextBatch.h" | 18 #include "batches/GrAtlasTextBatch.h" | 
| 20 | 19 | 
| 21 GrAtlasTextBlob* GrAtlasTextBlob::Create(GrMemoryPool* pool, int glyphCount, int
      runCount) { | 20 GrAtlasTextBlob* GrAtlasTextBlob::Create(GrMemoryPool* pool, int glyphCount, int
      runCount) { | 
| 22     // We allocate size for the GrAtlasTextBlob itself, plus size for the vertic
     es array, | 21     // We allocate size for the GrAtlasTextBlob itself, plus size for the vertic
     es array, | 
| 23     // and size for the glyphIds array. | 22     // and size for the glyphIds array. | 
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 317         } | 316         } | 
| 318 | 317 | 
| 319         GrColor color = grPaint.getColor(); | 318         GrColor color = grPaint.getColor(); | 
| 320 | 319 | 
| 321         SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run, | 320         SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run, | 
| 322                                                           subRun, viewMatrix, x,
      y, color, | 321                                                           subRun, viewMatrix, x,
      y, color, | 
| 323                                                           skPaint, props, | 322                                                           skPaint, props, | 
| 324                                                           distanceAdjustTable, d
     c->isGammaCorrect(), | 323                                                           distanceAdjustTable, d
     c->isGammaCorrect(), | 
| 325                                                           cache)); | 324                                                           cache)); | 
| 326 | 325 | 
| 327         GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint)); | 326         dc->drawBatch(grPaint, clip, GrUserStencilSettings::kUnused, batch); | 
| 328 |  | 
| 329         dc->drawBatch(pipelineBuilder, clip, batch); |  | 
| 330     } | 327     } | 
| 331 } | 328 } | 
| 332 | 329 | 
| 333 static void calculate_translation(bool applyVM, | 330 static void calculate_translation(bool applyVM, | 
| 334                                   const SkMatrix& newViewMatrix, SkScalar newX, 
     SkScalar newY, | 331                                   const SkMatrix& newViewMatrix, SkScalar newX, 
     SkScalar newY, | 
| 335                                   const SkMatrix& currentViewMatrix, SkScalar cu
     rrentX, | 332                                   const SkMatrix& currentViewMatrix, SkScalar cu
     rrentX, | 
| 336                                   SkScalar currentY, SkScalar* transX, SkScalar*
      transY) { | 333                                   SkScalar currentY, SkScalar* transX, SkScalar*
      transY) { | 
| 337     if (applyVM) { | 334     if (applyVM) { | 
| 338         *transX = newViewMatrix.getTranslateX() + | 335         *transX = newViewMatrix.getTranslateX() + | 
| 339                   newViewMatrix.getScaleX() * (newX - currentX) + | 336                   newViewMatrix.getScaleX() * (newX - currentX) + | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 559 | 556 | 
| 560 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa
     trix, | 557 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa
     trix, | 
| 561                                                           SkScalar x, SkScalar y
     , SkScalar* transX, | 558                                                           SkScalar x, SkScalar y
     , SkScalar* transX, | 
| 562                                                           SkScalar* transY) { | 559                                                           SkScalar* transY) { | 
| 563     calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y, | 560     calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y, | 
| 564                           fCurrentViewMatrix, fX, fY, transX, transY); | 561                           fCurrentViewMatrix, fX, fY, transX, transY); | 
| 565     fCurrentViewMatrix = viewMatrix; | 562     fCurrentViewMatrix = viewMatrix; | 
| 566     fX = x; | 563     fX = x; | 
| 567     fY = y; | 564     fY = y; | 
| 568 } | 565 } | 
| OLD | NEW | 
|---|