| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #include "GrRenderTarget.h" | 9 #include "GrRenderTarget.h" |
| 10 | 10 |
| 11 #include "GrContext.h" | 11 #include "GrContext.h" |
| 12 #include "GrContextPriv.h" | 12 #include "GrContextPriv.h" |
| 13 #include "GrDrawContext.h" | 13 #include "GrDrawContext.h" |
| 14 #include "GrDrawTarget.h" | 14 #include "GrDrawTarget.h" |
| 15 #include "GrGpu.h" | 15 #include "GrGpu.h" |
| 16 #include "GrRenderTargetPriv.h" | 16 #include "GrRenderTargetPriv.h" |
| 17 #include "GrStencilAttachment.h" | 17 #include "GrStencilAttachment.h" |
| 18 | 18 |
| 19 GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, Flags flag
s, |
| 20 GrStencilAttachment* stencil) |
| 21 : INHERITED(gpu, desc) |
| 22 , fStencilAttachment(stencil) |
| 23 , fMultisampleSpecsID(0) |
| 24 , fFlags(flags) |
| 25 , fLastDrawTarget(nullptr) { |
| 26 SkASSERT(!(fFlags & Flags::kMixedSampled) || fDesc.fSampleCnt > 0); |
| 27 SkASSERT(!(fFlags & Flags::kWindowRectsSupport) || gpu->caps()->maxWindowRec
tangles() > 0); |
| 28 fResolveRect.setLargestInverted(); |
| 29 } |
| 30 |
| 19 GrRenderTarget::~GrRenderTarget() { | 31 GrRenderTarget::~GrRenderTarget() { |
| 20 if (fLastDrawTarget) { | 32 if (fLastDrawTarget) { |
| 21 fLastDrawTarget->clearRT(); | 33 fLastDrawTarget->clearRT(); |
| 22 } | 34 } |
| 23 SkSafeUnref(fLastDrawTarget); | 35 SkSafeUnref(fLastDrawTarget); |
| 24 } | 36 } |
| 25 | 37 |
| 26 void GrRenderTarget::discard() { | 38 void GrRenderTarget::discard() { |
| 27 // go through context so that all necessary flushing occurs | 39 // go through context so that all necessary flushing occurs |
| 28 GrContext* context = this->getContext(); | 40 GrContext* context = this->getContext(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 120 } |
| 109 | 121 |
| 110 int GrRenderTargetPriv::numStencilBits() const { | 122 int GrRenderTargetPriv::numStencilBits() const { |
| 111 return fRenderTarget->fStencilAttachment ? fRenderTarget->fStencilAttachment
->bits() : 0; | 123 return fRenderTarget->fStencilAttachment ? fRenderTarget->fStencilAttachment
->bits() : 0; |
| 112 } | 124 } |
| 113 | 125 |
| 114 const GrGpu::MultisampleSpecs& | 126 const GrGpu::MultisampleSpecs& |
| 115 GrRenderTargetPriv::getMultisampleSpecs(const GrStencilSettings& stencil) const
{ | 127 GrRenderTargetPriv::getMultisampleSpecs(const GrStencilSettings& stencil) const
{ |
| 116 return fRenderTarget->getGpu()->getMultisampleSpecs(fRenderTarget, stencil); | 128 return fRenderTarget->getGpu()->getMultisampleSpecs(fRenderTarget, stencil); |
| 117 } | 129 } |
| 118 | |
| 119 GrRenderTarget::SampleConfig GrRenderTarget::ComputeSampleConfig(const GrCaps& c
aps, | |
| 120 int sampleCnt)
{ | |
| 121 return (caps.usesMixedSamples() && sampleCnt > 0) | |
| 122 ? GrRenderTarget::kStencil_SampleConfig | |
| 123 : GrRenderTarget::kUnified_SampleConfig; | |
| 124 } | |
| 125 | |
| OLD | NEW |