OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "GrDrawTarget.h" | 8 #include "GrDrawTarget.h" |
9 | 9 |
10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 arfps.set(&pipelineBuilder); | 248 arfps.set(&pipelineBuilder); |
249 arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProce
ssor()); | 249 arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProce
ssor()); |
250 } | 250 } |
251 | 251 |
252 GrPipeline::CreateArgs args; | 252 GrPipeline::CreateArgs args; |
253 args.fPipelineBuilder = &pipelineBuilder; | 253 args.fPipelineBuilder = &pipelineBuilder; |
254 args.fCaps = this->caps(); | 254 args.fCaps = this->caps(); |
255 args.fScissor = &appliedClip.scissorState(); | 255 args.fScissor = &appliedClip.scissorState(); |
256 args.fHasStencilClip = appliedClip.hasStencilClip(); | 256 args.fHasStencilClip = appliedClip.hasStencilClip(); |
257 if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()
) { | 257 if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()
) { |
258 fResourceProvider->attachStencilAttachment(pipelineBuilder.getRenderTarg
et()); | 258 if (!fResourceProvider->attachStencilAttachment(pipelineBuilder.getRende
rTarget())) { |
| 259 SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); |
| 260 return; |
| 261 } |
259 } | 262 } |
260 batch->getPipelineOptimizations(&args.fOpts); | 263 batch->getPipelineOptimizations(&args.fOpts); |
261 GrScissorState finalScissor; | 264 GrScissorState finalScissor; |
262 if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) { | 265 if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) { |
263 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 266 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
264 GrGLIRect viewport; | 267 GrGLIRect viewport; |
265 viewport.fLeft = 0; | 268 viewport.fLeft = 0; |
266 viewport.fBottom = 0; | 269 viewport.fBottom = 0; |
267 viewport.fWidth = rt->width(); | 270 viewport.fWidth = rt->width(); |
268 viewport.fHeight = rt->height(); | 271 viewport.fHeight = rt->height(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // TODO: respect fClipBatchToBounds if we ever start computing bounds here. | 326 // TODO: respect fClipBatchToBounds if we ever start computing bounds here. |
324 | 327 |
325 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 328 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
326 if (appliedClip.clipCoverageFragmentProcessor()) { | 329 if (appliedClip.clipCoverageFragmentProcessor()) { |
327 arfps.set(&pipelineBuilder); | 330 arfps.set(&pipelineBuilder); |
328 arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProce
ssor()); | 331 arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProce
ssor()); |
329 } | 332 } |
330 | 333 |
331 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 334 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
332 GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAtt
achment(rt); | 335 GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAtt
achment(rt); |
| 336 if (!stencilAttachment) { |
| 337 SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); |
| 338 return; |
| 339 } |
333 | 340 |
334 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix, | 341 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix, |
335 pipelineBuilder.isHWAntialias(), | 342 pipelineBuilder.isHWAntialias(), |
336 fill, | 343 fill, |
337 appliedClip.hasStencilClip(), | 344 appliedClip.hasStencilClip(), |
338 stencilAttachment->bits(), | 345 stencilAttachment->bits(), |
339 appliedClip.scissorState(), | 346 appliedClip.scissorState(), |
340 pipelineBuilder.getRenderTarget(
), | 347 pipelineBuilder.getRenderTarget(
), |
341 path); | 348 path); |
342 this->recordBatch(batch); | 349 this->recordBatch(batch); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } | 523 } |
517 } | 524 } |
518 | 525 |
519 /////////////////////////////////////////////////////////////////////////////// | 526 /////////////////////////////////////////////////////////////////////////////// |
520 | 527 |
521 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 528 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
522 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 529 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
523 this->recordBatch(batch); | 530 this->recordBatch(batch); |
524 batch->unref(); | 531 batch->unref(); |
525 } | 532 } |
OLD | NEW |