This file is indexed.

/usr/include/gnash/asobj/FillStyle.h is in gnash-dev 0.8.11~git20160109-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// FillStyle.h: variant fill styles
// 
//   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
//   Free Software Foundation, Inc.
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

#ifndef GNASH_FILL_STYLE_H
#define GNASH_FILL_STYLE_H

#include <boost/variant.hpp>
#include <vector> 
#include <iosfwd> 
#include <boost/intrusive_ptr.hpp>
#include <cassert>

#include "SWFMatrix.h"
#include "SWF.h"
#include "RGBA.h" 

namespace gnash {
    class movie_definition;
    class CachedBitmap;
}

namespace gnash {

class GradientRecord
{
public:
    GradientRecord(std::uint8_t ratio, rgba color)
        :
        ratio(ratio),
        color(std::move(color))
    { }
    
    //data:
    std::uint8_t ratio;
    rgba color;
};

/// A BitmapFill
//
/// BitmapFills can refer to a parsed bitmap tag or be constructed from
/// bitmap data. They are used for Bitmap characters.
//
/// Presently all members are immutable after construction. It is of course
/// possible to change the appearance of the fill by changing the CachedBitmap
/// it refers to.
//
/// Special member functions (ctor, dtor etc) are not inlined to avoid 
/// requiring the definition of movie_definition.
//
/// TODO: check the following:
//
/// It may be necessary to allow setting the smoothing policy; the use of
/// this should certainly be extended to non-static BitmapFills.
class DSOEXPORT BitmapFill
{
public:

    /// How to smooth the bitmap.
    enum SmoothingPolicy {
        SMOOTHING_UNSPECIFIED,
        SMOOTHING_ON,
        SMOOTHING_OFF
    };
    
    /// Whether the fill is tiled or clipped.
    //
    /// Clipped fills use the edge pixels to fill any area outside the bounds
    /// of the image.
    enum Type {
        CLIPPED,
        TILED
    };

    /// Construct a BitmapFill from arbitrary bitmap data.
    //
    /// TODO: check the smoothing policy here!
    BitmapFill(Type t, const CachedBitmap* bi, SWFMatrix m,
            SmoothingPolicy pol);

    /// Construct a static BitmapFill using a SWF tag.
    BitmapFill(SWF::FillType t, movie_definition* md, std::uint16_t id,
            SWFMatrix m);

    /// Destructor
    ~BitmapFill();

    /// Copy a BitmapFill
    //
    /// The copied BitmapFill refers to the same bitmap id in the same
    /// movie_definition as the original.
    BitmapFill(const BitmapFill& other);
    
    BitmapFill& operator=(const BitmapFill& other);

    /// Set this fill to a lerp of two other BitmapFills.
    void setLerp(const BitmapFill& a, const BitmapFill& b, double ratio);

    /// Get the Type of this BitmapFill
    //
    /// BitmapFills are either tiled or clipped.
    Type type() const {
        return _type;
    }

    /// Get the smoothing policy of this BitmapFill.
    SmoothingPolicy smoothingPolicy() const {
        return _smoothingPolicy;
    }

    /// Get the actual Bitmap data.
    const CachedBitmap* bitmap() const;

    /// Get the matrix of this BitmapFill.
    const SWFMatrix& matrix() const {
        return _matrix;
    }

private:

    Type _type;

    SmoothingPolicy _smoothingPolicy;

    SWFMatrix _matrix;
    
    /// A Bitmap, used for dynamic fills and to cache parsed bitmaps.
    mutable boost::intrusive_ptr<const CachedBitmap> _bitmapInfo;

    /// The movie definition containing the bitmap
    movie_definition* _md;

    // The id of the tag containing the bitmap
    std::uint16_t _id;
};

/// A GradientFill
class DSOEXPORT GradientFill
{
public:

    /// The type of GradientFill
    //
    /// A Radial fill is a gradient fill with a focal point.
    enum Type {
        LINEAR,
        RADIAL
    };

    enum SpreadMode {
        PAD,
        REPEAT,
        REFLECT
    };

    enum InterpolationMode {
        RGB,
        LINEAR_RGB
    };

