LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrRenderTargetProxy.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2016 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #include "GrRenderTargetProxy.h"
       9             : 
      10             : #include "GrCaps.h"
      11             : #include "GrGpuResourcePriv.h"
      12             : #include "GrRenderTargetOpList.h"
      13             : #include "GrRenderTargetPriv.h"
      14             : #include "GrResourceProvider.h"
      15             : #include "GrTextureRenderTargetProxy.h"
      16             : 
      17             : // Deferred version
      18             : // TODO: we can probably munge the 'desc' in both the wrapped and deferred
      19             : // cases to make the sampleConfig/numSamples stuff more rational.
      20           0 : GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc& desc,
      21           0 :                                          SkBackingFit fit, SkBudgeted budgeted, uint32_t flags)
      22             :     : INHERITED(desc, fit, budgeted, flags)
      23           0 :     , fRenderTargetFlags(GrRenderTarget::Flags::kNone) {
      24             :     // Since we know the newly created render target will be internal, we are able to precompute
      25             :     // what the flags will ultimately end up being.
      26           0 :     if (caps.usesMixedSamples() && fDesc.fSampleCnt > 0) {
      27           0 :         fRenderTargetFlags |= GrRenderTarget::Flags::kMixedSampled;
      28             :     }
      29           0 :     if (caps.maxWindowRectangles() > 0) {
      30           0 :         fRenderTargetFlags |= GrRenderTarget::Flags::kWindowRectsSupport;
      31             :     }
      32           0 : }
      33             : 
      34             : // Wrapped version
      35           0 : GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf)
      36           0 :     : INHERITED(std::move(surf), SkBackingFit::kExact)
      37           0 :     , fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
      38           0 : }
      39             : 
      40           0 : int GrRenderTargetProxy::maxWindowRectangles(const GrCaps& caps) const {
      41           0 :     return (fRenderTargetFlags & GrRenderTarget::Flags::kWindowRectsSupport)
      42           0 :                    ? caps.maxWindowRectangles()
      43           0 :                    : 0;
      44             : }
      45             : 
      46           0 : GrRenderTarget* GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {
      47           0 :     SkASSERT(fDesc.fFlags & GrSurfaceFlags::kRenderTarget_GrSurfaceFlag);
      48             : 
      49           0 :     GrSurface* surf = INHERITED::instantiate(resourceProvider);
      50           0 :     if (!surf || !surf->asRenderTarget()) {
      51           0 :         return nullptr;
      52             :     }
      53             : 
      54             :     // Check that our a priori computation matched the ultimate reality
      55           0 :     SkASSERT(fRenderTargetFlags == surf->asRenderTarget()->renderTargetPriv().flags());
      56             : 
      57           0 :     return surf->asRenderTarget();
      58             : }
      59             : 
      60           0 : size_t GrRenderTargetProxy::onGpuMemorySize() const {
      61           0 :     if (fTarget) {
      62           0 :         return fTarget->gpuMemorySize();
      63             :     }
      64             : 
      65             :     // TODO: do we have enough information to improve this worst case estimate?
      66           0 :     return GrSurface::ComputeSize(fDesc, fDesc.fSampleCnt+1, false, SkBackingFit::kApprox == fFit);
      67             : }
      68             : 
      69           0 : bool GrRenderTargetProxy::refsWrappedObjects() const {
      70           0 :     if (!fTarget) {
      71           0 :         return false;
      72             :     }
      73             : 
      74           0 :     return fTarget->resourcePriv().refsWrappedObjects();
      75             : }

Generated by: LCOV version 1.13