LCOV - app.info - gfx/skia/src/core/SkPathHeap.cpp

LCOV - code coverage report
| Current view: | directory - gfx/skia/src/core - SkPathHeap.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 35 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 6 | 0 | 0.0 %

           1                 :
           2                 : /*
           3                 :  * Copyright 2011 Google Inc.
           4                 :  *
           5                 :  * Use of this source code is governed by a BSD-style license that can be
           6                 :  * found in the LICENSE file.
           7                 :  */
           8                 : #include "SkPathHeap.h"
           9                 : #include "SkPath.h"
          10                 : #include "SkStream.h"
          11                 : #include "SkFlattenable.h"
          12                 : #include <new>
          13                 :
          14                 : #define kPathCount  64
          15                 :
          16               0 : SkPathHeap::SkPathHeap() : fHeap(kPathCount * sizeof(SkPath)) {
          17               0 : }
          18                 :
          19               0 : SkPathHeap::SkPathHeap(SkFlattenableReadBuffer& buffer)
          20               0 :             : fHeap(kPathCount * sizeof(SkPath)) {
          21               0 :     int count = buffer.readS32();
          22                 :
          23               0 :     fPaths.setCount(count);
          24               0 :     SkPath** ptr = fPaths.begin();
          25               0 :     SkPath* p = (SkPath*)fHeap.allocThrow(count * sizeof(SkPath));
          26                 :
          27               0 :     for (int i = 0; i < count; i++) {
          28               0 :         new (p) SkPath;
          29               0 :         p->unflatten(buffer);
          30               0 :         *ptr++ = p; // record the pointer
          31               0 :         p++;        // move to the next storage location
          32                 :     }
          33               0 : }
          34                 :
          35               0 : SkPathHeap::~SkPathHeap() {
          36               0 :     SkPath** iter = fPaths.begin();
          37               0 :     SkPath** stop = fPaths.end();
          38               0 :     while (iter < stop) {
          39               0 :         (*iter)->~SkPath();
          40               0 :         iter++;
          41                 :     }
          42               0 : }
          43                 :
          44               0 : int SkPathHeap::append(const SkPath& path) {
          45               0 :     SkPath* p = (SkPath*)fHeap.allocThrow(sizeof(SkPath));
          46               0 :     new (p) SkPath(path);
          47               0 :     *fPaths.append() = p;
          48               0 :     return fPaths.count();
          49                 : }
          50                 :
          51               0 : void SkPathHeap::flatten(SkFlattenableWriteBuffer& buffer) const {
          52               0 :     int count = fPaths.count();
          53                 :
          54               0 :     buffer.write32(count);
          55               0 :     SkPath** iter = fPaths.begin();
          56               0 :     SkPath** stop = fPaths.end();
          57               0 :     while (iter < stop) {
          58               0 :         (*iter)->flatten(buffer);
          59               0 :         iter++;
          60                 :     }
          61               0 : }
          62                 :

Generated by: LCOV version 1.7