| OLD | NEW |
| 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 | 9 |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| 11 | 11 |
| 12 #include "GrBufferAllocPool.h" | 12 #include "GrBufferAllocPool.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrDrawTargetCaps.h" | 14 #include "GrDrawTargetCaps.h" |
| 15 #include "GrIndexBuffer.h" | 15 #include "GrIndexBuffer.h" |
| 16 #include "GrResourceCache2.h" | 16 #include "GrResourceCache.h" |
| 17 #include "GrStencilBuffer.h" | 17 #include "GrStencilBuffer.h" |
| 18 #include "GrVertexBuffer.h" | 18 #include "GrVertexBuffer.h" |
| 19 | 19 |
| 20 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
| 21 | 21 |
| 22 GrGpu::GrGpu(GrContext* context) | 22 GrGpu::GrGpu(GrContext* context) |
| 23 : fResetTimestamp(kExpiredTimestamp+1) | 23 : fResetTimestamp(kExpiredTimestamp+1) |
| 24 , fResetBits(kAll_GrBackendState) | 24 , fResetBits(kAll_GrBackendState) |
| 25 , fQuadIndexBuffer(NULL) | 25 , fQuadIndexBuffer(NULL) |
| 26 , fContext(context) { | 26 , fContext(context) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 return tex; | 83 return tex; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt, bool budgeted)
{ | 86 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt, bool budgeted)
{ |
| 87 SkASSERT(NULL == rt->getStencilBuffer()); | 87 SkASSERT(NULL == rt->getStencilBuffer()); |
| 88 GrScratchKey sbKey; | 88 GrScratchKey sbKey; |
| 89 GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples(), &sb
Key); | 89 GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples(), &sb
Key); |
| 90 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( | 90 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( |
| 91 this->getContext()->getResourceCache2()->findAndRefScratchResource(sbKey
))); | 91 this->getContext()->getResourceCache()->findAndRefScratchResource(sbKey)
)); |
| 92 if (sb) { | 92 if (sb) { |
| 93 rt->setStencilBuffer(sb); | 93 rt->setStencilBuffer(sb); |
| 94 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 94 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
| 95 if (!attached) { | 95 if (!attached) { |
| 96 rt->setStencilBuffer(NULL); | 96 rt->setStencilBuffer(NULL); |
| 97 } | 97 } |
| 98 return attached; | 98 return attached; |
| 99 } | 99 } |
| 100 if (this->createStencilBufferForRenderTarget(rt, budgeted, rt->width(), rt->
height())) { | 100 if (this->createStencilBufferForRenderTarget(rt, budgeted, rt->width(), rt->
height())) { |
| 101 // Right now we're clearing the stencil buffer here after it is | 101 // Right now we're clearing the stencil buffer here after it is |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 GrDrawTarget::PathIndexType indexType, | 312 GrDrawTarget::PathIndexType indexType, |
| 313 const float transformValues[], | 313 const float transformValues[], |
| 314 GrDrawTarget::PathTransformType transformType, | 314 GrDrawTarget::PathTransformType transformType, |
| 315 int count, | 315 int count, |
| 316 const GrStencilSettings& stencilSettings) { | 316 const GrStencilSettings& stencilSettings) { |
| 317 this->handleDirtyContext(); | 317 this->handleDirtyContext(); |
| 318 pathRange->willDrawPaths(indices, indexType, count); | 318 pathRange->willDrawPaths(indices, indexType, count); |
| 319 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, | 319 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, |
| 320 transformType, count, stencilSettings); | 320 transformType, count, stencilSettings); |
| 321 } | 321 } |
| OLD | NEW |