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

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

Issue 1275543005: Move some work from backend onClear to base class clear (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass references and rebase 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
« no previous file with comments | « src/gpu/GrCommandBuilder.h ('k') | src/gpu/GrDrawTarget.h » ('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 * 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 "GrCommandBuilder.h" 8 #include "GrCommandBuilder.h"
9 9
10 #include "GrInOrderCommandBuilder.h" 10 #include "GrInOrderCommandBuilder.h"
11 #include "GrReorderCommandBuilder.h" 11 #include "GrReorderCommandBuilder.h"
12 12
13 GrCommandBuilder* GrCommandBuilder::Create(GrGpu* gpu, bool reorder) { 13 GrCommandBuilder* GrCommandBuilder::Create(GrGpu* gpu, bool reorder) {
14 if (reorder) { 14 if (reorder) {
15 return SkNEW_ARGS(GrReorderCommandBuilder, (gpu)); 15 return SkNEW_ARGS(GrReorderCommandBuilder, (gpu));
16 } else { 16 } else {
17 return SkNEW_ARGS(GrInOrderCommandBuilder, (gpu)); 17 return SkNEW_ARGS(GrInOrderCommandBuilder, (gpu));
18 } 18 }
19 } 19 }
20 20
21 GrTargetCommands::Cmd* GrCommandBuilder::recordClear(const SkIRect* rect, 21 GrTargetCommands::Cmd* GrCommandBuilder::recordClear(const SkIRect& rect,
22 GrColor color, 22 GrColor color,
23 bool canIgnoreRect,
24 GrRenderTarget* renderTarge t) { 23 GrRenderTarget* renderTarge t) {
25 SkASSERT(renderTarget); 24 SkASSERT(renderTarget);
26 25 SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom);
27 SkIRect r;
28 if (NULL == rect) {
29 // We could do something smart and remove previous draws and clears to
30 // the current render target. If we get that smart we have to make sure
31 // those draws aren't read before this clear (render-to-texture).
32 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height());
33 rect = &r;
34 }
35
36 SkASSERT(canIgnoreRect || (rect->fLeft <= rect->fRight && rect->fTop <= rect ->fBottom));
37 26
38 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg et)); 27 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg et));
39 GrColorIsPMAssert(color); 28 GrColorIsPMAssert(color);
40 clr->fColor = color; 29 clr->fColor = color;
41 clr->fRect = *rect; 30 clr->fRect = rect;
42 clr->fCanIgnoreRect = canIgnoreRect;
43 return clr; 31 return clr;
44 } 32 }
45 33
46 GrTargetCommands::Cmd* GrCommandBuilder::recordClearStencilClip(const SkIRect& r ect, 34 GrTargetCommands::Cmd* GrCommandBuilder::recordClearStencilClip(const SkIRect& r ect,
47 bool insideClip, 35 bool insideClip,
48 GrRenderTarget* renderTarget) { 36 GrRenderTarget* renderTarget) {
49 SkASSERT(renderTarget); 37 SkASSERT(renderTarget);
50 38
51 ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), 39 ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(),
52 ClearStencilClip, 40 ClearStencilClip,
(...skipping 29 matching lines...) Expand all
82 70
83 GrXferBarrierType barrierType; 71 GrXferBarrierType barrierType;
84 if (!xp.willNeedXferBarrier(rt, caps, &barrierType)) { 72 if (!xp.willNeedXferBarrier(rt, caps, &barrierType)) {
85 return NULL; 73 return NULL;
86 } 74 }
87 75
88 XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier, (rt)); 76 XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier, (rt));
89 xb->fBarrierType = barrierType; 77 xb->fBarrierType = barrierType;
90 return xb; 78 return xb;
91 } 79 }
OLDNEW
« no previous file with comments | « src/gpu/GrCommandBuilder.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698