Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: src/gpu/GrAADistanceFieldPathRenderer.cpp

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/GrBatchFontCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/GrBatchFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698