~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/dimg/filters/decorate/texturefilter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
{
43
43
 
44
44
TextureFilter::TextureFilter(DImg* orgImage, QObject* parent, int blendGain, const QString& texturePath)
45
 
             : DImgThreadedFilter(orgImage, parent, "Texture")
 
45
    : DImgThreadedFilter(orgImage, parent, "Texture")
46
46
{
47
47
    m_blendGain   = blendGain;
48
48
    m_texturePath = texturePath;
84
84
 
85
85
    kDebug() << "Texture File: " << m_texturePath;
86
86
    DImg texture(m_texturePath);
87
 
    if ( texture.isNull() ) return;
 
87
 
 
88
    if ( texture.isNull() )
 
89
    {
 
90
        return;
 
91
    }
88
92
 
89
93
    DImg textureImg(w, h, m_orgImage.sixteenBit(), m_orgImage.hasAlpha());
90
94
 
106
110
    uint offset;
107
111
 
108
112
    DColor teData, transData, inData, outData;
109
 
    uchar *ptr, *dptr, *tptr;
 
113
    uchar* ptr, *dptr, *tptr;
110
114
    int progress;
111
115
 
112
116
    int blendGain;
 
117
 
113
118
    if (sixteenBit)
 
119
    {
114
120
        blendGain = (m_blendGain + 1) * 256 - 1;
 
121
    }
115
122
    else
 
123
    {
116
124
        blendGain = m_blendGain;
 
125
    }
117
126
 
118
127
    // Make textured transparent layout.
119
128
 
151
160
        progress = (int) (((double) x * 50.0) / w);
152
161
 
153
162
        if (progress % 5 == 0)
 
163
        {
154
164
            postProgress(progress);
 
165
        }
155
166
    }
156
167
 
157
168
    // Merge layout and image using overlay method.
181
192
                outData.setGreen(intMult8(inData.green(), inData.green() + intMult8(2 * teData.green(), 255 - inData.green())));
182
193
                outData.setBlue(intMult8(inData.blue(), inData.blue() + intMult8(2 * teData.blue(), 255 - inData.blue())));
183
194
            }
 
195
 
184
196
            outData.setAlpha(inData.alpha());
185
197
            outData.setPixel(dptr);
186
198
        }
189
201
        progress = (int) (50.0 + ((double) x * 50.0) / w);
190
202
 
191
203
        if (progress%5 == 0)
 
204
        {
192
205
            postProgress(progress);
 
206
        }
193
207
    }
194
208
}
195
209