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

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

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 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
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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 bool fCoverageIgnored; 522 bool fCoverageIgnored;
523 }; 523 };
524 524
525 BatchTracker fBatch; 525 BatchTracker fBatch;
526 SkSTArray<1, Geometry, true> fGeoData; 526 SkSTArray<1, Geometry, true> fGeoData;
527 GrBatchAtlas* fAtlas; 527 GrBatchAtlas* fAtlas;
528 PathCache* fPathCache; 528 PathCache* fPathCache;
529 PathDataList* fPathList; 529 PathDataList* fPathList;
530 }; 530 };
531 531
532 static GrBatchAtlas* create_atlas(GrTextureProvider* provider, GrBatchAtlas::Evi ctionFunc func, void* data) { 532 static GrBatchAtlas* create_atlas(GrResourceProvider* provider, GrBatchAtlas::Ev ictionFunc func,
533 void* data) {
533 GrBatchAtlas* atlas; 534 GrBatchAtlas* atlas;
534 // Create a new atlas 535 // Create a new atlas
535 GrSurfaceDesc desc; 536 GrSurfaceDesc desc;
536 desc.fFlags = kNone_GrSurfaceFlags; 537 desc.fFlags = kNone_GrSurfaceFlags;
537 desc.fWidth = ATLAS_TEXTURE_WIDTH; 538 desc.fWidth = ATLAS_TEXTURE_WIDTH;
538 desc.fHeight = ATLAS_TEXTURE_HEIGHT; 539 desc.fHeight = ATLAS_TEXTURE_HEIGHT;
539 desc.fConfig = kAlpha_8_GrPixelConfig; 540 desc.fConfig = kAlpha_8_GrPixelConfig;
540 541
541 // We don't want to flush the context so we claim we're in the middle of flu shing so as to 542 // We don't want to flush the context so we claim we're in the middle of flu shing so as to
542 // guarantee we do not recieve a texture with pending IO 543 // guarantee we do not recieve a texture with pending IO
543 GrTexture* texture = provider->refScratchTexture( 544 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156)
544 desc, GrTextureProvider::kApprox_ScratchTexMatch, true); 545 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
546 GrTexture* texture = provider->createApproxTexture(desc, kFlags);
545 if (texture) { 547 if (texture) {
546 atlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y)); 548 atlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y));
547 } else { 549 } else {
548 return NULL; 550 return NULL;
549 } 551 }
550 atlas->registerEvictionCallback(func, data); 552 atlas->registerEvictionCallback(func, data);
551 return atlas; 553 return atlas;
552 } 554 }
553 555
554 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { 556 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 geometry.fPath = GrTest::TestPath(random); 642 geometry.fPath = GrTest::TestPath(random);
641 geometry.fAntiAlias = random->nextBool(); 643 geometry.fAntiAlias = random->nextBool();
642 644
643 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 645 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
644 gTestStruct.fAtlas, 646 gTestStruct.fAtlas,
645 &gTestStruct.fPathCache, 647 &gTestStruct.fPathCache,
646 &gTestStruct.fPathList); 648 &gTestStruct.fPathList);
647 } 649 }
648 650
649 #endif 651 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698