| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 SkCanvas* canvas() | 80 SkCanvas* canvas() |
| 81 { | 81 { |
| 82 // Flush any pending saves. | 82 // Flush any pending saves. |
| 83 realizeCanvasSave(SkCanvas::kMatrixClip_SaveFlag); | 83 realizeCanvasSave(SkCanvas::kMatrixClip_SaveFlag); |
| 84 | 84 |
| 85 return m_canvas; | 85 return m_canvas; |
| 86 } | 86 } |
| 87 const SkCanvas* canvas() const { return m_canvas; } | 87 const SkCanvas* canvas() const { return m_canvas; } |
| 88 bool paintingDisabled() const { return !m_canvas; } | 88 bool paintingDisabled() const { return !m_canvas; } |
| 89 | 89 |
| 90 const SkBitmap* bitmap() const; | |
| 91 const SkBitmap& layerBitmap(AccessMode = ReadOnly) const; | |
| 92 | |
| 93 // ---------- State management methods ----------------- | 90 // ---------- State management methods ----------------- |
| 94 void save(); | 91 void save(); |
| 95 void restore(); | 92 void restore(); |
| 96 | 93 |
| 97 void saveLayer(const SkRect* bounds, const SkPaint*, SkCanvas::SaveFlags = S
kCanvas::kARGB_ClipLayer_SaveFlag); | 94 void saveLayer(const SkRect* bounds, const SkPaint*, SkCanvas::SaveFlags = S
kCanvas::kARGB_ClipLayer_SaveFlag); |
| 98 void restoreLayer(); | 95 void restoreLayer(); |
| 99 | 96 |
| 100 float strokeThickness() const { return m_paintState->m_strokeData.thickness(
); } | 97 float strokeThickness() const { return m_paintState->m_strokeData.thickness(
); } |
| 101 void setStrokeThickness(float thickness) { mutableState()->m_strokeData.setT
hickness(thickness); } | 98 void setStrokeThickness(float thickness) { mutableState()->m_strokeData.setT
hickness(thickness); } |
| 102 | 99 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void fillRoundedRect(const RoundedRect&, const Color&); | 237 void fillRoundedRect(const RoundedRect&, const Color&); |
| 241 | 238 |
| 242 void clearRect(const FloatRect&); | 239 void clearRect(const FloatRect&); |
| 243 | 240 |
| 244 void strokeRect(const FloatRect&, float lineWidth); | 241 void strokeRect(const FloatRect&, float lineWidth); |
| 245 | 242 |
| 246 void drawDisplayList(DisplayList*); | 243 void drawDisplayList(DisplayList*); |
| 247 | 244 |
| 248 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 245 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 249 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQuali
tyScale = false); | 246 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQuali
tyScale = false); |
| 250 void drawImage(Image*, const IntPoint& destPoint, const IntRect& srcRect, Co
mpositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespec
tImageOrientation); | |
| 251 void drawImage(Image*, const FloatRect& destRect); | 247 void drawImage(Image*, const FloatRect& destRect); |
| 252 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation, bool useLowQualityScale = false); | 248 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation, bool useLowQualityScale = false); |
| 253 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum = DoNotRespe
ctImageOrientation, bool useLowQualityScale = false); | 249 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum = DoNotRespe
ctImageOrientation, bool useLowQualityScale = false); |
| 254 | 250 |
| 255 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin
t, const IntSize& tileSize, | 251 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin
t, const IntSize& tileSize, |
| 256 CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false
, blink::WebBlendMode = blink::WebBlendModeNormal, const IntSize& repeatSpacing
= IntSize()); | 252 CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false
, blink::WebBlendMode = blink::WebBlendModeNormal, const IntSize& repeatSpacing
= IntSize()); |
| 257 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, | 253 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, |
| 258 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch
Tile, Image::TileRule vRule = Image::StretchTile, | 254 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch
Tile, Image::TileRule vRule = Image::StretchTile, |
| 259 CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false
); | 255 CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false
); |
| 260 | 256 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 301 |
| 306 void beginTransparencyLayer(float opacity, const FloatRect* = 0); | 302 void beginTransparencyLayer(float opacity, const FloatRect* = 0); |
| 307 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); | 303 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); |
| 308 void endLayer(); | 304 void endLayer(); |
| 309 | 305 |
| 310 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() | 306 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() |
| 311 // are stored in a display list that can be replayed at a later time. | 307 // are stored in a display list that can be replayed at a later time. |
| 312 void beginRecording(const FloatRect& bounds); | 308 void beginRecording(const FloatRect& bounds); |
| 313 PassRefPtr<DisplayList> endRecording(); | 309 PassRefPtr<DisplayList> endRecording(); |
| 314 | 310 |
| 315 bool hasShadow() const; | |
| 316 void setShadow(const FloatSize& offset, float blur, const Color&, | 311 void setShadow(const FloatSize& offset, float blur, const Color&, |
| 317 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, | 312 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, |
| 318 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha); | 313 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha); |
| 319 void clearShadow() { clearDrawLooper(); } | 314 void clearShadow() { clearDrawLooper(); } |
| 320 | 315 |
| 321 // It is assumed that this draw looper is used only for shadows | 316 // It is assumed that this draw looper is used only for shadows |
| 322 // (i.e. a draw looper is set if and only if there is a shadow). | 317 // (i.e. a draw looper is set if and only if there is a shadow). |
| 323 // The builder passed into this method will be destroyed. | 318 // The builder passed into this method will be destroyed. |
| 324 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); | 319 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); |
| 325 void clearDrawLooper(); | 320 void clearDrawLooper(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 372 |
| 378 private: | 373 private: |
| 379 const GraphicsContextState* immutableState() const { return m_paintState; } | 374 const GraphicsContextState* immutableState() const { return m_paintState; } |
| 380 | 375 |
| 381 GraphicsContextState* mutableState() | 376 GraphicsContextState* mutableState() |
| 382 { | 377 { |
| 383 realizePaintSave(); | 378 realizePaintSave(); |
| 384 return m_paintState; | 379 return m_paintState; |
| 385 } | 380 } |
| 386 | 381 |
| 387 static void addCornerArc(SkPath*, const SkRect&, const IntSize&, int); | |
| 388 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); | 382 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); |
| 389 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); | 383 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); |
| 390 | 384 |
| 391 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); | 385 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); |
| 392 | 386 |
| 393 #if OS(MACOSX) | 387 #if OS(MACOSX) |
| 394 static inline int getFocusRingOutset(int offset) { return offset + 2; } | 388 static inline int getFocusRingOutset(int offset) { return offset + 2; } |
| 395 #else | 389 #else |
| 396 static inline int getFocusRingOutset(int offset) { return 0; } | 390 static inline int getFocusRingOutset(int offset) { return 0; } |
| 397 static const SkPMColor lineColors(int); | 391 static const SkPMColor lineColors(int); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 // FIXME: Make this go away: crbug.com/236892 | 504 // FIXME: Make this go away: crbug.com/236892 |
| 511 bool m_updatingControlTints : 1; | 505 bool m_updatingControlTints : 1; |
| 512 bool m_accelerated : 1; | 506 bool m_accelerated : 1; |
| 513 bool m_isCertainlyOpaque : 1; | 507 bool m_isCertainlyOpaque : 1; |
| 514 bool m_printing : 1; | 508 bool m_printing : 1; |
| 515 }; | 509 }; |
| 516 | 510 |
| 517 } // namespace WebCore | 511 } // namespace WebCore |
| 518 | 512 |
| 519 #endif // GraphicsContext_h | 513 #endif // GraphicsContext_h |
| OLD | NEW |