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

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

Issue 2267273006: GPU implementation of drawRegion() (Closed) Base URL: https://skia.googlesource.com/skia.git@drawregion
Patch Set: Keep fixing stuff Created 4 years, 3 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"
11 #include "GrDrawContextPriv.h" 11 #include "GrDrawContextPriv.h"
12 #include "GrDrawingManager.h" 12 #include "GrDrawingManager.h"
13 #include "GrFixedClip.h" 13 #include "GrFixedClip.h"
14 #include "GrGpuResourcePriv.h" 14 #include "GrGpuResourcePriv.h"
15 #include "GrOvalRenderer.h" 15 #include "GrOvalRenderer.h"
16 #include "GrPathRenderer.h" 16 #include "GrPathRenderer.h"
17 #include "GrPipelineBuilder.h" 17 #include "GrPipelineBuilder.h"
18 #include "GrRenderTarget.h" 18 #include "GrRenderTarget.h"
19 #include "GrRenderTargetPriv.h" 19 #include "GrRenderTargetPriv.h"
20 #include "GrResourceProvider.h" 20 #include "GrResourceProvider.h"
21 #include "SkSurfacePriv.h" 21 #include "SkSurfacePriv.h"
22 22
23 #include "batches/GrBatch.h" 23 #include "batches/GrBatch.h"
24 #include "batches/GrClearBatch.h" 24 #include "batches/GrClearBatch.h"
25 #include "batches/GrDrawAtlasBatch.h" 25 #include "batches/GrDrawAtlasBatch.h"
26 #include "batches/GrDrawVerticesBatch.h" 26 #include "batches/GrDrawVerticesBatch.h"
27 #include "batches/GrRectBatchFactory.h" 27 #include "batches/GrRectBatchFactory.h"
28 #include "batches/GrNinePatch.h" // TODO Factory 28 #include "batches/GrNinePatch.h" // TODO Factory
29 #include "batches/GrRegionBatch.h"
29 30
30 #include "effects/GrRRectEffect.h" 31 #include "effects/GrRRectEffect.h"
31 32
32 #include "instanced/InstancedRendering.h" 33 #include "instanced/InstancedRendering.h"
33 34
34 #include "text/GrAtlasTextContext.h" 35 #include "text/GrAtlasTextContext.h"
35 #include "text/GrStencilAndCoverTextContext.h" 36 #include "text/GrStencilAndCoverTextContext.h"
36 37
37 #include "../private/GrAuditTrail.h" 38 #include "../private/GrAuditTrail.h"
38 39
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 path.setIsVolatile(true); 938 path.setIsVolatile(true);
938 path.addRRect(inner); 939 path.addRRect(inner);
939 path.addRRect(outer); 940 path.addRRect(outer);
940 path.setFillType(SkPath::kEvenOdd_FillType); 941 path.setFillType(SkPath::kEvenOdd_FillType);
941 942
942 this->internalDrawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill()) ; 943 this->internalDrawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill()) ;
943 } 944 }
944 945
945 /////////////////////////////////////////////////////////////////////////////// 946 ///////////////////////////////////////////////////////////////////////////////
946 947
948 void GrDrawContext::drawRegion(const GrClip& clip,
949 const GrPaint& paint,
950 const SkMatrix& viewMatrix,
951 const SkRegion& region) {
952 ASSERT_SINGLE_OWNER
953 RETURN_IF_ABANDONED
954 SkDEBUGCODE(this->validate();)
955 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRegion");
956
957 SkAutoTUnref<GrDrawBatch> batch(GrRegionBatch::Create(paint.getColor(), view Matrix, region));
msarett 2016/08/25 16:36:17 Probably not ok to assume that we can always just
bsalomon 2016/08/25 17:49:02 It's ok.. if there is a shader or what not, that w
msarett 2016/08/25 20:51:41 Acknowledged.
958 GrPipelineBuilder pipelineBuilder(paint, false);
959 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
960 }
961
947 void GrDrawContext::drawOval(const GrClip& clip, 962 void GrDrawContext::drawOval(const GrClip& clip,
948 const GrPaint& paint, 963 const GrPaint& paint,
949 const SkMatrix& viewMatrix, 964 const SkMatrix& viewMatrix,
950 const SkRect& oval, 965 const SkRect& oval,
951 const GrStyle& style) { 966 const GrStyle& style) {
952 ASSERT_SINGLE_OWNER 967 ASSERT_SINGLE_OWNER
953 RETURN_IF_ABANDONED 968 RETURN_IF_ABANDONED
954 SkDEBUGCODE(this->validate();) 969 SkDEBUGCODE(this->validate();)
955 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawOval"); 970 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawOval");
956 971
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 1360
1346 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1361 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1347 GrDrawBatch* batch) { 1362 GrDrawBatch* batch) {
1348 ASSERT_SINGLE_OWNER 1363 ASSERT_SINGLE_OWNER
1349 RETURN_IF_ABANDONED 1364 RETURN_IF_ABANDONED
1350 SkDEBUGCODE(this->validate();) 1365 SkDEBUGCODE(this->validate();)
1351 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1366 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1352 1367
1353 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1368 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1354 } 1369 }
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/SkGpuDevice.h » ('j') | src/gpu/SkGpuDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698