~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to krita/modules/colorspace_gray/kis_strategy_colorspace_grayscale.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
17
 */
 
18
#ifndef KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
 
19
#define KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
 
20
 
 
21
#include <qcolor.h>
 
22
 
 
23
#include <qcolor.h>
 
24
 
 
25
#include "kis_global.h"
 
26
#include "kis_strategy_colorspace.h"
 
27
#include "kis_pixel.h"
 
28
 
 
29
// XXX: move into namespace.
 
30
const PIXELTYPE PIXEL_GRAY = 0;
 
31
const PIXELTYPE PIXEL_GRAY_ALPHA = 1;
 
32
 
 
33
 
 
34
class KisStrategyColorSpaceGrayscale : public KisStrategyColorSpace {
 
35
public:
 
36
        KisStrategyColorSpaceGrayscale();
 
37
        virtual ~KisStrategyColorSpaceGrayscale();
 
38
 
 
39
public:
 
40
 
 
41
        virtual void nativeColor(const QColor& c, QUANTUM *dst, KisProfileSP profile = 0);
 
42
        virtual void nativeColor(const QColor& c, QUANTUM opacity, QUANTUM *dst, KisProfileSP profile = 0);
 
43
 
 
44
        virtual void toQColor(const QUANTUM *src, QColor *c, KisProfileSP profile = 0);
 
45
        virtual void toQColor(const QUANTUM *src, QColor *c, QUANTUM *opacity, KisProfileSP profile = 0);
 
46
 
 
47
        virtual KisPixelRO toKisPixelRO(const QUANTUM *src, KisProfileSP profile = 0)
 
48
                { return KisPixelRO (src, src + PIXEL_GRAY_ALPHA, this, profile); }
 
49
 
 
50
        virtual KisPixel toKisPixel(QUANTUM *src, KisProfileSP profile = 0)
 
51
                { return KisPixel (src, src + PIXEL_GRAY_ALPHA, this, profile); }
 
52
 
 
53
        virtual Q_INT8 difference(const QUANTUM* src1, const QUANTUM* src2);
 
54
        virtual void mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const;
 
55
 
 
56
        virtual vKisChannelInfoSP channels() const;
 
57
        virtual bool alpha() const;
 
58
        virtual Q_INT32 nChannels() const;
 
59
        virtual Q_INT32 nColorChannels() const;
 
60
        virtual Q_INT32 pixelSize() const;
 
61
 
 
62
 
 
63
        virtual QImage convertToQImage(const QUANTUM *data, Q_INT32 width, Q_INT32 height,
 
64
                                       KisProfileSP srcProfile, KisProfileSP dstProfile,
 
65
                                       Q_INT32 renderingIntent = INTENT_PERCEPTUAL);
 
66
 
 
67
 
 
68
        virtual void bitBlt(Q_INT32 stride,
 
69
                            QUANTUM *dst,
 
70
                            Q_INT32 dststride,
 
71
                            const QUANTUM *src,
 
72
                            Q_INT32 srcstride,
 
73
                            QUANTUM opacity,
 
74
                            Q_INT32 rows,
 
75
                            Q_INT32 cols,
 
76
                            const KisCompositeOp& op);
 
77
 
 
78
        KisCompositeOpList userVisiblecompositeOps() const;
 
79
 
 
80
protected:
 
81
        void compositeOver(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
82
        void compositeMultiply(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
83
        void compositeDivide(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
84
        void compositeScreen(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
85
        void compositeOverlay(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
86
        void compositeDodge(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
87
        void compositeBurn(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
88
        void compositeDarken(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
89
        void compositeLighten(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
 
90
 
 
91
private:
 
92
        vKisChannelInfoSP m_channels;
 
93
};
 
94
 
 
95
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_