| 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 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef GraphicsContext_h | 28 #ifndef GraphicsContext_h |
| 29 #define GraphicsContext_h | 29 #define GraphicsContext_h |
| 30 | 30 |
| 31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 32 #include "platform/fonts/Font.h" | 32 #include "platform/fonts/Font.h" |
| 33 #include "platform/geometry/FloatRect.h" | 33 #include "platform/geometry/FloatRect.h" |
| 34 #include "platform/geometry/FloatRoundedRect.h" |
| 34 #include "platform/graphics/DashArray.h" | 35 #include "platform/graphics/DashArray.h" |
| 35 #include "platform/graphics/DrawLooperBuilder.h" | 36 #include "platform/graphics/DrawLooperBuilder.h" |
| 36 #include "platform/graphics/ImageBufferSurface.h" | 37 #include "platform/graphics/ImageBufferSurface.h" |
| 37 #include "platform/graphics/ImageFilter.h" | 38 #include "platform/graphics/ImageFilter.h" |
| 38 #include "platform/graphics/ImageOrientation.h" | 39 #include "platform/graphics/ImageOrientation.h" |
| 39 #include "platform/graphics/GraphicsContextAnnotation.h" | 40 #include "platform/graphics/GraphicsContextAnnotation.h" |
| 40 #include "platform/graphics/GraphicsContextState.h" | 41 #include "platform/graphics/GraphicsContextState.h" |
| 41 #include "platform/graphics/RegionTracker.h" | 42 #include "platform/graphics/RegionTracker.h" |
| 42 #include "platform/graphics/skia/SkiaUtils.h" | 43 #include "platform/graphics/skia/SkiaUtils.h" |
| 43 #include "wtf/FastAllocBase.h" | 44 #include "wtf/FastAllocBase.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 244 |
| 244 void fillPath(const Path&); | 245 void fillPath(const Path&); |
| 245 void strokePath(const Path&); | 246 void strokePath(const Path&); |
| 246 | 247 |
| 247 void fillEllipse(const FloatRect&); | 248 void fillEllipse(const FloatRect&); |
| 248 void strokeEllipse(const FloatRect&); | 249 void strokeEllipse(const FloatRect&); |
| 249 | 250 |
| 250 void fillRect(const FloatRect&); | 251 void fillRect(const FloatRect&); |
| 251 void fillRect(const FloatRect&, const Color&); | 252 void fillRect(const FloatRect&, const Color&); |
| 252 void fillRect(const FloatRect&, const Color&, CompositeOperator); | 253 void fillRect(const FloatRect&, const Color&, CompositeOperator); |
| 253 void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize&
topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&); | 254 void fillRoundedRect(const FloatRect&, const FloatSize& topLeft, const Float
Size& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const
Color&); |
| 254 void fillRoundedRect(const RoundedRect&, const Color&); | 255 void fillRoundedRect(const FloatRoundedRect&, const Color&); |
| 255 | 256 |
| 256 void clearRect(const FloatRect&); | 257 void clearRect(const FloatRect&); |
| 257 | 258 |
| 258 void strokeRect(const FloatRect&); | 259 void strokeRect(const FloatRect&); |
| 259 void strokeRect(const FloatRect&, float lineWidth); | 260 void strokeRect(const FloatRect&, float lineWidth); |
| 260 | 261 |
| 261 void fillBetweenRoundedRects(const IntRect&, const IntSize& outerTopLeft, co
nst IntSize& outerTopRight, const IntSize& outerBottomLeft, const IntSize& outer
BottomRight, | 262 void fillBetweenRoundedRects(const FloatRect&, const FloatSize& outerTopLeft
, const FloatSize& outerTopRight, const FloatSize& outerBottomLeft, const FloatS
ize& outerBottomRight, |
| 262 const IntRect&, const IntSize& innerTopLeft, const IntSize& innerTopRigh
t, const IntSize& innerBottomLeft, const IntSize& innerBottomRight, const Color&
); | 263 const FloatRect&, const FloatSize& innerTopLeft, const FloatSize& innerT
opRight, const FloatSize& innerBottomLeft, const FloatSize& innerBottomRight, co
nst Color&); |
| 263 void fillBetweenRoundedRects(const RoundedRect&, const RoundedRect&, const C
olor&); | 264 void fillBetweenRoundedRects(const FloatRoundedRect&, const FloatRoundedRect
&, const Color&); |
| 264 | 265 |
| 265 void drawPicture(const SkPicture*); | 266 void drawPicture(const SkPicture*); |
| 266 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr
c, CompositeOperator, WebBlendMode); | 267 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr
c, CompositeOperator, WebBlendMode); |
| 267 | 268 |
| 268 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 269 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 269 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 270 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 270 void drawImage(Image*, const FloatRect& destRect); | 271 void drawImage(Image*, const FloatRect& destRect); |
| 271 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation); | 272 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation); |
| 272 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, WebBlendMode, RespectImageOrientationEnum = DoNotRespectImage
Orientation); | 273 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, WebBlendMode, RespectImageOrientationEnum = DoNotRespectImage
Orientation); |
| 273 | 274 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 286 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP
aint* = 0); | 287 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP
aint* = 0); |
| 287 void drawOval(const SkRect&, const SkPaint&); | 288 void drawOval(const SkRect&, const SkPaint&); |
| 288 void drawPath(const SkPath&, const SkPaint&); | 289 void drawPath(const SkPath&, const SkPaint&); |
| 289 void drawRect(const SkRect&, const SkPaint&); | 290 void drawRect(const SkRect&, const SkPaint&); |
| 290 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c
onst SkRect& textRect, const SkPaint&); | 291 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c
onst SkRect& textRect, const SkPaint&); |
| 291 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[]
, SkScalar constY, const SkRect& textRect, const SkPaint&); | 292 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[]
, SkScalar constY, const SkRect& textRect, const SkPaint&); |
| 292 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&); | 293 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&); |
| 293 | 294 |
| 294 void clip(const IntRect& rect) { clipRect(rect); } | 295 void clip(const IntRect& rect) { clipRect(rect); } |
| 295 void clip(const FloatRect& rect) { clipRect(rect); } | 296 void clip(const FloatRect& rect) { clipRect(rect); } |
| 296 void clipRoundedRect(const RoundedRect&, SkRegion::Op = SkRegion::kIntersect
_Op); | 297 void clipRoundedRect(const FloatRoundedRect&, SkRegion::Op = SkRegion::kInte
rsect_Op); |
| 297 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion:
:kDifference_Op); } | 298 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion:
:kDifference_Op); } |
| 299 void clipOut(const FloatRect& rect) { clipRect(rect, NotAntiAliased, SkRegio
n::kDifference_Op); } |
| 298 void clipOut(const Path&); | 300 void clipOut(const Path&); |
| 299 void clipOutRoundedRect(const RoundedRect&); | 301 void clipOutRoundedRect(const FloatRoundedRect&); |
| 300 void clipPath(const Path&, WindRule = RULE_EVENODD, AntiAliasingMode = AntiA
liased); | 302 void clipPath(const Path&, WindRule = RULE_EVENODD, AntiAliasingMode = AntiA
liased); |
| 301 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 303 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
| 302 void clipPolygon(size_t numPoints, const FloatPoint*, bool antialias); | 304 void clipPolygon(size_t numPoints, const FloatPoint*, bool antialias); |
| 303 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 305 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
| 304 | 306 |
| 305 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); | 307 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); |
| 306 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr
ing& mark, const FloatPoint&); | 308 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr
ing& mark, const FloatPoint&); |
| 307 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); | 309 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); |
| 308 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); | 310 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); |
| 309 | 311 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void drawFocusRing(const Path&, int width, int offset, const Color&); | 345 void drawFocusRing(const Path&, int width, int offset, const Color&); |
| 344 | 346 |
| 345 enum Edge { | 347 enum Edge { |
| 346 NoEdge = 0, | 348 NoEdge = 0, |
| 347 TopEdge = 1 << 1, | 349 TopEdge = 1 << 1, |
| 348 RightEdge = 1 << 2, | 350 RightEdge = 1 << 2, |
| 349 BottomEdge = 1 << 3, | 351 BottomEdge = 1 << 3, |
| 350 LeftEdge = 1 << 4 | 352 LeftEdge = 1 << 4 |
| 351 }; | 353 }; |
| 352 typedef unsigned Edges; | 354 typedef unsigned Edges; |
| 353 void drawInnerShadow(const RoundedRect&, const Color& shadowColor, const Int
Size shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge
); | 355 void drawInnerShadow(const FloatRoundedRect&, const Color& shadowColor, cons
t IntSize shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = N
oEdge); |
| 354 | 356 |
| 355 // ---------- Transformation methods ----------------- | 357 // ---------- Transformation methods ----------------- |
| 356 // Note that the getCTM method returns only the current transform from Blink
's perspective, | 358 // Note that the getCTM method returns only the current transform from Blink
's perspective, |
| 357 // which is not the final transform used to place content on screen. It cann
ot be relied upon | 359 // which is not the final transform used to place content on screen. It cann
ot be relied upon |
| 358 // for testing where a point will appear on screen or how large it will be. | 360 // for testing where a point will appear on screen or how large it will be. |
| 359 AffineTransform getCTM() const; | 361 AffineTransform getCTM() const; |
| 360 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } | 362 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } |
| 361 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } | 363 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } |
| 362 void setMatrix(const SkMatrix&); | 364 void setMatrix(const SkMatrix&); |
| 363 | 365 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 private: | 420 private: |
| 419 const GraphicsContextState* immutableState() const { return m_paintState; } | 421 const GraphicsContextState* immutableState() const { return m_paintState; } |
| 420 | 422 |
| 421 GraphicsContextState* mutableState() | 423 GraphicsContextState* mutableState() |
| 422 { | 424 { |
| 423 realizePaintSave(); | 425 realizePaintSave(); |
| 424 return m_paintState; | 426 return m_paintState; |
| 425 } | 427 } |
| 426 | 428 |
| 427 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); | 429 static void setPathFromPoints(SkPath*, size_t, const FloatPoint*); |
| 428 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); | 430 static void setRadii(SkVector*, FloatSize, FloatSize, FloatSize, FloatSize); |
| 429 | 431 |
| 430 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); | 432 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); |
| 431 | 433 |
| 432 #if OS(MACOSX) | 434 #if OS(MACOSX) |
| 433 static inline int focusRingOutset(int offset) { return offset + 2; } | 435 static inline int focusRingOutset(int offset) { return offset + 2; } |
| 434 static inline int focusRingWidth(int width) { return width; } | 436 static inline int focusRingWidth(int width) { return width; } |
| 435 #else | 437 #else |
| 436 static inline int focusRingOutset(int offset) { return 0; } | 438 static inline int focusRingOutset(int offset) { return 0; } |
| 437 static inline int focusRingWidth(int width) { return 1; } | 439 static inline int focusRingWidth(int width) { return 1; } |
| 438 static SkPMColor lineColors(int); | 440 static SkPMColor lineColors(int); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } else { | 476 } else { |
| 475 GraphicsContextState* priorPaintState = m_paintState; | 477 GraphicsContextState* priorPaintState = m_paintState; |
| 476 m_paintState = m_paintStateStack[m_paintStateIndex].get(); | 478 m_paintState = m_paintStateStack[m_paintStateIndex].get(); |
| 477 m_paintState->copy(*priorPaintState); | 479 m_paintState->copy(*priorPaintState); |
| 478 } | 480 } |
| 479 } | 481 } |
| 480 } | 482 } |
| 481 | 483 |
| 482 void didDrawTextInRect(const SkRect& textRect); | 484 void didDrawTextInRect(const SkRect& textRect); |
| 483 | 485 |
| 484 void fillRectWithRoundedHole(const IntRect&, const RoundedRect& roundedHoleR
ect, const Color&); | 486 void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& round
edHoleRect, const Color&); |
| 485 | 487 |
| 486 bool isRecording() const; | 488 bool isRecording() const; |
| 487 | 489 |
| 488 // null indicates painting is contextDisabled. Never delete this object. | 490 // null indicates painting is contextDisabled. Never delete this object. |
| 489 SkCanvas* m_canvas; | 491 SkCanvas* m_canvas; |
| 490 | 492 |
| 491 // This being null indicates not to paint into a DisplayItemList, and instea
d directly into the canvas. | 493 // This being null indicates not to paint into a DisplayItemList, and instea
d directly into the canvas. |
| 492 DisplayItemList* m_displayItemList; | 494 DisplayItemList* m_displayItemList; |
| 493 | 495 |
| 494 ClipRecorderStack* m_clipRecorderStack; | 496 ClipRecorderStack* m_clipRecorderStack; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 unsigned m_accelerated : 1; | 531 unsigned m_accelerated : 1; |
| 530 unsigned m_isCertainlyOpaque : 1; | 532 unsigned m_isCertainlyOpaque : 1; |
| 531 unsigned m_printing : 1; | 533 unsigned m_printing : 1; |
| 532 unsigned m_antialiasHairlineImages : 1; | 534 unsigned m_antialiasHairlineImages : 1; |
| 533 unsigned m_shouldSmoothFonts : 1; | 535 unsigned m_shouldSmoothFonts : 1; |
| 534 }; | 536 }; |
| 535 | 537 |
| 536 } // namespace blink | 538 } // namespace blink |
| 537 | 539 |
| 538 #endif // GraphicsContext_h | 540 #endif // GraphicsContext_h |
| OLD | NEW |