gfx/skia/trunk/include/utils/SkBoundaryPatch.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 #ifndef SkBoundaryPatch_DEFINED
     9 #define SkBoundaryPatch_DEFINED
    11 #include "SkPoint.h"
    12 #include "SkRefCnt.h"
    14 class SkBoundary : public SkRefCnt {
    15 public:
    16     SK_DECLARE_INST_COUNT(SkBoundary)
    18     // These must be 0, 1, 2, 3 for efficiency in the subclass implementations
    19     enum Edge {
    20         kTop    = 0,
    21         kRight  = 1,
    22         kBottom = 2,
    23         kLeft   = 3
    24     };
    25     // Edge index goes clockwise around the boundary, beginning at the "top"
    26     virtual SkPoint eval(Edge, SkScalar unitInterval) = 0;
    28 private:
    29     typedef SkRefCnt INHERITED;
    30 };
    32 class SkBoundaryPatch {
    33 public:
    34     SkBoundaryPatch();
    35     ~SkBoundaryPatch();
    37     SkBoundary* getBoundary() const { return fBoundary; }
    38     SkBoundary* setBoundary(SkBoundary*);
    40     SkPoint eval(SkScalar unitU, SkScalar unitV);
    41     bool evalPatch(SkPoint verts[], int rows, int cols);
    43 private:
    44     SkBoundary* fBoundary;
    45 };
    47 ////////////////////////////////////////////////////////////////////////
    49 class SkLineBoundary : public SkBoundary {
    50 public:
    51     SkPoint fPts[4];
    53     // override
    54     virtual SkPoint eval(Edge, SkScalar);
    55 };
    57 class SkCubicBoundary : public SkBoundary {
    58 public:
    59     // the caller sets the first 12 entries. The 13th is used by the impl.
    60     SkPoint fPts[13];
    62     // override
    63     virtual SkPoint eval(Edge, SkScalar);
    64 };
    66 #endif

mercurial