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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #ifndef GraphicsContext_h | 28 #ifndef GraphicsContext_h |
29 #define GraphicsContext_h | 29 #define GraphicsContext_h |
30 | 30 |
31 #include <memory> | 31 #include <memory> |
32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
33 #include "platform/fonts/Font.h" | 33 #include "platform/fonts/Font.h" |
34 #include "platform/graphics/DashArray.h" | 34 #include "platform/graphics/DashArray.h" |
35 #include "platform/graphics/DrawLooperBuilder.h" | 35 #include "platform/graphics/DrawLooperBuilder.h" |
36 #include "platform/graphics/GraphicsContextState.h" | 36 #include "platform/graphics/GraphicsContextState.h" |
| 37 #include "platform/graphics/HighContrast.h" |
37 #include "platform/graphics/ImageOrientation.h" | 38 #include "platform/graphics/ImageOrientation.h" |
38 #include "platform/graphics/paint/PaintRecord.h" | 39 #include "platform/graphics/paint/PaintRecord.h" |
39 #include "platform/graphics/paint/PaintRecorder.h" | 40 #include "platform/graphics/paint/PaintRecorder.h" |
40 #include "platform/graphics/skia/SkiaUtils.h" | 41 #include "platform/graphics/skia/SkiaUtils.h" |
41 #include "platform/wtf/Allocator.h" | 42 #include "platform/wtf/Allocator.h" |
42 #include "platform/wtf/Forward.h" | 43 #include "platform/wtf/Forward.h" |
43 #include "platform/wtf/Noncopyable.h" | 44 #include "platform/wtf/Noncopyable.h" |
44 #include "third_party/skia/include/core/SkClipOp.h" | 45 #include "third_party/skia/include/core/SkClipOp.h" |
45 #include "third_party/skia/include/core/SkImageFilter.h" | 46 #include "third_party/skia/include/core/SkImageFilter.h" |
46 #include "third_party/skia/include/core/SkMetaData.h" | 47 #include "third_party/skia/include/core/SkMetaData.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool ContextDisabled() const { return disabled_state_; } | 84 bool ContextDisabled() const { return disabled_state_; } |
84 | 85 |
85 // ---------- State management methods ----------------- | 86 // ---------- State management methods ----------------- |
86 void Save(); | 87 void Save(); |
87 void Restore(); | 88 void Restore(); |
88 | 89 |
89 #if DCHECK_IS_ON() | 90 #if DCHECK_IS_ON() |
90 unsigned SaveCount() const; | 91 unsigned SaveCount() const; |
91 #endif | 92 #endif |
92 | 93 |
| 94 void SetHighContrast(const HighContrastSettings&); |
| 95 |
93 float StrokeThickness() const { | 96 float StrokeThickness() const { |
94 return ImmutableState()->GetStrokeData().Thickness(); | 97 return ImmutableState()->GetStrokeData().Thickness(); |
95 } | 98 } |
96 void SetStrokeThickness(float thickness) { | 99 void SetStrokeThickness(float thickness) { |
97 MutableState()->SetStrokeThickness(thickness); | 100 MutableState()->SetStrokeThickness(thickness); |
98 } | 101 } |
99 | 102 |
100 StrokeStyle GetStrokeStyle() const { | 103 StrokeStyle GetStrokeStyle() const { |
101 return ImmutableState()->GetStrokeData().Style(); | 104 return ImmutableState()->GetStrokeData().Style(); |
102 } | 105 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 427 } |
425 } | 428 } |
426 } | 429 } |
427 | 430 |
428 void FillRectWithRoundedHole(const FloatRect&, | 431 void FillRectWithRoundedHole(const FloatRect&, |
429 const FloatRoundedRect& rounded_hole_rect, | 432 const FloatRoundedRect& rounded_hole_rect, |
430 const Color&); | 433 const Color&); |
431 | 434 |
432 const SkMetaData& MetaData() const { return meta_data_; } | 435 const SkMetaData& MetaData() const { return meta_data_; } |
433 | 436 |
| 437 Color ApplyHighContrastFilter(const Color& input) const; |
| 438 PaintFlags ApplyHighContrastFilter(const PaintFlags* input) const; |
| 439 |
434 // null indicates painting is contextDisabled. Never delete this object. | 440 // null indicates painting is contextDisabled. Never delete this object. |
435 PaintCanvas* canvas_; | 441 PaintCanvas* canvas_; |
436 | 442 |
437 PaintController& paint_controller_; | 443 PaintController& paint_controller_; |
438 | 444 |
439 // Paint states stack. The state controls the appearance of drawn content, so | 445 // Paint states stack. The state controls the appearance of drawn content, so |
440 // this stack enables local drawing state changes with save()/restore() calls. | 446 // this stack enables local drawing state changes with save()/restore() calls. |
441 // We do not delete from this stack to avoid memory churn. | 447 // We do not delete from this stack to avoid memory churn. |
442 Vector<std::unique_ptr<GraphicsContextState>> paint_state_stack_; | 448 Vector<std::unique_ptr<GraphicsContextState>> paint_state_stack_; |
443 | 449 |
(...skipping 10 matching lines...) Expand all Loading... |
454 #if DCHECK_IS_ON() | 460 #if DCHECK_IS_ON() |
455 int layer_count_; | 461 int layer_count_; |
456 bool disable_destruction_checks_; | 462 bool disable_destruction_checks_; |
457 bool in_drawing_recorder_; | 463 bool in_drawing_recorder_; |
458 #endif | 464 #endif |
459 | 465 |
460 const DisabledMode disabled_state_; | 466 const DisabledMode disabled_state_; |
461 | 467 |
462 float device_scale_factor_; | 468 float device_scale_factor_; |
463 | 469 |
| 470 sk_sp<SkColorFilter> high_contrast_filter_; |
| 471 |
464 unsigned printing_ : 1; | 472 unsigned printing_ : 1; |
465 unsigned has_meta_data_ : 1; | 473 unsigned has_meta_data_ : 1; |
466 }; | 474 }; |
467 | 475 |
468 } // namespace blink | 476 } // namespace blink |
469 | 477 |
470 #endif // GraphicsContext_h | 478 #endif // GraphicsContext_h |
OLD | NEW |