| Differences between
and this patch
- a/WebCore/ChangeLog +35 lines
Lines 1-3 a/WebCore/ChangeLog_sec1
1
2009-08-11  Maxime Simon  <simon.maxime@gmail.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        [Haiku] Adding four image-specific files to WebCore:
6
        IconHaiku.cpp, ImageBufferData.h, ImageBufferHaiku.cpp, ImageHaiku.cpp
7
        https://bugs.webkit.org/show_bug.cgi?id=28130
8
9
        * platform/graphics/haiku/IconHaiku.cpp: Added.
10
        (WebCore::Icon::Icon):
11
        (WebCore::Icon::~Icon):
12
        (WebCore::Icon::createIconForFile):
13
        (WebCore::Icon::createIconForFiles):
14
        (WebCore::Icon::paint):
15
        * platform/graphics/haiku/ImageBufferData.h: Added.
16
        * platform/graphics/haiku/ImageBufferHaiku.cpp: Added.
17
        (WebCore::ImageBufferData::ImageBufferData):
18
        (WebCore::ImageBuffer::ImageBuffer):
19
        (WebCore::ImageBuffer::~ImageBuffer):
20
        (WebCore::ImageBuffer::context):
21
        (WebCore::ImageBuffer::getImageData):
22
        (WebCore::ImageBuffer::putImageData):
23
        (WebCore::ImageBuffer::toDataURL):
24
        (WebCore::ImageBuffer::image):
25
        (WebCore::ImageBuffer::platformTransformColorSpace):
26
        * platform/graphics/haiku/ImageHaiku.cpp: Added.
27
        (WebCore::FrameData::clear):
28
        (WebCore::Image::loadPlatformResource):
29
        (WebCore::BitmapImage::initPlatformData):
30
        (WebCore::BitmapImage::invalidatePlatformData):
31
        (WebCore::BitmapImage::draw):
32
        (WebCore::Image::drawPattern):
33
        (WebCore::BitmapImage::checkForSolidColor):
34
        (WebCore::BitmapImage::getBBitmap):
35
1
2009-08-11  Simon Hausmann  <simon.hausmann@nokia.com>
36
2009-08-11  Simon Hausmann  <simon.hausmann@nokia.com>
2
37
3
        Reviewed by NOBODY (build fix).
38
        Reviewed by NOBODY (build fix).
- a/WebCore/platform/graphics/haiku/IconHaiku.cpp +62 lines
Line 0 a/WebCore/platform/graphics/haiku/IconHaiku.cpp_sec1
1
/*
2
 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
3
 *
4
 * All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
 * Boston, MA 02111-1307, USA.
20
 *
21
 */
22
23
#include "config.h"
24
#include "Icon.h"
25
26
#include "GraphicsContext.h"
27
#include "IntRect.h"
28
#include "NotImplemented.h"
29
#include "PlatformString.h"
30
31
32
namespace WebCore {
33
34
Icon::Icon()
35
{
36
    notImplemented();
37
}
38
39
Icon::~Icon()
40
{
41
    notImplemented();
42
}
43
44
PassRefPtr<Icon> Icon::createIconForFile(const String& filename)
45
{
46
    notImplemented();
47
    return 0;
48
}
49
50
PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
51
{
52
    notImplemented();
53
    return 0;
54
}
55
56
void Icon::paint(GraphicsContext*, const IntRect&)
57
{
58
    notImplemented();
59
}
60
61
} // namespace WebCore
62
- a/WebCore/platform/graphics/haiku/ImageBufferData.h +43 lines
Line 0 a/WebCore/platform/graphics/haiku/ImageBufferData.h_sec1
1
/*
2
 * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 */
