OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" | 9 #include "GrAADistanceFieldPathRenderer.h" |
10 | 10 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 if (!fAtlas) { | 583 if (!fAtlas) { |
584 // Create a new atlas | 584 // Create a new atlas |
585 GrSurfaceDesc desc; | 585 GrSurfaceDesc desc; |
586 desc.fFlags = kNone_GrSurfaceFlags; | 586 desc.fFlags = kNone_GrSurfaceFlags; |
587 desc.fWidth = ATLAS_TEXTURE_WIDTH; | 587 desc.fWidth = ATLAS_TEXTURE_WIDTH; |
588 desc.fHeight = ATLAS_TEXTURE_HEIGHT; | 588 desc.fHeight = ATLAS_TEXTURE_HEIGHT; |
589 desc.fConfig = kAlpha_8_GrPixelConfig; | 589 desc.fConfig = kAlpha_8_GrPixelConfig; |
590 | 590 |
591 // We don't want to flush the context so we claim we're in the middle of
flushing so as to | 591 // We don't want to flush the context so we claim we're in the middle of
flushing so as to |
592 // guarantee we do not recieve a texture with pending IO | 592 // guarantee we do not recieve a texture with pending IO |
593 GrTexture* texture = fContext->refScratchTexture(desc, GrContext::kAppro
x_ScratchTexMatch, | 593 GrTexture* texture = fContext->textureProvider()->refScratchTexture( |
594 true); | 594 desc, GrTextureProvider::kApprox_ScratchTexMatch, true); |
595 if (texture) { | 595 if (texture) { |
596 fAtlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y
)); | 596 fAtlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y
)); |
597 } else { | 597 } else { |
598 return false; | 598 return false; |
599 } | 599 } |
600 fAtlas->registerEvictionCallback(&GrAADistanceFieldPathRenderer::HandleE
viction, | 600 fAtlas->registerEvictionCallback(&GrAADistanceFieldPathRenderer::HandleE
viction, |
601 (void*)this); | 601 (void*)this); |
602 } | 602 } |
603 | 603 |
604 AADistanceFieldPathBatch::Geometry geometry(stroke.getStrokeRec()); | 604 AADistanceFieldPathBatch::Geometry geometry(stroke.getStrokeRec()); |
605 geometry.fPath = path; | 605 geometry.fPath = path; |
606 geometry.fAntiAlias = antiAlias; | 606 geometry.fAntiAlias = antiAlias; |
607 | 607 |
608 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, | 608 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, |
609 fAtlas, &fPathC
ache, &fPathList)); | 609 fAtlas, &fPathC
ache, &fPathList)); |
610 | 610 |
611 SkRect bounds = path.getBounds(); | 611 SkRect bounds = path.getBounds(); |
612 viewMatrix.mapRect(&bounds); | 612 viewMatrix.mapRect(&bounds); |
613 target->drawBatch(pipelineBuilder, batch, &bounds); | 613 target->drawBatch(pipelineBuilder, batch, &bounds); |
614 | 614 |
615 return true; | 615 return true; |
616 } | 616 } |
617 | 617 |
OLD | NEW |