OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |