| 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 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
| 8 | 8 |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 | 694 |
| 695 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 695 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
| 696 // if we have RGB, then we won't have any SkShaders so no need to use a
localmatrix. | 696 // if we have RGB, then we won't have any SkShaders so no need to use a
localmatrix. |
| 697 // TODO actually only invert if we don't have RGBA | 697 // TODO actually only invert if we don't have RGBA |
| 698 SkMatrix localMatrix; | 698 SkMatrix localMatrix; |
| 699 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ | 699 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ |
| 700 SkDebugf("Cannot invert viewmatrix\n"); | 700 SkDebugf("Cannot invert viewmatrix\n"); |
| 701 return; | 701 return; |
| 702 } | 702 } |
| 703 | 703 |
| 704 GrTexture* texture = fFontCache->getTexture(fMaskFormat); |
| 705 if (!texture) { |
| 706 SkDebugf("Could not allocate backing texture for atlas\n"); |
| 707 return; |
| 708 } |
| 709 |
| 704 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone
_FilterMode); | 710 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone
_FilterMode); |
| 705 | 711 |
| 706 // This will be ignored in the non A8 case | 712 // This will be ignored in the non A8 case |
| 707 bool opaqueVertexColors = GrColorIsOpaque(this->color()); | 713 bool opaqueVertexColors = GrColorIsOpaque(this->color()); |
| 708 SkAutoTUnref<const GrGeometryProcessor> gp( | 714 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 709 GrBitmapTextGeoProc::Create(this->color(), | 715 GrBitmapTextGeoProc::Create(this->color(), |
| 710 fFontCache->getTexture(fMaskFormat), | 716 texture, |
| 711 params, | 717 params, |
| 712 fMaskFormat, | 718 fMaskFormat, |
| 713 opaqueVertexColors, | 719 opaqueVertexColors, |
| 714 localMatrix)); | 720 localMatrix)); |
| 715 | 721 |
| 716 size_t vertexStride = gp->getVertexStride(); | 722 size_t vertexStride = gp->getVertexStride(); |
| 717 SkASSERT(vertexStride == get_vertex_stride(fMaskFormat)); | 723 SkASSERT(vertexStride == get_vertex_stride(fMaskFormat)); |
| 718 | 724 |
| 719 this->initDraw(batchTarget, gp, pipeline); | 725 this->initDraw(batchTarget, gp, pipeline); |
| 720 | 726 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 | 1099 |
| 1094 GrColor color = grPaint.getColor(); | 1100 GrColor color = grPaint.getColor(); |
| 1095 uint8_t paintAlpha = skPaint.getAlpha(); | 1101 uint8_t paintAlpha = skPaint.getAlpha(); |
| 1096 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 1102 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
| 1097 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, paintAlp
ha); | 1103 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, paintAlp
ha); |
| 1098 } | 1104 } |
| 1099 | 1105 |
| 1100 // Now flush big glyphs | 1106 // Now flush big glyphs |
| 1101 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip); | 1107 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip); |
| 1102 } | 1108 } |
| OLD | NEW |