gfx/skia/trunk/include/core/SkLineClipper.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 SkLineClipper_DEFINED
     9 #define SkLineClipper_DEFINED
    11 #include "SkRect.h"
    12 #include "SkPoint.h"
    14 class SkLineClipper {
    15 public:
    16     enum {
    17         kMaxPoints = 4,
    18         kMaxClippedLineSegments = kMaxPoints - 1
    19     };
    21     /*  Clip the line pts[0]...pts[1] against clip, ignoring segments that
    22         lie completely above or below the clip. For portions to the left or
    23         right, turn those into vertical line segments that are aligned to the
    24         edge of the clip.
    26         Return the number of line segments that result, and store the end-points
    27         of those segments sequentially in lines as follows:
    28             1st segment: lines[0]..lines[1]
    29             2nd segment: lines[1]..lines[2]
    30             3rd segment: lines[2]..lines[3]
    31      */
    32     static int ClipLine(const SkPoint pts[2], const SkRect& clip,
    33                         SkPoint lines[kMaxPoints]);
    35     /*  Intersect the line segment against the rect. If there is a non-empty
    36         resulting segment, return true and set dst[] to that segment. If not,
    37         return false and ignore dst[].
    39         ClipLine is specialized for scan-conversion, as it adds vertical
    40         segments on the sides to show where the line extended beyond the
    41         left or right sides. IntersectLine does not.
    42      */
    43     static bool IntersectLine(const SkPoint src[2], const SkRect& clip,
    44                               SkPoint dst[2]);
    45 };
    47 #endif

mercurial