~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to .pc/kubuntu_01_arm_needs_qreal.diff/krita/plugins/paintops/chalk/kis_chalk_paintop.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (c) 2008,2009 Lukáš Tvrdý <lukast.dev@gmail.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 
 */
18
 
 
19
 
#include "kis_chalk_paintop.h"
20
 
#include "kis_chalk_paintop_settings.h"
21
 
 
22
 
#include <cmath>
23
 
#include <QRect>
24
 
 
25
 
#include <KoColor.h>
26
 
#include <KoColorSpace.h>
27
 
 
28
 
#include <kis_image.h>
29
 
#include <kis_debug.h>
30
 
 
31
 
#include <kis_global.h>
32
 
#include <kis_paint_device.h>
33
 
#include <kis_painter.h>
34
 
#include <kis_types.h>
35
 
#include <kis_paintop.h>
36
 
#include <kis_paint_information.h>
37
 
 
38
 
#include <kis_pressure_opacity_option.h>
39
 
 
40
 
KisChalkPaintOp::KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisImageWSP image)
41
 
        : KisPaintOp(painter)
42
 
        , m_settings(settings)
43
 
        , m_image(image)
44
 
{
45
 
    m_chalkBrush = new ChalkBrush(settings);
46
 
 
47
 
    m_opacityOption.readOptionSetting(settings);
48
 
    m_opacityOption.sensor()->reset();
49
 
}
50
 
 
51
 
KisChalkPaintOp::~KisChalkPaintOp()
52
 
{
53
 
    delete m_chalkBrush;
54
 
}
55
 
 
56
 
double KisChalkPaintOp::paintAt(const KisPaintInformation& info)
57
 
{
58
 
    if (!painter()) return 1;
59
 
 
60
 
    if (!m_dab) {
61
 
        m_dab = new KisPaintDevice(painter()->device()->colorSpace());
62
 
    } else {
63
 
        m_dab->clear();
64
 
    }
65
 
 
66
 
    qreal x1, y1;
67
 
 
68
 
    x1 = info.pos().x();
69
 
    y1 = info.pos().y();
70
 
 
71
 
    quint8 origOpacity = m_opacityOption.apply(painter(), info);
72
 
    m_chalkBrush->paint(m_dab, x1, y1, painter()->paintColor());
73
 
 
74
 
    QRect rc = m_dab->extent();
75
 
 
76
 
    painter()->bitBlt(rc.x(), rc.y(), m_dab, rc.x(), rc.y(), rc.width(), rc.height());
77
 
    painter()->setOpacity(origOpacity);
78
 
    return 1;
79
 
}