|
Lines 97-108
struct PlatformContextSkia::State {
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec1
|
| 97 |
// color to produce a new output color. |
97 |
// color to produce a new output color. |
| 98 |
SkColor applyAlpha(SkColor) const; |
98 |
SkColor applyAlpha(SkColor) const; |
| 99 |
|
99 |
|
| 100 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 101 |
// If non-empty, the current State is clipped to this image. |
100 |
// If non-empty, the current State is clipped to this image. |
| 102 |
SkBitmap m_imageBufferClip; |
101 |
SkBitmap m_imageBufferClip; |
| 103 |
// If m_imageBufferClip is non-empty, this is the region the image is clipped to. |
102 |
// If m_imageBufferClip is non-empty, this is the region the image is clipped to. |
| 104 |
FloatRect m_clip; |
103 |
FloatRect m_clip; |
| 105 |
#endif |
|
|
| 106 |
|
104 |
|
| 107 |
// This is a list of clipping paths which are currently active, in the |
105 |
// This is a list of clipping paths which are currently active, in the |
| 108 |
// order in which they were pushed. |
106 |
// order in which they were pushed. |
|
Lines 154-163
PlatformContextSkia::State::State(const State& other)
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec2
|
| 154 |
, m_lineJoin(other.m_lineJoin) |
152 |
, m_lineJoin(other.m_lineJoin) |
| 155 |
, m_dash(other.m_dash) |
153 |
, m_dash(other.m_dash) |
| 156 |
, m_textDrawingMode(other.m_textDrawingMode) |
154 |
, m_textDrawingMode(other.m_textDrawingMode) |
| 157 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 158 |
, m_imageBufferClip(other.m_imageBufferClip) |
155 |
, m_imageBufferClip(other.m_imageBufferClip) |
| 159 |
, m_clip(other.m_clip) |
156 |
, m_clip(other.m_clip) |
| 160 |
#endif |
|
|
| 161 |
, m_antiAliasClipPaths(other.m_antiAliasClipPaths) |
157 |
, m_antiAliasClipPaths(other.m_antiAliasClipPaths) |
| 162 |
, m_interpolationQuality(other.m_interpolationQuality) |
158 |
, m_interpolationQuality(other.m_interpolationQuality) |
| 163 |
{ |
159 |
{ |
|
Lines 204-212
SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec3
|
| 204 |
// Danger: canvas can be NULL. |
200 |
// Danger: canvas can be NULL. |
| 205 |
PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas) |
201 |
PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas) |
| 206 |
: m_canvas(canvas) |
202 |
: m_canvas(canvas) |
| 207 |
#if OS(WINDOWS) |
|
|
| 208 |
, m_drawingToImageBuffer(false) |
203 |
, m_drawingToImageBuffer(false) |
| 209 |
#endif |
|
|
| 210 |
, m_useGPU(false) |
204 |
, m_useGPU(false) |
| 211 |
, m_gpuCanvas(0) |
205 |
, m_gpuCanvas(0) |
| 212 |
, m_backingStoreState(None) |
206 |
, m_backingStoreState(None) |
|
Lines 226-232
void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas)
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec4
|
| 226 |
m_canvas = canvas; |
220 |
m_canvas = canvas; |
| 227 |
} |
221 |
} |
| 228 |
|
222 |
|
| 229 |
#if OS(WINDOWS) |
|
|
| 230 |
void PlatformContextSkia::setDrawingToImageBuffer(bool value) |
223 |
void PlatformContextSkia::setDrawingToImageBuffer(bool value) |
| 231 |
{ |
224 |
{ |
| 232 |
m_drawingToImageBuffer = value; |
225 |
m_drawingToImageBuffer = value; |
|
Lines 236-242
bool PlatformContextSkia::isDrawingToImageBuffer() const
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec5
|
| 236 |
{ |
229 |
{ |
| 237 |
return m_drawingToImageBuffer; |
230 |
return m_drawingToImageBuffer; |
| 238 |
} |
231 |
} |
| 239 |
#endif |
|
|
| 240 |
|
232 |
|
| 241 |
void PlatformContextSkia::save() |
233 |
void PlatformContextSkia::save() |
| 242 |
{ |
234 |
{ |
|
Lines 245-261
void PlatformContextSkia::save()
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec6
|
| 245 |
m_stateStack.append(m_state->cloneInheritedProperties()); |
237 |
m_stateStack.append(m_state->cloneInheritedProperties()); |
| 246 |
m_state = &m_stateStack.last(); |
238 |
m_state = &m_stateStack.last(); |
| 247 |
|
239 |
|
| 248 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 249 |
// The clip image only needs to be applied once. Reset the image so that we |
240 |
// The clip image only needs to be applied once. Reset the image so that we |
| 250 |
// don't attempt to clip multiple times. |
241 |
// don't attempt to clip multiple times. |
| 251 |
m_state->m_imageBufferClip.reset(); |
242 |
m_state->m_imageBufferClip.reset(); |
| 252 |
#endif |
|
|
| 253 |
|
243 |
|
| 254 |
// Save our native canvas. |
244 |
// Save our native canvas. |
| 255 |
canvas()->save(); |
245 |
canvas()->save(); |
| 256 |
} |
246 |
} |
| 257 |
|
247 |
|
| 258 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 259 |
void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect, |
248 |
void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect, |
| 260 |
const ImageBuffer* imageBuffer) |
249 |
const ImageBuffer* imageBuffer) |
| 261 |
{ |
250 |
{ |
|
Lines 284-290
void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec7
|
| 284 |
m_state->m_imageBufferClip = *bitmap; |
273 |
m_state->m_imageBufferClip = *bitmap; |
| 285 |
} |
274 |
} |
| 286 |
} |
275 |
} |
| 287 |
#endif |
|
|
| 288 |
|
276 |
|
| 289 |
void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath) |
277 |
void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath) |
| 290 |
{ |
278 |
{ |
|
Lines 303-314
void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec8
|
| 303 |
|
291 |
|
| 304 |
void PlatformContextSkia::restore() |
292 |
void PlatformContextSkia::restore() |
| 305 |
{ |
293 |
{ |
| 306 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 307 |
if (!m_state->m_imageBufferClip.empty()) { |
294 |
if (!m_state->m_imageBufferClip.empty()) { |
| 308 |
applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip); |
295 |
applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip); |
| 309 |
canvas()->restore(); |
296 |
canvas()->restore(); |
| 310 |
} |
297 |
} |
| 311 |
#endif |
|
|
| 312 |
|
298 |
|
| 313 |
if (!m_state->m_antiAliasClipPaths.isEmpty()) |
299 |
if (!m_state->m_antiAliasClipPaths.isEmpty()) |
| 314 |
applyAntiAliasedClipPaths(m_state->m_antiAliasClipPaths); |
300 |
applyAntiAliasedClipPaths(m_state->m_antiAliasClipPaths); |
|
Lines 627-633
bool PlatformContextSkia::hasImageResamplingHint() const
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec9
|
| 627 |
return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty(); |
613 |
return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty(); |
| 628 |
} |
614 |
} |
| 629 |
|
615 |
|
| 630 |
#if OS(LINUX) || OS(WINDOWS) |
|
|
| 631 |
void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitmap& imageBuffer) |
616 |
void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitmap& imageBuffer) |
| 632 |
{ |
617 |
{ |
| 633 |
// NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we |
618 |
// NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we |
|
Lines 636-642
void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitm
a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp_sec10
|
| 636 |
paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
621 |
paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 637 |
m_canvas->drawBitmap(imageBuffer, SkFloatToScalar(rect.x()), SkFloatToScalar(rect.y()), &paint); |
622 |
m_canvas->drawBitmap(imageBuffer, SkFloatToScalar(rect.x()), SkFloatToScalar(rect.y()), &paint); |
| 638 |
} |
623 |
} |
| 639 |
#endif |
|
|
| 640 |
|
624 |
|
| 641 |
void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths) |
625 |
void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths) |
| 642 |
{ |
626 |
{ |