epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2010 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
joshualitt | c2893c5 | 2015-01-28 06:54:30 -0800 | [diff] [blame] | 9 | #include "GrDrawTarget.h" |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 10 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 11 | #include "GrAARectRenderer.h" |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 12 | #include "GrBatch.h" |
bsalomon | eb1cb5c | 2015-05-22 08:01:09 -0700 | [diff] [blame] | 13 | #include "GrCaps.h" |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 14 | #include "GrGpu.h" |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 15 | #include "GrPath.h" |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 16 | #include "GrPipeline.h" |
joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 17 | #include "GrMemoryPool.h" |
joshualitt | ad17cfc | 2015-05-05 10:45:57 -0700 | [diff] [blame] | 18 | #include "GrRectBatch.h" |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 19 | #include "GrRenderTarget.h" |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 20 | #include "GrResourceProvider.h" |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 21 | #include "GrRenderTargetPriv.h" |
bsalomon | afbf2d6 | 2014-09-30 12:18:44 -0700 | [diff] [blame] | 22 | #include "GrSurfacePriv.h" |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 23 | #include "GrTexture.h" |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 24 | #include "GrVertexBuffer.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 25 | |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 26 | #include "SkStrokeRec.h" |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 27 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 28 | //////////////////////////////////////////////////////////////////////////////// |
| 29 | |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 30 | GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) |
| 31 | : fGpu(SkRef(gpu)) |
| 32 | , fCaps(SkRef(gpu->caps())) |
| 33 | , fResourceProvider(resourceProvider) |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 34 | , fGpuTraceMarkerCount(0) |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 35 | , fFlushing(false) { |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | GrDrawTarget::~GrDrawTarget() { |
| 39 | fGpu->unref(); |
| 40 | fCaps->unref(); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | //////////////////////////////////////////////////////////////////////////////// |
| 44 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 45 | bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder, |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 46 | const GrProcOptInfo& colorPOI, |
| 47 | const GrProcOptInfo& coveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 48 | GrXferProcessor::DstTexture* dstTexture, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 49 | const SkRect* drawBounds) { |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 50 | if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coveragePOI)) { |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 51 | return true; |
| 52 | } |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 53 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 54 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 55 | |
| 56 | if (this->caps()->textureBarrierSupport()) { |
| 57 | if (GrTexture* rtTex = rt->asTexture()) { |
bsalomon | dc47ff7 | 2015-05-26 12:16:59 -0700 | [diff] [blame] | 58 | // The render target is a texture, so we can read from it directly in the shader. The XP |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 59 | // will be responsible to detect this situation and request a texture barrier. |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 60 | dstTexture->setTexture(rtTex); |
| 61 | dstTexture->setOffset(0, 0); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 62 | return true; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | SkIRect copyRect; |
joshualitt | 44701df | 2015-02-23 14:44:57 -0800 | [diff] [blame] | 67 | pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 68 | |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 69 | if (drawBounds) { |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 70 | SkIRect drawIBounds; |
| 71 | drawBounds->roundOut(&drawIBounds); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 72 | if (!copyRect.intersect(drawIBounds)) { |
commit-bot@chromium.org | 515dcd3 | 2013-08-28 14:17:03 +0000 | [diff] [blame] | 73 | #ifdef SK_DEBUG |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 74 | GrCapsDebugf(fCaps, "Missed an early reject. " |
| 75 | "Bailing on draw from setupDstReadIfNecessary.\n"); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 76 | #endif |
| 77 | return false; |
| 78 | } |
| 79 | } else { |
commit-bot@chromium.org | 515dcd3 | 2013-08-28 14:17:03 +0000 | [diff] [blame] | 80 | #ifdef SK_DEBUG |
tfarina | 38406c8 | 2014-10-31 07:11:12 -0700 | [diff] [blame] | 81 | //SkDebugf("No dev bounds when dst copy is made.\n"); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 82 | #endif |
| 83 | } |
skia.committer@gmail.com | 05a2ee0 | 2013-04-02 07:01:34 +0000 | [diff] [blame] | 84 | |
commit-bot@chromium.org | 63150af | 2013-04-11 22:00:22 +0000 | [diff] [blame] | 85 | // MSAA consideration: When there is support for reading MSAA samples in the shader we could |
| 86 | // have per-sample dst values by making the copy multisampled. |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 87 | GrSurfaceDesc desc; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 88 | if (!this->getGpu()->initCopySurfaceDstDesc(rt, &desc)) { |
| 89 | desc.fOrigin = kDefault_GrSurfaceOrigin; |
| 90 | desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 91 | desc.fConfig = rt->config(); |
| 92 | } |
| 93 | |
| 94 | |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 95 | desc.fWidth = copyRect.width(); |
| 96 | desc.fHeight = copyRect.height(); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 97 | |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame^] | 98 | static const uint32_t kFlags = 0; |
| 99 | SkAutoTUnref<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kFlags)); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 100 | |
bsalomon | e305973 | 2014-10-14 11:47:22 -0700 | [diff] [blame] | 101 | if (!copy) { |
tfarina | 38406c8 | 2014-10-31 07:11:12 -0700 | [diff] [blame] | 102 | SkDebugf("Failed to create temporary copy of destination texture.\n"); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 103 | return false; |
| 104 | } |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 105 | SkIPoint dstPoint = {0, 0}; |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 106 | this->copySurface(copy, rt, copyRect, dstPoint); |
| 107 | dstTexture->setTexture(copy); |
| 108 | dstTexture->setOffset(copyRect.fLeft, copyRect.fTop); |
| 109 | return true; |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 110 | } |
| 111 | |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 112 | void GrDrawTarget::flush() { |
| 113 | if (fFlushing) { |
| 114 | return; |
| 115 | } |
| 116 | fFlushing = true; |
| 117 | |
| 118 | this->getGpu()->saveActiveTraceMarkers(); |
| 119 | |
| 120 | this->onFlush(); |
| 121 | |
| 122 | this->getGpu()->restoreActiveTraceMarkers(); |
| 123 | |
| 124 | fFlushing = false; |
| 125 | this->reset(); |
| 126 | } |
| 127 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 128 | void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 129 | // TODO some kind of checkdraw, but not at this level |
| 130 | |
| 131 | // Setup clip |
| 132 | GrScissorState scissorState; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 133 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 134 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 135 | if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->bounds())) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 136 | return; |
| 137 | } |
| 138 | |
joshualitt | 99c7c07 | 2015-05-01 13:43:30 -0700 | [diff] [blame] | 139 | // Batch bounds are tight, so for dev copies |
| 140 | // TODO move this into setupDstReadIfNecessary when paths are in batch |
| 141 | SkRect bounds = batch->bounds(); |
| 142 | bounds.outset(0.5f, 0.5f); |
| 143 | |
| 144 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batch, &bounds, |
| 145 | this); |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 146 | if (pipelineInfo.mustSkipDraw()) { |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | this->onDrawBatch(batch, pipelineInfo); |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 151 | } |
| 152 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 153 | static const GrStencilSettings& winding_path_stencil_settings() { |
| 154 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 155 | kIncClamp_StencilOp, |
| 156 | kIncClamp_StencilOp, |
| 157 | kAlwaysIfInClip_StencilFunc, |
| 158 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 159 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 160 | } |
| 161 | |
| 162 | static const GrStencilSettings& even_odd_path_stencil_settings() { |
| 163 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 164 | kInvert_StencilOp, |
| 165 | kInvert_StencilOp, |
| 166 | kAlwaysIfInClip_StencilFunc, |
| 167 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 168 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 169 | } |
| 170 | |
| 171 | void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill, |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 172 | const GrStencilAttachment* sb, |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 173 | GrStencilSettings* outStencilSettings) { |
| 174 | |
| 175 | switch (fill) { |
| 176 | default: |
| 177 | SkFAIL("Unexpected path fill."); |
| 178 | case GrPathRendering::kWinding_FillType: |
| 179 | *outStencilSettings = winding_path_stencil_settings(); |
| 180 | break; |
| 181 | case GrPathRendering::kEvenOdd_FillType: |
| 182 | *outStencilSettings = even_odd_path_stencil_settings(); |
| 183 | break; |
| 184 | } |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 185 | this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 186 | } |
| 187 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 188 | void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 189 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 190 | const GrPath* path, |
| 191 | GrPathRendering::FillType fill) { |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 192 | // TODO: extract portions of checkDraw that are relevant to path stenciling. |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 193 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 194 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 195 | |
| 196 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 197 | GrScissorState scissorState; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 198 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 199 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 200 | if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 201 | return; |
| 202 | } |
| 203 | |
| 204 | // set stencil settings for path |
| 205 | GrStencilSettings stencilSettings; |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 206 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 207 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 208 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 209 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 210 | this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings); |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 211 | } |
| 212 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 213 | void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 214 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 215 | const GrPath* path, |
| 216 | GrPathRendering::FillType fill) { |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 217 | // TODO: extract portions of checkDraw that are relevant to path rendering. |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 218 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 219 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 220 | |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 221 | SkRect devBounds = path->getBounds(); |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 222 | pathProc->viewMatrix().mapRect(&devBounds); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 223 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 224 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 225 | GrScissorState scissorState; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 226 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 227 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 228 | if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &devBounds)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 229 | return; |
| 230 | } |
| 231 | |
| 232 | // set stencil settings for path |
| 233 | GrStencilSettings stencilSettings; |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 234 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 235 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 236 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 237 | |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 238 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, &devBounds, |
| 239 | this); |
| 240 | if (pipelineInfo.mustSkipDraw()) { |
| 241 | return; |
| 242 | } |
| 243 | |
| 244 | this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 245 | } |
| 246 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 247 | void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 248 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 249 | const GrPathRange* pathRange, |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 250 | const void* indices, |
| 251 | PathIndexType indexType, |
| 252 | const float transformValues[], |
| 253 | PathTransformType transformType, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 254 | int count, |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 255 | GrPathRendering::FillType fill) { |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 256 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 257 | SkASSERT(pathRange); |
| 258 | SkASSERT(indices); |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 259 | SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType)); |
| 260 | SkASSERT(transformValues); |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 261 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 262 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 263 | GrScissorState scissorState; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 264 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 265 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 266 | if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 267 | return; |
| 268 | } |
| 269 | |
| 270 | // set stencil settings for path |
| 271 | GrStencilSettings stencilSettings; |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 272 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 273 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 274 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 275 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 276 | // Don't compute a bounding box for dst copy texture, we'll opt |
cdalton | b85a0aa | 2014-07-21 15:32:44 -0700 | [diff] [blame] | 277 | // instead for it to just copy the entire dst. Realistically this is a moot |
| 278 | // point, because any context that supports NV_path_rendering will also |
| 279 | // support NV_blend_equation_advanced. |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 280 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, NULL, this); |
| 281 | if (pipelineInfo.mustSkipDraw()) { |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
| 286 | transformType, count, stencilSettings, pipelineInfo); |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 287 | } |
| 288 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 289 | void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, |
| 290 | GrColor color, |
| 291 | const SkMatrix& viewMatrix, |
| 292 | const SkRect& rect, |
| 293 | const SkRect* localRect, |
| 294 | const SkMatrix* localMatrix) { |
joshualitt | ad17cfc | 2015-05-05 10:45:57 -0700 | [diff] [blame] | 295 | SkAutoTUnref<GrBatch> batch(GrRectBatch::Create(color, viewMatrix, rect, localRect, |
| 296 | localMatrix)); |
| 297 | this->drawBatch(pipelineBuilder, batch); |
| 298 | } |
| 299 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 300 | void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 301 | GrColor color, |
| 302 | const SkMatrix& viewMatrix, |
| 303 | const SkRect& rect, |
| 304 | const SkRect& devRect) { |
| 305 | GrAARectRenderer::FillAARect(this, pipelineBuilder, color, viewMatrix, rect, devRect); |
| 306 | } |
| 307 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 308 | void GrDrawTarget::clear(const SkIRect* rect, |
| 309 | GrColor color, |
| 310 | bool canIgnoreRect, |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 311 | GrRenderTarget* renderTarget) { |
| 312 | if (fCaps->useDrawInsteadOfClear()) { |
| 313 | // This works around a driver bug with clear by drawing a rect instead. |
| 314 | // The driver will ignore a clear if it is the only thing rendered to a |
| 315 | // target before the target is read. |
| 316 | SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height()); |
| 317 | if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) { |
| 318 | rect = &rtRect; |
| 319 | // We first issue a discard() since that may help tilers. |
| 320 | this->discard(renderTarget); |
| 321 | } |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 322 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 323 | GrPipelineBuilder pipelineBuilder; |
| 324 | pipelineBuilder.setRenderTarget(renderTarget); |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 325 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 326 | this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect); |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 327 | } else { |
| 328 | this->onClear(rect, color, canIgnoreRect, renderTarget); |
| 329 | } |
| 330 | } |
| 331 | |
egdaniel | 3eee383 | 2014-06-18 13:09:11 -0700 | [diff] [blame] | 332 | typedef GrTraceMarkerSet::Iter TMIter; |
| 333 | void GrDrawTarget::saveActiveTraceMarkers() { |
| 334 | if (this->caps()->gpuTracingSupport()) { |
| 335 | SkASSERT(0 == fStoredTraceMarkers.count()); |
| 336 | fStoredTraceMarkers.addSet(fActiveTraceMarkers); |
| 337 | for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { |
| 338 | this->removeGpuTraceMarker(&(*iter)); |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | void GrDrawTarget::restoreActiveTraceMarkers() { |
| 344 | if (this->caps()->gpuTracingSupport()) { |
| 345 | SkASSERT(0 == fActiveTraceMarkers.count()); |
| 346 | for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { |
| 347 | this->addGpuTraceMarker(&(*iter)); |
| 348 | } |
| 349 | for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMarkers.end(); ++iter) { |
| 350 | this->fStoredTraceMarkers.remove(*iter); |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | void GrDrawTarget::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 356 | if (this->caps()->gpuTracingSupport()) { |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 357 | SkASSERT(fGpuTraceMarkerCount >= 0); |
| 358 | this->fActiveTraceMarkers.add(*marker); |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 359 | ++fGpuTraceMarkerCount; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 360 | } |
| 361 | } |
| 362 | |
egdaniel | 3eee383 | 2014-06-18 13:09:11 -0700 | [diff] [blame] | 363 | void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 364 | if (this->caps()->gpuTracingSupport()) { |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 365 | SkASSERT(fGpuTraceMarkerCount >= 1); |
| 366 | this->fActiveTraceMarkers.remove(*marker); |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 367 | --fGpuTraceMarkerCount; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 368 | } |
| 369 | } |
| 370 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 371 | //////////////////////////////////////////////////////////////////////////////// |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 372 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 373 | namespace { |
| 374 | // returns true if the read/written rect intersects the src/dst and false if not. |
| 375 | bool clip_srcrect_and_dstpoint(const GrSurface* dst, |
| 376 | const GrSurface* src, |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 377 | const SkIRect& srcRect, |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 378 | const SkIPoint& dstPoint, |
| 379 | SkIRect* clippedSrcRect, |
| 380 | SkIPoint* clippedDstPoint) { |
| 381 | *clippedSrcRect = srcRect; |
| 382 | *clippedDstPoint = dstPoint; |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 383 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 384 | // clip the left edge to src and dst bounds, adjusting dstPoint if necessary |
| 385 | if (clippedSrcRect->fLeft < 0) { |
| 386 | clippedDstPoint->fX -= clippedSrcRect->fLeft; |
| 387 | clippedSrcRect->fLeft = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 388 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 389 | if (clippedDstPoint->fX < 0) { |
| 390 | clippedSrcRect->fLeft -= clippedDstPoint->fX; |
| 391 | clippedDstPoint->fX = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 392 | } |
| 393 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 394 | // clip the top edge to src and dst bounds, adjusting dstPoint if necessary |
| 395 | if (clippedSrcRect->fTop < 0) { |
| 396 | clippedDstPoint->fY -= clippedSrcRect->fTop; |
| 397 | clippedSrcRect->fTop = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 398 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 399 | if (clippedDstPoint->fY < 0) { |
| 400 | clippedSrcRect->fTop -= clippedDstPoint->fY; |
| 401 | clippedDstPoint->fY = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 402 | } |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 403 | |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 404 | // clip the right edge to the src and dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 405 | if (clippedSrcRect->fRight > src->width()) { |
| 406 | clippedSrcRect->fRight = src->width(); |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 407 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 408 | if (clippedDstPoint->fX + clippedSrcRect->width() > dst->width()) { |
| 409 | clippedSrcRect->fRight = clippedSrcRect->fLeft + dst->width() - clippedDstPoint->fX; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | // clip the bottom edge to the src and dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 413 | if (clippedSrcRect->fBottom > src->height()) { |
| 414 | clippedSrcRect->fBottom = src->height(); |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 415 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 416 | if (clippedDstPoint->fY + clippedSrcRect->height() > dst->height()) { |
| 417 | clippedSrcRect->fBottom = clippedSrcRect->fTop + dst->height() - clippedDstPoint->fY; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 418 | } |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 419 | |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 420 | // The above clipping steps may have inverted the rect if it didn't intersect either the src or |
| 421 | // dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 422 | return !clippedSrcRect->isEmpty(); |
| 423 | } |
| 424 | } |
| 425 | |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 426 | void GrDrawTarget::copySurface(GrSurface* dst, |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 427 | GrSurface* src, |
| 428 | const SkIRect& srcRect, |
| 429 | const SkIPoint& dstPoint) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 430 | SkASSERT(dst); |
| 431 | SkASSERT(src); |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 432 | |
| 433 | SkIRect clippedSrcRect; |
| 434 | SkIPoint clippedDstPoint; |
| 435 | // If the rect is outside the src or dst then we've already succeeded. |
| 436 | if (!clip_srcrect_and_dstpoint(dst, |
| 437 | src, |
| 438 | srcRect, |
| 439 | dstPoint, |
| 440 | &clippedSrcRect, |
| 441 | &clippedDstPoint)) { |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 442 | return; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 443 | } |
| 444 | |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 445 | this->onCopySurface(dst, src, clippedSrcRect, clippedDstPoint); |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 446 | } |
| 447 | |
bsalomon | 85cd78d | 2015-07-31 12:15:50 -0700 | [diff] [blame] | 448 | const GrPipeline* GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo, |
| 449 | void* pipelineAddr) { |
| 450 | return SkNEW_PLACEMENT_ARGS(pipelineAddr, GrPipeline, (*pipelineInfo.fPipelineBuilder, |
| 451 | pipelineInfo.fColorPOI, |
| 452 | pipelineInfo.fCoveragePOI, |
| 453 | *this->caps(), |
| 454 | *pipelineInfo.fScissor, |
| 455 | &pipelineInfo.fDstTexture)); |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 456 | } |
| 457 | /////////////////////////////////////////////////////////////////////////////// |
| 458 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 459 | GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder, |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 460 | GrScissorState* scissor, |
| 461 | const GrPrimitiveProcessor* primProc, |
| 462 | const SkRect* devBounds, |
| 463 | GrDrawTarget* target) |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 464 | : fPipelineBuilder(&pipelineBuilder) |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 465 | , fScissor(scissor) { |
| 466 | fColorPOI = fPipelineBuilder->colorProcInfo(primProc); |
| 467 | fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc); |
| 468 | if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 469 | &fDstTexture, devBounds)) { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 470 | fPipelineBuilder = NULL; |
| 471 | } |
| 472 | } |
| 473 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 474 | GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder, |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 475 | GrScissorState* scissor, |
| 476 | const GrBatch* batch, |
| 477 | const SkRect* devBounds, |
| 478 | GrDrawTarget* target) |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 479 | : fPipelineBuilder(&pipelineBuilder) |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 480 | , fScissor(scissor) { |
| 481 | fColorPOI = fPipelineBuilder->colorProcInfo(batch); |
| 482 | fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch); |
| 483 | if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 484 | &fDstTexture, devBounds)) { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 485 | fPipelineBuilder = NULL; |
| 486 | } |
| 487 | } |
| 488 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 489 | /////////////////////////////////////////////////////////////////////////////// |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 490 | GrClipTarget::GrClipTarget(GrContext* context) |
| 491 | : INHERITED(context->getGpu(), context->resourceProvider()) |
| 492 | , fContext(context) { |
bsalomon | edd77a1 | 2015-05-29 09:45:57 -0700 | [diff] [blame] | 493 | fClipMaskManager.reset(SkNEW_ARGS(GrClipMaskManager, (this))); |
| 494 | } |
| 495 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 496 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 497 | bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 498 | GrPipelineBuilder::AutoRestoreFragmentProcessorState* arfps, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 499 | GrPipelineBuilder::AutoRestoreStencil* ars, |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 500 | GrScissorState* scissorState, |
| 501 | const SkRect* devBounds) { |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 502 | return fClipMaskManager->setupClipping(pipelineBuilder, |
joshualitt | 4421a4c | 2015-07-13 09:36:41 -0700 | [diff] [blame] | 503 | arfps, |
joshualitt | 5e6ba21 | 2015-07-13 07:35:05 -0700 | [diff] [blame] | 504 | ars, |
joshualitt | 5e6ba21 | 2015-07-13 07:35:05 -0700 | [diff] [blame] | 505 | scissorState, |
| 506 | devBounds); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 507 | } |
bsalomon | edd77a1 | 2015-05-29 09:45:57 -0700 | [diff] [blame] | 508 | |
| 509 | void GrClipTarget::purgeResources() { |
| 510 | // The clip mask manager can rebuild all its clip masks so just |
| 511 | // get rid of them all. |
| 512 | fClipMaskManager->purgeResources(); |
| 513 | }; |