| 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" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 int glyphCount, int run, int subRu
n, | 415 int glyphCount, int run, int subRu
n, |
| 416 GrColor color, SkScalar transX, Sk
Scalar transY, | 416 GrColor color, SkScalar transX, Sk
Scalar transY, |
| 417 const SkPaint& skPaint, const SkSu
rfaceProps& props, | 417 const SkPaint& skPaint, const SkSu
rfaceProps& props, |
| 418 const GrDistanceFieldAdjustTable*
distanceAdjustTable, | 418 const GrDistanceFieldAdjustTable*
distanceAdjustTable, |
| 419 GrBatchFontCache* cache) { | 419 GrBatchFontCache* cache) { |
| 420 const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun
]; | 420 const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun
]; |
| 421 return this->createBatch(info, glyphCount, run, subRun, color, transX, trans
Y, skPaint, | 421 return this->createBatch(info, glyphCount, run, subRun, color, transX, trans
Y, skPaint, |
| 422 props, distanceAdjustTable, cache); | 422 props, distanceAdjustTable, cache); |
| 423 } | 423 } |
| 424 | 424 |
| 425 // TODO get this code building again | |
| 426 #ifdef CACHE_SANITY_CHECK | |
| 427 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
b& r) { | 425 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
b& r) { |
| 428 SkASSERT(l.fSize == r.fSize); | 426 SkASSERT_RELEASE(l.fSize == r.fSize); |
| 429 SkASSERT(l.fPool == r.fPool); | 427 SkASSERT_RELEASE(l.fPool == r.fPool); |
| 430 | 428 |
| 431 SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma); | 429 SkASSERT_RELEASE(l.fBlurRec.fSigma == r.fBlurRec.fSigma); |
| 432 SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle); | 430 SkASSERT_RELEASE(l.fBlurRec.fStyle == r.fBlurRec.fStyle); |
| 433 SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality); | 431 SkASSERT_RELEASE(l.fBlurRec.fQuality == r.fBlurRec.fQuality); |
| 434 | 432 |
| 435 SkASSERT(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth); | 433 SkASSERT_RELEASE(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth); |
| 436 SkASSERT(l.fStrokeInfo.fMiterLimit == r.fStrokeInfo.fMiterLimit); | 434 SkASSERT_RELEASE(l.fStrokeInfo.fMiterLimit == r.fStrokeInfo.fMiterLimit); |
| 437 SkASSERT(l.fStrokeInfo.fJoin == r.fStrokeInfo.fJoin); | 435 SkASSERT_RELEASE(l.fStrokeInfo.fJoin == r.fStrokeInfo.fJoin); |
| 438 | 436 |
| 439 SkASSERT(l.fBigGlyphs.count() == r.fBigGlyphs.count()); | 437 SkASSERT_RELEASE(l.fBigGlyphs.count() == r.fBigGlyphs.count()); |
| 440 for (int i = 0; i < l.fBigGlyphs.count(); i++) { | 438 for (int i = 0; i < l.fBigGlyphs.count(); i++) { |
| 441 const BigGlyph& lBigGlyph = l.fBigGlyphs[i]; | 439 const BigGlyph& lBigGlyph = l.fBigGlyphs[i]; |
| 442 const BigGlyph& rBigGlyph = r.fBigGlyphs[i]; | 440 const BigGlyph& rBigGlyph = r.fBigGlyphs[i]; |
| 443 | 441 |
| 444 SkASSERT(lBigGlyph.fPath == rBigGlyph.fPath); | 442 SkASSERT_RELEASE(lBigGlyph.fPath == rBigGlyph.fPath); |
| 445 // We can't assert that these have the same translations | 443 // We can't assert that these have the same translations |
| 446 } | 444 } |
| 447 | 445 |
| 448 SkASSERT(l.fKey == r.fKey); | 446 SkASSERT_RELEASE(l.fKey == r.fKey); |
| 449 SkASSERT(l.fViewMatrix.cheapEqualTo(r.fViewMatrix)); | 447 SkASSERT_RELEASE(l.fViewMatrix.cheapEqualTo(r.fViewMatrix)); |
| 450 SkASSERT(l.fPaintColor == r.fPaintColor); | 448 //SkASSERT_RELEASE(l.fPaintColor == r.fPaintColor); // Colors might not actu
ally be identical |
| 451 SkASSERT(l.fMaxMinScale == r.fMaxMinScale); | 449 SkASSERT_RELEASE(l.fMaxMinScale == r.fMaxMinScale); |
| 452 SkASSERT(l.fMinMaxScale == r.fMinMaxScale); | 450 SkASSERT_RELEASE(l.fMinMaxScale == r.fMinMaxScale); |
| 453 SkASSERT(l.fTextType == r.fTextType); | 451 SkASSERT_RELEASE(l.fTextType == r.fTextType); |
| 454 | 452 |
| 455 SkASSERT(l.fRunCount == r.fRunCount); | 453 SkASSERT_RELEASE(l.fRunCount == r.fRunCount); |
| 456 for (int i = 0; i < l.fRunCount; i++) { | 454 for (int i = 0; i < l.fRunCount; i++) { |
| 457 const Run& lRun = l.fRuns[i]; | 455 const Run& lRun = l.fRuns[i]; |
| 458 const Run& rRun = r.fRuns[i]; | 456 const Run& rRun = r.fRuns[i]; |
| 459 | 457 |
| 460 if (lRun.fStrike.get()) { | 458 if (lRun.fTypeface.get()) { |
| 461 SkASSERT(rRun.fStrike.get()); | 459 SkASSERT_RELEASE(rRun.fTypeface.get()); |
| 462 SkASSERT(GrBatchTextStrike::GetKey(*lRun.fStrike) == | 460 SkASSERT_RELEASE(SkTypeface::Equal(lRun.fTypeface, rRun.fTypeface)); |
| 463 GrBatchTextStrike::GetKey(*rRun.fStrike)); | |
| 464 | |
| 465 } else { | 461 } else { |
| 466 SkASSERT(!rRun.fStrike.get()); | 462 SkASSERT_RELEASE(!rRun.fTypeface.get()); |
| 467 } | 463 } |
| 468 | 464 |
| 469 if (lRun.fTypeface.get()) { | |
| 470 SkASSERT(rRun.fTypeface.get()); | |
| 471 SkASSERT(SkTypeface::Equal(lRun.fTypeface, rRun.fTypeface)); | |
| 472 } else { | |
| 473 SkASSERT(!rRun.fTypeface.get()); | |
| 474 } | |
| 475 | 465 |
| 476 // We offset bounds right before flush time so they will not be correct
here | 466 SkASSERT_RELEASE(lRun.fDescriptor.getDesc()); |
| 477 //SkASSERT(lRun.fVertexBounds == rRun.fVertexBounds); | 467 SkASSERT_RELEASE(rRun.fDescriptor.getDesc()); |
| 478 | 468 SkASSERT_RELEASE(lRun.fDescriptor.getDesc()->equals(*rRun.fDescriptor.ge
tDesc())); |
| 479 SkASSERT(lRun.fDescriptor.getDesc()); | |
| 480 SkASSERT(rRun.fDescriptor.getDesc()); | |
| 481 SkASSERT(lRun.fDescriptor.getDesc()->equals(*rRun.fDescriptor.getDesc())
); | |
| 482 | 469 |
| 483 if (lRun.fOverrideDescriptor.get()) { | 470 if (lRun.fOverrideDescriptor.get()) { |
| 484 SkASSERT(lRun.fOverrideDescriptor->getDesc()); | 471 SkASSERT_RELEASE(lRun.fOverrideDescriptor->getDesc()); |
| 485 SkASSERT(rRun.fOverrideDescriptor.get() && rRun.fOverrideDescriptor-
>getDesc());; | 472 SkASSERT_RELEASE(rRun.fOverrideDescriptor.get() && rRun.fOverrideDes
criptor->getDesc()); |
| 486 SkASSERT(lRun.fOverrideDescriptor->getDesc()->equals( | 473 SkASSERT_RELEASE(lRun.fOverrideDescriptor->getDesc()->equals( |
| 487 *rRun.fOverrideDescriptor->getDesc())); | 474 *rRun.fOverrideDescriptor->getDesc())); |
| 488 } else { | 475 } else { |
| 489 SkASSERT(!rRun.fOverrideDescriptor.get()); | 476 SkASSERT_RELEASE(!rRun.fOverrideDescriptor.get()); |
| 490 } | 477 } |
| 491 | 478 |
| 492 // color can be changed | 479 // color can be changed |
| 493 //SkASSERT(lRun.fColor == rRun.fColor); | 480 //SkASSERT(lRun.fColor == rRun.fColor); |
| 494 SkASSERT(lRun.fInitialized == rRun.fInitialized); | 481 SkASSERT_RELEASE(lRun.fInitialized == rRun.fInitialized); |
| 495 SkASSERT(lRun.fDrawAsPaths == rRun.fDrawAsPaths); | 482 SkASSERT_RELEASE(lRun.fDrawAsPaths == rRun.fDrawAsPaths); |
| 496 | 483 |
| 497 SkASSERT(lRun.fSubRunInfo.count() == rRun.fSubRunInfo.count()); | 484 SkASSERT_RELEASE(lRun.fSubRunInfo.count() == rRun.fSubRunInfo.count()); |
| 498 for(int j = 0; j < lRun.fSubRunInfo.count(); j++) { | 485 for(int j = 0; j < lRun.fSubRunInfo.count(); j++) { |
| 499 const Run::SubRunInfo& lSubRun = lRun.fSubRunInfo[j]; | 486 const Run::SubRunInfo& lSubRun = lRun.fSubRunInfo[j]; |
| 500 const Run::SubRunInfo& rSubRun = rRun.fSubRunInfo[j]; | 487 const Run::SubRunInfo& rSubRun = rRun.fSubRunInfo[j]; |
| 501 | 488 |
| 502 SkASSERT(lSubRun.fVertexStartIndex == rSubRun.fVertexStartIndex); | 489 // TODO we can do this check, but we have to apply the VM to the old
vertex bounds |
| 503 SkASSERT(lSubRun.fVertexEndIndex == rSubRun.fVertexEndIndex); | 490 //SkASSERT_RELEASE(lSubRun.vertexBounds() == rSubRun.vertexBounds())
; |
| 504 SkASSERT(lSubRun.fGlyphStartIndex == rSubRun.fGlyphStartIndex); | |
| 505 SkASSERT(lSubRun.fGlyphEndIndex == rSubRun.fGlyphEndIndex); | |
| 506 SkASSERT(lSubRun.fTextRatio == rSubRun.fTextRatio); | |
| 507 SkASSERT(lSubRun.fMaskFormat == rSubRun.fMaskFormat); | |
| 508 SkASSERT(lSubRun.fDrawAsDistanceFields == rSubRun.fDrawAsDistanceFie
lds); | |
| 509 SkASSERT(lSubRun.fUseLCDText == rSubRun.fUseLCDText); | |
| 510 | 491 |
| 511 //We can't compare the bulk use tokens with this method | 492 if (lSubRun.strike()) { |
| 512 /* | 493 SkASSERT_RELEASE(rSubRun.strike()); |
| 513 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate.count() == | 494 SkASSERT_RELEASE(GrBatchTextStrike::GetKey(*lSubRun.strike()) == |
| 514 rSubRun.fBulkUseToken.fPlotsToUpdate.count()); | 495 GrBatchTextStrike::GetKey(*rSubRun.strike())); |
| 515 SkASSERT(lSubRun.fBulkUseToken.fPlotAlreadyUpdated == | 496 |
| 516 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); | 497 } else { |
| 517 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { | 498 SkASSERT_RELEASE(!rSubRun.strike()); |
| 518 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == | 499 } |
| 519 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); | 500 |
| 520 }*/ | 501 SkASSERT_RELEASE(lSubRun.vertexStartIndex() == rSubRun.vertexStartIn
dex()); |
| 502 SkASSERT_RELEASE(lSubRun.vertexEndIndex() == rSubRun.vertexEndIndex(
)); |
| 503 SkASSERT_RELEASE(lSubRun.glyphStartIndex() == rSubRun.glyphStartInde
x()); |
| 504 SkASSERT_RELEASE(lSubRun.glyphEndIndex() == rSubRun.glyphEndIndex())
; |
| 505 SkASSERT_RELEASE(lSubRun.maskFormat() == rSubRun.maskFormat()); |
| 506 SkASSERT_RELEASE(lSubRun.drawAsDistanceFields() == rSubRun.drawAsDis
tanceFields()); |
| 507 SkASSERT_RELEASE(lSubRun.hasUseLCDText() == rSubRun.hasUseLCDText())
; |
| 521 } | 508 } |
| 522 } | 509 } |
| 523 } | 510 } |
| 524 | |
| 525 #endif | |
| OLD | NEW |