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.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2011 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8 #ifndef SkBoundaryPatch_DEFINED
michael@0 9 #define SkBoundaryPatch_DEFINED
michael@0 10
michael@0 11 #include "SkPoint.h"
michael@0 12 #include "SkRefCnt.h"
michael@0 13
michael@0 14 class SkBoundary : public SkRefCnt {
michael@0 15 public:
michael@0 16 SK_DECLARE_INST_COUNT(SkBoundary)
michael@0 17
michael@0 18 // These must be 0, 1, 2, 3 for efficiency in the subclass implementations
michael@0 19 enum Edge {
michael@0 20 kTop = 0,
michael@0 21 kRight = 1,
michael@0 22 kBottom = 2,
michael@0 23 kLeft = 3
michael@0 24 };
michael@0 25 // Edge index goes clockwise around the boundary, beginning at the "top"
michael@0 26 virtual SkPoint eval(Edge, SkScalar unitInterval) = 0;
michael@0 27
michael@0 28 private:
michael@0 29 typedef SkRefCnt INHERITED;
michael@0 30 };
michael@0 31
michael@0 32 class SkBoundaryPatch {
michael@0 33 public:
michael@0 34 SkBoundaryPatch();
michael@0 35 ~SkBoundaryPatch();
michael@0 36
michael@0 37 SkBoundary* getBoundary() const { return fBoundary; }
michael@0 38 SkBoundary* setBoundary(SkBoundary*);
michael@0 39
michael@0 40 SkPoint eval(SkScalar unitU, SkScalar unitV);
michael@0 41 bool evalPatch(SkPoint verts[], int rows, int cols);
michael@0 42
michael@0 43 private:
michael@0 44 SkBoundary* fBoundary;
michael@0 45 };
michael@0 46
michael@0 47 ////////////////////////////////////////////////////////////////////////
michael@0 48
michael@0 49 class SkLineBoundary : public SkBoundary {
michael@0 50 public:
michael@0 51 SkPoint fPts[4];
michael@0 52
michael@0 53 // override
michael@0 54 virtual SkPoint eval(Edge, SkScalar);
michael@0 55 };
michael@0 56
michael@0 57 class SkCubicBoundary : public SkBoundary {
michael@0 58 public:
michael@0 59 // the caller sets the first 12 entries. The 13th is used by the impl.
michael@0 60 SkPoint fPts[13];
michael@0 61
michael@0 62 // override
michael@0 63 virtual SkPoint eval(Edge, SkScalar);
michael@0 64 };
michael@0 65
michael@0 66 #endif

mercurial