LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrSurfaceContext.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 21 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 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 "GrSurfaceContext.h"
       9             : 
      10             : #include "GrContextPriv.h"
      11             : #include "SkColorSpace_Base.h"
      12             : #include "SkGr.h"
      13             : 
      14             : #include "../private/GrAuditTrail.h"
      15             : 
      16             : 
      17             : // In MDB mode the reffing of the 'getLastOpList' call's result allows in-progress
      18             : // GrOpLists to be picked up and added to by renderTargetContexts lower in the call
      19             : // stack. When this occurs with a closed GrOpList, a new one will be allocated
      20             : // when the renderTargetContext attempts to use it (via getOpList).
      21           0 : GrSurfaceContext::GrSurfaceContext(GrContext* context,
      22             :                                    GrDrawingManager* drawingMgr,
      23             :                                    sk_sp<SkColorSpace> colorSpace,
      24             :                                    GrAuditTrail* auditTrail,
      25           0 :                                    GrSingleOwner* singleOwner)
      26             :     : fContext(context)
      27           0 :     , fColorSpace(std::move(colorSpace))
      28             :     , fAuditTrail(auditTrail)
      29             :     , fDrawingManager(drawingMgr)
      30             : #ifdef SK_DEBUG
      31           0 :     , fSingleOwner(singleOwner)
      32             : #endif
      33             : {
      34           0 : }
      35             : 
      36           0 : bool GrSurfaceContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer,
      37             :                                   size_t dstRowBytes, int x, int y, uint32_t flags) {
      38             :     // TODO: teach GrRenderTarget to take ImageInfo directly to specify the src pixels
      39           0 :     GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps());
      40           0 :     if (kUnknown_GrPixelConfig == config) {
      41           0 :         return false;
      42             :     }
      43             : 
      44             :     // TODO: this seems to duplicate code in SkImage_Gpu::onReadPixels
      45           0 :     if (kUnpremul_SkAlphaType == dstInfo.alphaType()) {
      46           0 :         flags |= GrContextPriv::kUnpremul_PixelOpsFlag;
      47             :     }
      48             : 
      49           0 :     return fContext->contextPriv().readSurfacePixels(this->asSurfaceProxy(),
      50             :                                                      this->getColorSpace(), x, y,
      51             :                                                      dstInfo.width(), dstInfo.height(), config,
      52             :                                                      dstInfo.colorSpace(),
      53           0 :                                                      dstBuffer, dstRowBytes, flags);
      54             : }
      55             : 
      56           0 : bool GrSurfaceContext::writePixels(const SkImageInfo& srcInfo, const void* srcBuffer,
      57             :                                    size_t srcRowBytes, int x, int y, uint32_t flags) {
      58             :     // TODO: teach GrRenderTarget to take ImageInfo directly to specify the src pixels
      59           0 :     GrPixelConfig config = SkImageInfo2GrPixelConfig(srcInfo, *fContext->caps());
      60           0 :     if (kUnknown_GrPixelConfig == config) {
      61           0 :         return false;
      62             :     }
      63           0 :     if (kUnpremul_SkAlphaType == srcInfo.alphaType()) {
      64           0 :         flags |= GrContextPriv::kUnpremul_PixelOpsFlag;
      65             :     }
      66             : 
      67           0 :     return fContext->contextPriv().writeSurfacePixels(this->asSurfaceProxy(),
      68             :                                                       this->getColorSpace(), x, y,
      69             :                                                       srcInfo.width(), srcInfo.height(),
      70             :                                                       config, srcInfo.colorSpace(),
      71           0 :                                                       srcBuffer, srcRowBytes, flags);
      72             : }

Generated by: LCOV version 1.13