gfx/skia/trunk/src/pathops/SkPathOpsBounds.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /*
     2  * Copyright 2012 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 #include "SkPathOpsBounds.h"
     8 #include "SkPathOpsCubic.h"
     9 #include "SkPathOpsLine.h"
    10 #include "SkPathOpsQuad.h"
    12 void SkPathOpsBounds::setCubicBounds(const SkPoint a[4]) {
    13     SkDCubic cubic;
    14     cubic.set(a);
    15     SkDRect dRect;
    16     dRect.setBounds(cubic);
    17     set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
    18             SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
    19 }
    21 void SkPathOpsBounds::setLineBounds(const SkPoint a[2]) {
    22     setPointBounds(a[0]);
    23     add(a[1]);
    24 }
    26 void SkPathOpsBounds::setQuadBounds(const SkPoint a[3]) {
    27     SkDQuad quad;
    28     quad.set(a);
    29     SkDRect dRect;
    30     dRect.setBounds(quad);
    31     set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
    32             SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
    33 }
    35 void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]) = {
    36     NULL,
    37     &SkPathOpsBounds::setLineBounds,
    38     &SkPathOpsBounds::setQuadBounds,
    39     &SkPathOpsBounds::setCubicBounds
    40 };

mercurial