| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 void didDrawRect(const SkRect&, const SkPaint&, const SkBitmap* = 0); | 303 void didDrawRect(const SkRect&, const SkPaint&, const SkBitmap* = 0); |
| 304 void drawRect(const SkRect&, const SkPaint&); | 304 void drawRect(const SkRect&, const SkPaint&); |
| 305 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c
onst SkRect& textRect, const SkPaint&); | 305 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c
onst SkRect& textRect, const SkPaint&); |
| 306 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[]
, SkScalar constY, const SkRect& textRect, const SkPaint&); | 306 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[]
, SkScalar constY, const SkRect& textRect, const SkPaint&); |
| 307 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&); | 307 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&); |
| 308 | 308 |
| 309 void clip(const IntRect& rect) { clipRect(rect); } | 309 void clip(const IntRect& rect) { clipRect(rect); } |
| 310 void clip(const FloatRect& rect) { clipRect(rect); } | 310 void clip(const FloatRect& rect) { clipRect(rect); } |
| 311 void clipRoundedRect(const RoundedRect&, SkRegion::Op = SkRegion::kIntersect
_Op); | 311 void clipRoundedRect(const RoundedRect&, SkRegion::Op = SkRegion::kIntersect
_Op); |
| 312 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion:
:kDifference_Op); } | 312 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion:
:kDifference_Op); } |
| 313 void clipOut(const Path&); |
| 313 void clipOutRoundedRect(const RoundedRect&); | 314 void clipOutRoundedRect(const RoundedRect&); |
| 314 void clipPath(const Path&, WindRule = RULE_EVENODD); | 315 void clipPath(const Path&, WindRule = RULE_EVENODD); |
| 315 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias =
true); | 316 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias =
true); |
| 316 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 317 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
| 318 // This clip function is used only by <canvas> code. It allows |
| 319 // implementations to handle clipping on the canvas differently since |
| 320 // the discipline is different. |
| 321 void canvasClip(const Path&, WindRule = RULE_EVENODD); |
| 317 | 322 |
| 318 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); | 323 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); |
| 319 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr
ing& mark, const FloatPoint&); | 324 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr
ing& mark, const FloatPoint&); |
| 320 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); | 325 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F
ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); |
| 321 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); | 326 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in
t h, const Color& backgroundColor, int from = 0, int to = -1); |
| 322 | 327 |
| 323 void drawLineForText(const FloatPoint&, float width, bool printing); | 328 void drawLineForText(const FloatPoint&, float width, bool printing); |
| 324 enum DocumentMarkerLineStyle { | 329 enum DocumentMarkerLineStyle { |
| 325 DocumentMarkerSpellingLineStyle, | 330 DocumentMarkerSpellingLineStyle, |
| 326 DocumentMarkerGrammarLineStyle | 331 DocumentMarkerGrammarLineStyle |
| 327 }; | 332 }; |
| 328 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); | 333 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke
rLineStyle); |
| 329 | 334 |
| 330 void beginTransparencyLayer(float opacity, const FloatRect* = 0); | 335 void beginTransparencyLayer(float opacity, const FloatRect* = 0); |
| 331 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); | 336 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo
rFilter = ColorFilterNone, ImageFilter* = 0); |
| 332 void endLayer(); | 337 void endLayer(); |
| 333 | 338 |
| 334 void beginCull(const FloatRect&); | 339 void beginCull(const FloatRect&); |
| 335 void endCull(); | 340 void endCull(); |
| 336 | 341 |
| 337 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() | 342 // Instead of being dispatched to the active canvas, draw commands following
beginRecording() |
| 338 // are stored in a display list that can be replayed at a later time. | 343 // are stored in a display list that can be replayed at a later time. |
| 339 void beginRecording(const FloatRect& bounds); | 344 void beginRecording(PassRefPtr<DisplayList>, uint32_t = 0); |
| 340 PassRefPtr<DisplayList> endRecording(); | 345 void endRecording(); |
| 341 | 346 |
| 342 bool hasShadow() const; | 347 bool hasShadow() const; |
| 343 void setShadow(const FloatSize& offset, float blur, const Color&, | 348 void setShadow(const FloatSize& offset, float blur, const Color&, |
| 344 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, | 349 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, |
| 345 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha); | 350 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha); |
| 346 void clearShadow() { clearDrawLooper(); } | 351 void clearShadow() { clearDrawLooper(); } |
| 347 | 352 |
| 348 // It is assumed that this draw looper is used only for shadows | 353 // It is assumed that this draw looper is used only for shadows |
| 349 // (i.e. a draw looper is set if and only if there is a shadow). | 354 // (i.e. a draw looper is set if and only if there is a shadow). |
| 350 // The builder passed into this method will be destroyed. | 355 // The builder passed into this method will be destroyed. |
| 351 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); | 356 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); |
| 352 void clearDrawLooper(); | 357 void clearDrawLooper(); |
| 353 | 358 |
| 354 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo
r&); | 359 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo
r&); |
| 355 void drawFocusRing(const Path&, int width, int offset, const Color&); | 360 void drawFocusRing(const Path&, int width, int offset, const Color&); |
| 356 | 361 |
| 357 enum Edge { | 362 enum Edge { |
| 358 NoEdge = 0, | 363 NoEdge = 0, |
| 359 TopEdge = 1 << 1, | 364 TopEdge = 1 << 1, |
| 360 RightEdge = 1 << 2, | 365 RightEdge = 1 << 2, |
| 361 BottomEdge = 1 << 3, | 366 BottomEdge = 1 << 3, |
| 362 LeftEdge = 1 << 4 | 367 LeftEdge = 1 << 4 |
| 363 }; | 368 }; |
| 364 typedef unsigned Edges; | 369 typedef unsigned Edges; |
| 365 void drawInnerShadow(const RoundedRect&, const Color& shadowColor, const Int
Size shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge
); | 370 void drawInnerShadow(const RoundedRect&, const Color& shadowColor, const Int
Size shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge
); |
| 366 | 371 |
| 367 // This clip function is used only by <canvas> code. It allows | |
| 368 // implementations to handle clipping on the canvas differently since | |
| 369 // the discipline is different. | |
| 370 void canvasClip(const Path&, WindRule = RULE_EVENODD); | |
| 371 void clipOut(const Path&); | |
| 372 | |
| 373 // ---------- Transformation methods ----------------- | 372 // ---------- Transformation methods ----------------- |
| 374 // Note that the getCTM method returns only the current transform from Blink
's perspective, | 373 // Note that the getCTM method returns only the current transform from Blink
's perspective, |
| 375 // which is not the final transform used to place content on screen. It cann
ot be relied upon | 374 // which is not the final transform used to place content on screen. It cann
ot be relied upon |
| 376 // for testing where a point will appear on screen or how large it will be. | 375 // for testing where a point will appear on screen or how large it will be. |
| 377 AffineTransform getCTM() const; | 376 AffineTransform getCTM() const; |
| 378 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } | 377 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } |
| 379 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } | 378 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } |
| 380 void setMatrix(const SkMatrix&); | 379 void setMatrix(const SkMatrix&); |
| 381 | 380 |
| 382 void scale(float x, float y); | 381 void scale(float x, float y); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 static const SkPMColor antiColors2(int); | 440 static const SkPMColor antiColors2(int); |
| 442 static void draw1xMarker(SkBitmap*, int); | 441 static void draw1xMarker(SkBitmap*, int); |
| 443 static void draw2xMarker(SkBitmap*, int); | 442 static void draw2xMarker(SkBitmap*, int); |
| 444 #endif | 443 #endif |
| 445 | 444 |
| 446 // Helpers for drawing a focus ring (drawFocusRing) | 445 // Helpers for drawing a focus ring (drawFocusRing) |
| 447 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; | 446 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; |
| 448 void drawFocusRingPath(const SkPath&, const Color&, int width); | 447 void drawFocusRingPath(const SkPath&, const Color&, int width); |
| 449 void drawFocusRingRect(const SkRect&, const Color&, int width); | 448 void drawFocusRingRect(const SkRect&, const Color&, int width); |
| 450 | 449 |
| 451 | |
| 452 // SkCanvas wrappers. | 450 // SkCanvas wrappers. |
| 453 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); | 451 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op
= SkRegion::kIntersect_Op); |
| 454 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); | 452 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion::
Op = SkRegion::kIntersect_Op); |
| 455 void concat(const SkMatrix&); | 453 void concat(const SkMatrix&); |
| 456 void drawRRect(const SkRRect&, const SkPaint&); | 454 void drawRRect(const SkRRect&, const SkPaint&); |
| 457 | 455 |
| 458 // Apply deferred paint state saves | 456 // Apply deferred paint state saves |
| 459 void realizePaintSave() | 457 void realizePaintSave() |
| 460 { | 458 { |
| 461 if (contextDisabled()) | 459 if (contextDisabled()) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 bool m_accelerated : 1; | 535 bool m_accelerated : 1; |
| 538 bool m_isCertainlyOpaque : 1; | 536 bool m_isCertainlyOpaque : 1; |
| 539 bool m_printing : 1; | 537 bool m_printing : 1; |
| 540 bool m_antialiasHairlineImages : 1; | 538 bool m_antialiasHairlineImages : 1; |
| 541 bool m_shouldSmoothFonts : 1; | 539 bool m_shouldSmoothFonts : 1; |
| 542 }; | 540 }; |
| 543 | 541 |
| 544 } // namespace blink | 542 } // namespace blink |
| 545 | 543 |
| 546 #endif // GraphicsContext_h | 544 #endif // GraphicsContext_h |
| OLD | NEW |