LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkBitmapController.h (source / functions) Hit Total Coverage
Test: output.info Lines: 10 12 83.3 %
Date: 2017-07-14 16:53:18 Functions: 9 13 69.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2015 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             : #ifndef SkBitmapController_DEFINED
       9             : #define SkBitmapController_DEFINED
      10             : 
      11             : #include "SkBitmap.h"
      12             : #include "SkBitmapCache.h"
      13             : #include "SkFilterQuality.h"
      14             : #include "SkMatrix.h"
      15             : 
      16             : class SkBitmapProvider;
      17             : 
      18             : /**
      19             :  *  Handles request to scale, filter, and lock a bitmap to be rasterized.
      20             :  */
      21         141 : class SkBitmapController : ::SkNoncopyable {
      22             : public:
      23         141 :     class State : ::SkNoncopyable {
      24             :     public:
      25         141 :         virtual ~State() {}
      26             : 
      27         282 :         const SkPixmap& pixmap() const { return fPixmap; }
      28         282 :         const SkMatrix& invMatrix() const { return fInvMatrix; }
      29         141 :         SkFilterQuality quality() const { return fQuality; }
      30             : 
      31             :     protected:
      32             :         SkPixmap        fPixmap;
      33             :         SkMatrix        fInvMatrix;
      34             :         SkFilterQuality fQuality;
      35             : 
      36             :     private:
      37             :         friend class SkBitmapController;
      38             :     };
      39             : 
      40         141 :     virtual ~SkBitmapController() {}
      41             : 
      42             :     State* requestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
      43             :                          void* storage, size_t storageSize);
      44             : 
      45           0 :     State* requestBitmap(const SkBitmapProvider& bp, const SkMatrix& inv, SkFilterQuality quality) {
      46           0 :         return this->requestBitmap(bp, inv, quality, nullptr, 0);
      47             :     }
      48             : 
      49             : protected:
      50             :     virtual State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality,
      51             :                                    void* storage, size_t storageSize) = 0;
      52             : };
      53             : 
      54             : ///////////////////////////////////////////////////////////////////////////////////////////////////
      55             : 
      56             : #include "SkMipMap.h"
      57             : 
      58         141 : class SkDefaultBitmapController : public SkBitmapController {
      59             : public:
      60             :     enum class CanShadeHQ { kNo, kYes };
      61         141 :     SkDefaultBitmapController(CanShadeHQ canShadeHQ)
      62         141 :         : fCanShadeHQ(canShadeHQ == CanShadeHQ::kYes) {}
      63             : 
      64             : protected:
      65             :     State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
      66             :                            void* storage, size_t storageSize) override;
      67             :     bool fCanShadeHQ;
      68             : };
      69             : 
      70             : #endif

Generated by: LCOV version 1.13