LCOV - code coverage report
Current view: top level - gfx/2d - PathRecording.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 66 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "PathRecording.h"
       7             : #include "DrawEventRecorder.h"
       8             : #include "RecordedEventImpl.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace gfx {
      12             : 
      13             : using namespace std;
      14             : 
      15             : void
      16           0 : PathBuilderRecording::MoveTo(const Point &aPoint)
      17             : {
      18           0 :   PathOp op;
      19           0 :   op.mType = PathOp::OP_MOVETO;
      20           0 :   op.mP1 = aPoint;
      21           0 :   mPathOps.push_back(op);
      22           0 :   mPathBuilder->MoveTo(aPoint);
      23           0 : }
      24             : 
      25             : void
      26           0 : PathBuilderRecording::LineTo(const Point &aPoint)
      27             : {
      28           0 :   PathOp op;
      29           0 :   op.mType = PathOp::OP_LINETO;
      30           0 :   op.mP1 = aPoint;
      31           0 :   mPathOps.push_back(op);
      32           0 :   mPathBuilder->LineTo(aPoint);
      33           0 : }
      34             : 
      35             : void
      36           0 : PathBuilderRecording::BezierTo(const Point &aCP1, const Point &aCP2, const Point &aCP3)
      37             : {
      38           0 :   PathOp op;
      39           0 :   op.mType = PathOp::OP_BEZIERTO;
      40           0 :   op.mP1 = aCP1;
      41           0 :   op.mP2 = aCP2;
      42           0 :   op.mP3 = aCP3;
      43           0 :   mPathOps.push_back(op);
      44           0 :   mPathBuilder->BezierTo(aCP1, aCP2, aCP3);
      45           0 : }
      46             : 
      47             : void
      48           0 : PathBuilderRecording::QuadraticBezierTo(const Point &aCP1, const Point &aCP2)
      49             : {
      50           0 :   PathOp op;
      51           0 :   op.mType = PathOp::OP_QUADRATICBEZIERTO;
      52           0 :   op.mP1 = aCP1;
      53           0 :   op.mP2 = aCP2;
      54           0 :   mPathOps.push_back(op);
      55           0 :   mPathBuilder->QuadraticBezierTo(aCP1, aCP2);
      56           0 : }
      57             : 
      58             : void
      59           0 : PathBuilderRecording::Close()
      60             : {
      61           0 :   PathOp op;
      62           0 :   op.mType = PathOp::OP_CLOSE;
      63           0 :   mPathOps.push_back(op);
      64           0 :   mPathBuilder->Close();
      65           0 : }
      66             : 
      67             : Point
      68           0 : PathBuilderRecording::CurrentPoint() const
      69             : {
      70           0 :   return mPathBuilder->CurrentPoint();
      71             : }
      72             : 
      73             : already_AddRefed<Path>
      74           0 : PathBuilderRecording::Finish()
      75             : {
      76           0 :   RefPtr<Path> path = mPathBuilder->Finish();
      77           0 :   return MakeAndAddRef<PathRecording>(path, mPathOps, mFillRule);
      78             : }
      79             : 
      80           0 : PathRecording::~PathRecording()
      81             : {
      82           0 :   for (size_t i = 0; i < mStoredRecorders.size(); i++) {
      83           0 :     mStoredRecorders[i]->RemoveStoredObject(this);
      84           0 :     mStoredRecorders[i]->RecordEvent(RecordedPathDestruction(this));
      85             :   }
      86           0 : }
      87             : 
      88             : already_AddRefed<PathBuilder>
      89           0 : PathRecording::CopyToBuilder(FillRule aFillRule) const
      90             : {
      91           0 :   RefPtr<PathBuilder> pathBuilder = mPath->CopyToBuilder(aFillRule);
      92           0 :   RefPtr<PathBuilderRecording> recording = new PathBuilderRecording(pathBuilder, aFillRule);
      93           0 :   recording->mPathOps = mPathOps;
      94           0 :   return recording.forget();
      95             : }
      96             : 
      97             : already_AddRefed<PathBuilder>
      98           0 : PathRecording::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const
      99             : {
     100           0 :   RefPtr<PathBuilder> pathBuilder = mPath->TransformedCopyToBuilder(aTransform, aFillRule);
     101           0 :   RefPtr<PathBuilderRecording> recording = new PathBuilderRecording(pathBuilder, aFillRule);
     102             :   typedef std::vector<PathOp> pathOpVec;
     103           0 :   for (pathOpVec::const_iterator iter = mPathOps.begin(); iter != mPathOps.end(); iter++) {
     104           0 :     PathOp newPathOp;
     105           0 :     newPathOp.mType = iter->mType;
     106           0 :     if (sPointCount[newPathOp.mType] >= 1) {
     107           0 :       newPathOp.mP1 = aTransform.TransformPoint(iter->mP1);
     108             :     }
     109           0 :     if (sPointCount[newPathOp.mType] >= 2) {
     110           0 :       newPathOp.mP2 = aTransform.TransformPoint(iter->mP2);
     111             :     }
     112           0 :     if (sPointCount[newPathOp.mType] >= 3) {
     113           0 :       newPathOp.mP3 = aTransform.TransformPoint(iter->mP3);
     114             :     }
     115           0 :     recording->mPathOps.push_back(newPathOp);
     116             :   }
     117           0 :   return recording.forget();
     118             : }
     119             : 
     120             : } // namespace gfx
     121             : } // namespace mozilla

Generated by: LCOV version 1.13