OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> | 2 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> |
3 * Copyright (C) 2006 Zack Rusin <zack@kde.org> | 3 * Copyright (C) 2006 Zack Rusin <zack@kde.org> |
4 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> | 4 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> |
5 * | 5 * |
6 * All rights reserved. | 6 * All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 PassRefPtr<Image> Image::loadPlatformResource(const char* name) | 90 PassRefPtr<Image> Image::loadPlatformResource(const char* name) |
91 { | 91 { |
92 return StillImage::create(loadResourcePixmap(name)); | 92 return StillImage::create(loadResourcePixmap(name)); |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
TransformationMatrix& patternTransform, | 96 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
TransformationMatrix& patternTransform, |
97 const FloatPoint& phase, CompositeOperator op, const Flo
atRect& destRect) | 97 const FloatPoint& phase, CompositeOperator op, const Flo
atRect& destRect) |
98 { | 98 { |
99 notImplemented(); | 99 QPixmap* framePixmap = nativeImageForCurrentFrame(); |
| 100 if (!framePixmap) // If it's too early we won't have an image yet. |
| 101 return; |
| 102 |
| 103 QPixmap pixmap = *framePixmap; |
| 104 QRect tr = QRectF(tileRect).toRect(); |
| 105 if (tr.x() || tr.y() || tr.width() != pixmap.width() || tr.height() != pixma
p.height()) { |
| 106 pixmap = pixmap.copy(tr); |
| 107 } |
| 108 |
| 109 QBrush b(pixmap); |
| 110 b.setMatrix(patternTransform); |
| 111 ctxt->save(); |
| 112 ctxt->setCompositeOperation(op); |
| 113 QPainter* p = ctxt->platformContext(); |
| 114 p->setBrushOrigin(phase); |
| 115 p->fillRect(destRect, b); |
| 116 ctxt->restore(); |
100 } | 117 } |
101 | 118 |
102 void BitmapImage::initPlatformData() | 119 void BitmapImage::initPlatformData() |
103 { | 120 { |
104 } | 121 } |
105 | 122 |
106 void BitmapImage::invalidatePlatformData() | 123 void BitmapImage::invalidatePlatformData() |
107 { | 124 { |
108 } | 125 } |
109 | 126 |
(...skipping 21 matching lines...) Expand all Loading... |
131 | 148 |
132 QPainter* painter(ctxt->platformContext()); | 149 QPainter* painter(ctxt->platformContext()); |
133 | 150 |
134 // Test using example site at | 151 // Test using example site at |
135 // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html | 152 // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html |
136 painter->drawPixmap(dst, *image, src); | 153 painter->drawPixmap(dst, *image, src); |
137 | 154 |
138 ctxt->restore(); | 155 ctxt->restore(); |
139 } | 156 } |
140 | 157 |
141 void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect,
const TransformationMatrix& patternTransform, | |
142 const FloatPoint& phase, CompositeOperator op, con
st FloatRect& destRect) | |
143 { | |
144 QPixmap* framePixmap = nativeImageForCurrentFrame(); | |
145 if (!framePixmap) // If it's too early we won't have an image yet. | |
146 return; | |
147 | |
148 QPixmap pixmap = *framePixmap; | |
149 QRect tr = QRectF(tileRect).toRect(); | |
150 if (tr.x() || tr.y() || tr.width() != pixmap.width() || tr.height() != pixma
p.height()) { | |
151 pixmap = pixmap.copy(tr); | |
152 } | |
153 | |
154 QBrush b(pixmap); | |
155 b.setMatrix(patternTransform); | |
156 ctxt->save(); | |
157 ctxt->setCompositeOperation(op); | |
158 QPainter* p = ctxt->platformContext(); | |
159 p->setBrushOrigin(phase); | |
160 p->fillRect(destRect, b); | |
161 ctxt->restore(); | |
162 } | |
163 | |
164 void BitmapImage::checkForSolidColor() | 158 void BitmapImage::checkForSolidColor() |
165 { | 159 { |
166 // FIXME: It's easy to implement this optimization. Just need to check the R
GBA32 buffer to see if it is 1x1. | 160 // FIXME: It's easy to implement this optimization. Just need to check the R
GBA32 buffer to see if it is 1x1. |
167 m_isSolidColor = false; | 161 m_isSolidColor = false; |
168 } | 162 } |
169 | 163 |
170 } | 164 } |
171 | 165 |
172 | 166 |
173 // vim: ts=4 sw=4 et | 167 // vim: ts=4 sw=4 et |
OLD | NEW |