    typedef std::vector<GradientRecord> GradientRecords;

    /// Construct a GradientFill
    //
    /// Optionally the records can be passed here.
    //
    /// The actual matrix of the gradient depends on the type; the constructor
    /// handles this, and users should just pass the user matrix.
    GradientFill(Type t, const SWFMatrix& m,
            const GradientRecords& = GradientRecords());

    Type type() const {
        return _type;
    }

    const SWFMatrix& matrix() const {
        return _matrix;
    }

    /// Set this fill to a lerp of two other GradientFills.
    void setLerp(const GradientFill& a, const GradientFill& b, double ratio);
    
    void setRecords(const GradientRecords& recs) {
        assert(recs.size() > 1);
        _gradients = recs;
    }

    const GradientRecords &getRecords() const {
        return _gradients;
    }

    /// Get the number of records in this GradientFill
    size_t recordCount() const {
        return _gradients.size();
    }

    /// Query the GradientRecord at the specified index
    //
    /// There are recordCount() records.
    const GradientRecord& record(size_t i) const {
        assert(i < _gradients.size());
        return _gradients[i];
    }

    /// Set the focal point.
    //
    /// Value will be clamped to the range -1..1; callers don't need to check.
    void setFocalPoint(double d);

    /// Get the focal point of this GradientFill
    //
    /// If the focal point is 0.0, it is a simple radial fill.
    double focalPoint() const {
        return _focalPoint;
    }

    SpreadMode spreadMode;
    InterpolationMode interpolation;

private:

    double _focalPoint;
    GradientRecords _gradients;
    Type _type;
    SWFMatrix _matrix;
};

/// A SolidFill containing one color.
//
/// SolidFills are the simplest fill, containing only a single color.
struct DSOEXPORT SolidFill
{
public:

    /// Construct a SolidFill.
    explicit SolidFill(rgba c)
        :
        _color(std::move(c))
    { }

    /// Copy a SolidFill.
    SolidFill(const SolidFill& other)
        :
        _color(other._color)
    { }

    /// Set this fill to a lerp of two other SolidFills.
    void setLerp(const SolidFill& a, const SolidFill& b, double ratio) {
        _color = lerp(a.color(), b.color(), ratio);
    }

    /// Get the color of the fill.
    rgba color() const {
        return _color;
    }

private:
    rgba _color;
};

/// FillStyle describes the various fill styles for shapes
//
/// The FillStyle class is effectively a boost::variant, but to allow passing
/// FillStyles using a forward declaration (and reducing compile times),
/// it's necessary to use a class.
class DSOEXPORT FillStyle 
{
public:

    typedef boost::variant<BitmapFill, SolidFill, GradientFill> Fill;
    
    /// Construct a FillStyle from any Fill.
    //
    /// The non-explicit templated contructor allows the same syntax as a
    /// simple boost::variant:
    ///     FillStyle f = GradientFill();
    template<typename T> FillStyle(const T& f) : fill(f) {}

    FillStyle(const FillStyle& other)
        :
        fill(other.fill)
    { }

    Fill fill;

};
 
/// Set the FillStyle to a lerp of a and b.
//
/// Callers must ensure that all FillStyles have exactly the same type! Most
/// errors are caught by type-checking and will throw an unhandled exception.
void setLerp(FillStyle& f, const FillStyle& a, const FillStyle& b, double t);

/// Output operator for bitmap smoothing policy.
DSOEXPORT std::ostream& operator<<(std::ostream& os,
        const BitmapFill::SmoothingPolicy& p);

/// Output operator for FillStyles.
std::ostream& operator<<(std::ostream& os, const FillStyle& fs);

/// Output operator for GradientFill type.
std::ostream& operator<<(std::ostream& o, GradientFill::Type t);

/// Output operator for GradientFill spread mode.
std::ostream& operator<<(std::ostream& o, GradientFill::SpreadMode t);

/// Output operator for GradientFill interpolation mode.
std::ostream& operator<<(std::ostream& o, GradientFill::InterpolationMode t);

} // namespace gnash

#endif

// Local Variables:
// mode: C++
// indent-tabs-mode: nil
// End: