LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkGraphics.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 4 45 8.9 %
Date: 2017-07-14 16:53:18 Functions: 1 5 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2006 The Android Open Source Project
       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             : 
       9             : #include "SkGraphics.h"
      10             : 
      11             : #include "SkBlitter.h"
      12             : #include "SkCanvas.h"
      13             : #include "SkCpu.h"
      14             : #include "SkGeometry.h"
      15             : #include "SkGlyphCache.h"
      16             : #include "SkImageFilter.h"
      17             : #include "SkMath.h"
      18             : #include "SkMatrix.h"
      19             : #include "SkOpts.h"
      20             : #include "SkPath.h"
      21             : #include "SkPathEffect.h"
      22             : #include "SkPixelRef.h"
      23             : #include "SkRefCnt.h"
      24             : #include "SkResourceCache.h"
      25             : #include "SkScalerContext.h"
      26             : #include "SkShader.h"
      27             : #include "SkStream.h"
      28             : #include "SkTSearch.h"
      29             : #include "SkTime.h"
      30             : #include "SkUtils.h"
      31             : 
      32             : #include <stdlib.h>
      33             : 
      34           0 : void SkGraphics::GetVersion(int32_t* major, int32_t* minor, int32_t* patch) {
      35           0 :     if (major) {
      36           0 :         *major = SKIA_VERSION_MAJOR;
      37             :     }
      38           0 :     if (minor) {
      39           0 :         *minor = SKIA_VERSION_MINOR;
      40             :     }
      41           0 :     if (patch) {
      42           0 :         *patch = SKIA_VERSION_PATCH;
      43             :     }
      44           0 : }
      45             : 
      46           3 : void SkGraphics::Init() {
      47             :     // SkGraphics::Init() must be thread-safe and idempotent.
      48           3 :     SkCpu::CacheRuntimeFeatures();
      49           3 :     SkOpts::Init();
      50           3 : }
      51             : 
      52             : ///////////////////////////////////////////////////////////////////////////////
      53             : 
      54           0 : void SkGraphics::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
      55           0 :   SkResourceCache::DumpMemoryStatistics(dump);
      56           0 :   SkGlyphCache::DumpMemoryStatistics(dump);
      57           0 : }
      58             : 
      59           0 : void SkGraphics::PurgeAllCaches() {
      60           0 :     SkGraphics::PurgeFontCache();
      61           0 :     SkGraphics::PurgeResourceCache();
      62           0 :     SkImageFilter::PurgeCache();
      63           0 : }
      64             : 
      65             : ///////////////////////////////////////////////////////////////////////////////
      66             : 
      67             : static const char kFontCacheLimitStr[] = "font-cache-limit";
      68             : static const size_t kFontCacheLimitLen = sizeof(kFontCacheLimitStr) - 1;
      69             : 
      70             : static const struct {
      71             :     const char* fStr;
      72             :     size_t fLen;
      73             :     size_t (*fFunc)(size_t);
      74             : } gFlags[] = {
      75             :     { kFontCacheLimitStr, kFontCacheLimitLen, SkGraphics::SetFontCacheLimit }
      76             : };
      77             : 
      78             : /* flags are of the form param; or param=value; */
      79           0 : void SkGraphics::SetFlags(const char* flags) {
      80           0 :     if (!flags) {
      81           0 :         return;
      82             :     }
      83             :     const char* nextSemi;
      84           0 :     do {
      85           0 :         size_t len = strlen(flags);
      86           0 :         const char* paramEnd = flags + len;
      87           0 :         const char* nextEqual = strchr(flags, '=');
      88           0 :         if (nextEqual && paramEnd > nextEqual) {
      89           0 :             paramEnd = nextEqual;
      90             :         }
      91           0 :         nextSemi = strchr(flags, ';');
      92           0 :         if (nextSemi && paramEnd > nextSemi) {
      93           0 :             paramEnd = nextSemi;
      94             :         }
      95           0 :         size_t paramLen = paramEnd - flags;
      96           0 :         for (int i = 0; i < (int)SK_ARRAY_COUNT(gFlags); ++i) {
      97           0 :             if (paramLen != gFlags[i].fLen) {
      98           0 :                 continue;
      99             :             }
     100           0 :             if (strncmp(flags, gFlags[i].fStr, paramLen) == 0) {
     101           0 :                 size_t val = 0;
     102           0 :                 if (nextEqual) {
     103           0 :                     val = (size_t) atoi(nextEqual + 1);
     104             :                 }
     105           0 :                 (gFlags[i].fFunc)(val);
     106           0 :                 break;
     107             :             }
     108             :         }
     109           0 :         flags = nextSemi + 1;
     110           0 :     } while (nextSemi);
     111             : }

Generated by: LCOV version 1.13