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