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

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

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: a bit more tweaking Created 5 years, 11 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 2010 Google Inc. 3 * Copyright 2010 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 "GrDrawTarget.h"
9 10
10 11 #include "GrBatch.h"
11 #include "GrDrawTarget.h"
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawTargetCaps.h" 13 #include "GrDrawTargetCaps.h"
14 #include "GrPath.h" 14 #include "GrPath.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrSurfacePriv.h" 16 #include "GrSurfacePriv.h"
17 #include "GrTemplates.h" 17 #include "GrTemplates.h"
18 #include "GrTexture.h" 18 #include "GrTexture.h"
19 #include "GrVertexBuffer.h" 19 #include "GrVertexBuffer.h"
20 20
21 #include "SkStrokeRec.h" 21 #include "SkStrokeRec.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) { 515 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) {
516 return; 516 return;
517 } 517 }
518 518
519 this->setDrawBuffers(&info, gp->getVertexStride()); 519 this->setDrawBuffers(&info, gp->getVertexStride());
520 520
521 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); 521 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
522 } 522 }
523 } 523 }
524 524
525
526 void GrDrawTarget::batchDraw(GrDrawState* ds,
527 GrBatch* batch,
528 GrPrimitiveType type,
529 const SkRect* devBounds) {
530 SkASSERT(ds);
531 // TODO some kind of checkdraw, but not at this level
532
533 // Setup clip
534 GrScissorState scissorState;
535 GrDrawState::AutoRestoreEffects are;
536 GrDrawState::AutoRestoreStencil ars;
537 if (!this->setupClip(ds, &are, &ars, &scissorState, devBounds)) {
538 return;
539 }
540
541 GrDeviceCoordTexture dstCopy;
542 if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) {
543 return;
544 }
545
546 this->onBatchDraw(batch, *ds, type, scissorState, dstCopy.texture() ? &dstCo py : NULL);
547 }
548
525 static const GrStencilSettings& winding_path_stencil_settings() { 549 static const GrStencilSettings& winding_path_stencil_settings() {
526 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, 550 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
527 kIncClamp_StencilOp, 551 kIncClamp_StencilOp,
528 kIncClamp_StencilOp, 552 kIncClamp_StencilOp,
529 kAlwaysIfInClip_StencilFunc, 553 kAlwaysIfInClip_StencilFunc,
530 0xFFFF, 0xFFFF, 0xFFFF); 554 0xFFFF, 0xFFFF, 0xFFFF);
531 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); 555 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
532 } 556 }
533 557
534 static const GrStencilSettings& even_odd_path_stencil_settings() { 558 static const GrStencilSettings& even_odd_path_stencil_settings() {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 GrDrawState::AutoRestoreStencil* ars, 1239 GrDrawState::AutoRestoreStencil* ars,
1216 GrScissorState* scissorState, 1240 GrScissorState* scissorState,
1217 const SkRect* devBounds) { 1241 const SkRect* devBounds) {
1218 return fClipMaskManager.setupClipping(ds, 1242 return fClipMaskManager.setupClipping(ds,
1219 are, 1243 are,
1220 ars, 1244 ars,
1221 scissorState, 1245 scissorState,
1222 this->getClip(), 1246 this->getClip(),
1223 devBounds); 1247 devBounds);
1224 } 1248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698