LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrTextureOpList.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 46 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 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 "GrTextureOpList.h"
       9             : 
      10             : #include "GrAuditTrail.h"
      11             : #include "GrGpu.h"
      12             : #include "GrTextureProxy.h"
      13             : #include "SkStringUtils.h"
      14             : #include "ops/GrCopySurfaceOp.h"
      15             : 
      16             : ////////////////////////////////////////////////////////////////////////////////
      17             : 
      18           0 : GrTextureOpList::GrTextureOpList(GrTextureProxy* tex, GrGpu* gpu, GrAuditTrail* auditTrail)
      19             :     : INHERITED(tex, auditTrail)
      20           0 :     , fGpu(SkRef(gpu)) {
      21           0 : }
      22             : 
      23           0 : GrTextureOpList::~GrTextureOpList() {
      24           0 :     fGpu->unref();
      25           0 : }
      26             : 
      27             : ////////////////////////////////////////////////////////////////////////////////
      28             : 
      29             : #ifdef SK_DEBUG
      30           0 : void GrTextureOpList::dump() const {
      31           0 :     INHERITED::dump();
      32             : 
      33           0 :     SkDebugf("ops (%d):\n", fRecordedOps.count());
      34           0 :     for (int i = 0; i < fRecordedOps.count(); ++i) {
      35           0 :         SkDebugf("*******************************\n");
      36           0 :         SkDebugf("%d: %s\n", i, fRecordedOps[i]->name());
      37           0 :         SkString str = fRecordedOps[i]->dumpInfo();
      38           0 :         SkDebugf("%s\n", str.c_str());
      39           0 :         const SkRect& clippedBounds = fRecordedOps[i]->bounds();
      40           0 :         SkDebugf("ClippedBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
      41           0 :                     clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight,
      42           0 :                     clippedBounds.fBottom);
      43             :     }
      44           0 : }
      45             : #endif
      46             : 
      47           0 : void GrTextureOpList::prepareOps(GrOpFlushState* flushState) {
      48             :     // MDB TODO: add SkASSERT(this->isClosed());
      49             : 
      50             :     // Loop over the ops that haven't yet generated their geometry
      51           0 :     for (int i = 0; i < fRecordedOps.count(); ++i) {
      52           0 :         if (fRecordedOps[i]) {
      53             :             // We do not call flushState->setDrawOpArgs as this op list does not support GrDrawOps.
      54           0 :             fRecordedOps[i]->prepare(flushState);
      55             :         }
      56             :     }
      57           0 : }
      58             : 
      59           0 : bool GrTextureOpList::executeOps(GrOpFlushState* flushState) {
      60           0 :     if (0 == fRecordedOps.count()) {
      61           0 :         return false;
      62             :     }
      63             : 
      64           0 :     for (int i = 0; i < fRecordedOps.count(); ++i) {
      65             :         // We do not call flushState->setDrawOpArgs as this op list does not support GrDrawOps.
      66           0 :         fRecordedOps[i]->execute(flushState);
      67             :     }
      68             : 
      69           0 :     fGpu->finishOpList();
      70           0 :     return true;
      71             : }
      72             : 
      73           0 : void GrTextureOpList::reset() {
      74           0 :     fRecordedOps.reset();
      75           0 : }
      76             : 
      77             : ////////////////////////////////////////////////////////////////////////////////
      78             : 
      79           0 : bool GrTextureOpList::copySurface(GrResourceProvider* resourceProvider,
      80             :                                   GrSurfaceProxy* dst,
      81             :                                   GrSurfaceProxy* src,
      82             :                                   const SkIRect& srcRect,
      83             :                                   const SkIPoint& dstPoint) {
      84           0 :     std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(resourceProvider, dst, src, srcRect, dstPoint);
      85           0 :     if (!op) {
      86           0 :         return false;
      87             :     }
      88             : #ifdef ENABLE_MDB
      89             :     this->addDependency(src);
      90             : #endif
      91             : 
      92             :     // See the comment in GrRenderTargetOpList about why we pass the invalid ID here.
      93           0 :     this->recordOp(std::move(op),
      94             :                    GrGpuResource::UniqueID::InvalidID(),
      95           0 :                    GrSurfaceProxy::UniqueID::InvalidID());
      96           0 :     return true;
      97             : }
      98             : 
      99           0 : void GrTextureOpList::recordOp(std::unique_ptr<GrOp> op,
     100             :                                GrGpuResource::UniqueID resourceUniqueID,
     101             :                                GrSurfaceProxy::UniqueID proxyUniqueID) {
     102             :     // A closed GrOpList should never receive new/more ops
     103           0 :     SkASSERT(!this->isClosed());
     104             : 
     105           0 :     GR_AUDIT_TRAIL_ADD_OP(fAuditTrail, op.get(), resourceUniqueID, proxyUniqueID);
     106             :     GrOP_INFO("Re-Recording (%s, B%u)\n"
     107             :         "\tBounds LRTB (%f, %f, %f, %f)\n",
     108             :         op->name(),
     109             :         op->uniqueID(),
     110             :         op->bounds().fLeft, op->bounds().fRight,
     111             :         op->bounds().fTop, op->bounds().fBottom);
     112             :     GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
     113             :     GR_AUDIT_TRAIL_OP_RESULT_NEW(fAuditTrail, op.get());
     114             : 
     115           0 :     fRecordedOps.emplace_back(std::move(op));
     116           0 : }

Generated by: LCOV version 1.13