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

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

Issue 2255963002: Batched implementation of drawLattice() for GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve bench Created 4 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 * 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 "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 17 matching lines...) Expand all
28 28
29 #include "effects/GrRRectEffect.h" 29 #include "effects/GrRRectEffect.h"
30 30
31 #include "instanced/InstancedRendering.h" 31 #include "instanced/InstancedRendering.h"
32 32
33 #include "text/GrAtlasTextContext.h" 33 #include "text/GrAtlasTextContext.h"
34 #include "text/GrStencilAndCoverTextContext.h" 34 #include "text/GrStencilAndCoverTextContext.h"
35 35
36 #include "../private/GrAuditTrail.h" 36 #include "../private/GrAuditTrail.h"
37 37
38 #include "SkLatticeIter.h"
39
38 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext()) 40 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext())
39 #define ASSERT_SINGLE_OWNER \ 41 #define ASSERT_SINGLE_OWNER \
40 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) 42 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
41 #define ASSERT_SINGLE_OWNER_PRIV \ 43 #define ASSERT_SINGLE_OWNER_PRIV \
42 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);) 44 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);)
43 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; } 45 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; }
44 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; } 46 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; }
45 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; } 47 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
46 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; } 48 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; }
47 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; } 49 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 return; 994 return;
993 } 995 }
994 } 996 }
995 997
996 SkPath path; 998 SkPath path;
997 path.setIsVolatile(true); 999 path.setIsVolatile(true);
998 path.addOval(oval); 1000 path.addOval(oval);
999 this->internalDrawPath(clip, paint, viewMatrix, path, style); 1001 this->internalDrawPath(clip, paint, viewMatrix, path, style);
1000 } 1002 }
1001 1003
1002 void GrDrawContext::drawImageNine(const GrClip& clip, 1004 void GrDrawContext::drawImageLattice(const GrClip& clip,
1003 const GrPaint& paint, 1005 const GrPaint& paint,
1004 const SkMatrix& viewMatrix, 1006 const SkMatrix& viewMatrix,
1005 int imageWidth, 1007 int imageWidth,
1006 int imageHeight, 1008 int imageHeight,
1007 const SkIRect& center, 1009 std::unique_ptr<SkLatticeIter> iter,
1008 const SkRect& dst) { 1010 const SkRect& dst) {
1009 ASSERT_SINGLE_OWNER 1011 ASSERT_SINGLE_OWNER
1010 RETURN_IF_ABANDONED 1012 RETURN_IF_ABANDONED
1011 SkDEBUGCODE(this->validate();) 1013 SkDEBUGCODE(this->validate();)
1012 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageNine"); 1014 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageLattice");
1013 1015
1014 AutoCheckFlush acf(fDrawingManager); 1016 AutoCheckFlush acf(fDrawingManager);
1015 1017
1016 SkAutoTUnref<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), v iewMatrix, 1018 SkAutoTUnref<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), v iewMatrix,
1017 imageWidth, imageHe ight, 1019 imageWidth, imageHe ight,
1018 center, dst)); 1020 std::move(iter), ds t));
1019 1021
1020 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); 1022 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
1021 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1023 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1022 } 1024 }
1023 1025
1024 void GrDrawContext::prepareForExternalIO() { 1026 void GrDrawContext::prepareForExternalIO() {
1025 ASSERT_SINGLE_OWNER 1027 ASSERT_SINGLE_OWNER
1026 RETURN_IF_ABANDONED 1028 RETURN_IF_ABANDONED
1027 SkDEBUGCODE(this->validate();) 1029 SkDEBUGCODE(this->validate();)
1028 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO" ); 1030 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO" );
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1311
1310 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1312 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1311 GrDrawBatch* batch) { 1313 GrDrawBatch* batch) {
1312 ASSERT_SINGLE_OWNER 1314 ASSERT_SINGLE_OWNER
1313 RETURN_IF_ABANDONED 1315 RETURN_IF_ABANDONED
1314 SkDEBUGCODE(this->validate();) 1316 SkDEBUGCODE(this->validate();)
1315 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1317 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1316 1318
1317 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1319 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1318 } 1320 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698