27
28
#ifndef ImageBufferData_h
29
#define ImageBufferData_h
30
31
namespace WebCore {
32
33
    class IntSize;
34
35
    class ImageBufferData {
36
    public:
37
        ImageBufferData(const IntSize&);
38
    };
39
40
}  // namespace WebCore
41
42
#endif  // ImageBufferData_h
43
- a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp +86 lines
Line 0 a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
#include "config.h"
27
#include "ImageBuffer.h"
28
29
#include "GraphicsContext.h"
30
#include "ImageData.h"
31
#include "NotImplemented.h"
32
33
34
namespace WebCore {
35
36
ImageBufferData::ImageBufferData(const IntSize&)
37
{
38
}
39
40
ImageBuffer::ImageBuffer(const IntSize&, ImageColorSpace imageColorSpace, bool& success)
41
    : m_data(IntSize())
42
{
43
    notImplemented();
44
    success = false;
45
}
46
47
ImageBuffer::~ImageBuffer()
48
{
49
}
50
51
GraphicsContext* ImageBuffer::context() const
52
{
53
    notImplemented();
54
    return 0;
55
}
56
57
PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect&) const
58
{
59
    notImplemented();
60
    return 0;
61
}
62
63
void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&)
64
{
65
    notImplemented();
66
}
67
68
String ImageBuffer::toDataURL(const String&) const
69
{
70
    notImplemented();
71
    return String();
72
}
73
74
Image* ImageBuffer::image() const
75
{
76
    notImplemented();
77
    return 0;
78
}
79
80
void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
81
{
82
    notImplemented();
83
}
84
85
} // namespace WebCore
86
- a/WebCore/platform/graphics/haiku/ImageHaiku.cpp -1 / +152 lines
Line 0 a/WebCore/platform/graphics/haiku/ImageHaiku.cpp_sec1
0
- 
1
/*
2
 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
3
 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
4
 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
5
 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
6
 * Copyright (C) 2008 Andrea Anzani <andrea.anzani@gmail.com>
7
 *
8
 * All rights reserved.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
20
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
23
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 */
31
32
#include "config.h"
33
#include "Image.h"
34
35
#include "BitmapImage.h"
36
#include "FloatRect.h"
37
#include "GraphicsContext.h"
38
#include "NotImplemented.h"
39
#include "PlatformString.h"
40
#include <Application.h>
41
#include <Bitmap.h>
42
#include <View.h>
43
44
45
// This function loads resources from WebKit
46
Vector<char> loadResourceIntoArray(const char*);
47
48
49
namespace WebCore {
50
51
bool FrameData::clear(bool clearMetadata)
52
{
53
    if (clearMetadata)
54
        m_haveMetadata = false;
55
56
    if (m_frame) {
57
        delete m_frame;
58
        m_frame = 0;
59
        m_duration = 0.0f;
60
        m_hasAlpha = true;
61
        return true;
62
    }
63
64
    return false;
65
}
66
67
WTF::PassRefPtr<Image> Image::loadPlatformResource(const char* name)
68
{
69
    Vector<char> array = loadResourceIntoArray(name);
70
    WTF::PassRefPtr<BitmapImage> image = BitmapImage::create();
71
    RefPtr<SharedBuffer> buffer = SharedBuffer::create(array.data(), array.size());
72
    image->setData(buffer, true);
73
74
    return image;
75
}
76
77
void BitmapImage::initPlatformData()
78
{
79
}
80
81
void BitmapImage::invalidatePlatformData()
82
{
83
}
84
85
// Drawing Routines
86
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
87
{
88
    startAnimation();
89
90
    BBitmap* image = nativeImageForCurrentFrame();
91
    if (!image || !image->IsValid()) // If the image hasn't fully loaded.
92
        return;
93
94
    if (mayFillWithSolidColor()) {
95
        fillWithSolidColor(ctxt, dst, solidColor(), op);
96
        return;
97
    }
98
99
    ctxt->save();
100
    ctxt->setCompositeOperation(op);
101
102
    BRect srcRect(src);
103
    BRect dstRect(dst);
104
105
    // Test using example site at
106
    // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
107
    ctxt->platformContext()->SetDrawingMode(B_OP_ALPHA);
108
    ctxt->platformContext()->DrawBitmap(image, srcRect & image->Bounds(), dstRect);
109
    ctxt->restore();
110
}
111
112
void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, CompositeOperator op, const FloatRect& dstRect)
113
{
114
    // FIXME: finish this to support also phased position (srcPoint)
115
    startAnimation();
116
117
    BBitmap* image = nativeImageForCurrentFrame();
118
    if (!image || !image->IsValid()) // If the image hasn't fully loaded.
119
        return;
120
121
    float currentWidth = 0;
122
    float currentHeight = 0;
123
124
    context->save();
125
    context->platformContext()->SetDrawingMode(B_OP_ALPHA);
126
    context->clip(enclosingIntRect(dstRect));
127
128
    while (currentWidth < dstRect.width()) {
129
        while (currentHeight < dstRect.height()) {
130
            context->platformContext()->DrawBitmap(image, BPoint(dstRect.x() + currentWidth, dstRect.y() + currentHeight));
131
            currentHeight += tileRect.height();
132
        }
133
        currentWidth += tileRect.width();
134
        currentHeight = 0;
135
    }
136
    context->restore();
137
}
138
139
void BitmapImage::checkForSolidColor()
140
{
141
    // FIXME: need to check the RGBA32 buffer to see if it is 1x1.
142
    m_isSolidColor = false;
143
    m_checkedForSolidColor = true;
144
}
145
146
BBitmap* BitmapImage::getBBitmap() const
147
{
148
    return const_cast<BitmapImage*>(this)->frameAtIndex(0);
149
}
150
151
} // namespace WebCore
152

Return to Bug 28130