LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrTextureContext.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 43 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 "GrTextureContext.h"
       9             : 
      10             : #include "GrContextPriv.h"
      11             : #include "GrDrawingManager.h"
      12             : #include "GrResourceProvider.h"
      13             : #include "GrTextureOpList.h"
      14             : 
      15             : #include "../private/GrAuditTrail.h"
      16             : 
      17             : #define ASSERT_SINGLE_OWNER \
      18             :     SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
      19             : #define RETURN_FALSE_IF_ABANDONED  if (this->drawingManager()->wasAbandoned()) { return false; }
      20             : 
      21           0 : GrTextureContext::GrTextureContext(GrContext* context,
      22             :                                    GrDrawingManager* drawingMgr,
      23             :                                    sk_sp<GrTextureProxy> textureProxy,
      24             :                                    sk_sp<SkColorSpace> colorSpace,
      25             :                                    GrAuditTrail* auditTrail,
      26           0 :                                    GrSingleOwner* singleOwner)
      27           0 :     : GrSurfaceContext(context, drawingMgr, std::move(colorSpace), auditTrail, singleOwner)
      28           0 :     , fTextureProxy(std::move(textureProxy))
      29           0 :     , fOpList(SkSafeRef(fTextureProxy->getLastTextureOpList())) {
      30           0 :     SkDEBUGCODE(this->validate();)
      31           0 : }
      32             : 
      33             : #ifdef SK_DEBUG
      34           0 : void GrTextureContext::validate() const {
      35           0 :     SkASSERT(fTextureProxy);
      36           0 :     fTextureProxy->validate(fContext);
      37             : 
      38           0 :     if (fOpList && !fOpList->isClosed()) {
      39           0 :         SkASSERT(fTextureProxy->getLastOpList() == fOpList);
      40             :     }
      41           0 : }
      42             : #endif
      43             : 
      44           0 : GrTextureContext::~GrTextureContext() {
      45           0 :     ASSERT_SINGLE_OWNER
      46           0 :     SkSafeUnref(fOpList);
      47           0 : }
      48             : 
      49           0 : GrRenderTargetProxy* GrTextureContext::asRenderTargetProxy() {
      50             :     // If the proxy can return an RTProxy it should've been wrapped in a RTContext
      51           0 :     SkASSERT(!fTextureProxy->asRenderTargetProxy());
      52           0 :     return nullptr;
      53             : }
      54             : 
      55           0 : sk_sp<GrRenderTargetProxy> GrTextureContext::asRenderTargetProxyRef() {
      56             :     // If the proxy can return an RTProxy it should've been wrapped in a RTContext
      57           0 :     SkASSERT(!fTextureProxy->asRenderTargetProxy());
      58           0 :     return nullptr;
      59             : }
      60             : 
      61           0 : GrTextureOpList* GrTextureContext::getOpList() {
      62           0 :     ASSERT_SINGLE_OWNER
      63           0 :     SkDEBUGCODE(this->validate();)
      64             : 
      65           0 :     if (!fOpList || fOpList->isClosed()) {
      66           0 :         fOpList = this->drawingManager()->newOpList(fTextureProxy.get());
      67             :     }
      68             : 
      69           0 :     return fOpList;
      70             : }
      71             : 
      72             : // TODO: move this (and GrRenderTargetContext::copy) to GrSurfaceContext?
      73           0 : bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
      74             :                               const SkIRect& srcRect,
      75             :                               const SkIPoint& dstPoint) {
      76           0 :     ASSERT_SINGLE_OWNER
      77           0 :     RETURN_FALSE_IF_ABANDONED
      78           0 :     SkDEBUGCODE(this->validate();)
      79           0 :     GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::copy");
      80             : 
      81             : #ifndef ENABLE_MDB
      82             :     // We can't yet fully defer copies to textures, so GrTextureContext::copySurface will
      83             :     // execute the copy immediately. Ensure the data is ready.
      84           0 :     fContext->contextPriv().flushSurfaceWrites(srcProxy);
      85             : #endif
      86             : 
      87           0 :     GrTextureOpList* opList = this->getOpList();
      88           0 :     bool result = opList->copySurface(fContext->resourceProvider(),
      89           0 :                                       fTextureProxy.get(), srcProxy, srcRect, dstPoint);
      90             : 
      91             : #ifndef ENABLE_MDB
      92           0 :     GrOpFlushState flushState(fContext->getGpu(), nullptr);
      93           0 :     opList->prepareOps(&flushState);
      94           0 :     opList->executeOps(&flushState);
      95           0 :     opList->reset();
      96             : #endif
      97             : 
      98           0 :     return result;
      99             : }
     100             : 

Generated by: LCOV version 1.13