Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.h

Issue 2878573003: Initial skeleton of high-contrast mode. (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/HighContrastSettings.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 28 matching lines...) Expand all
75 76
76 ~GraphicsContext(); 77 ~GraphicsContext();
77 78
78 PaintCanvas* Canvas() { return canvas_; } 79 PaintCanvas* Canvas() { return canvas_; }
79 const PaintCanvas* Canvas() const { return canvas_; } 80 const PaintCanvas* Canvas() const { return canvas_; }
80 81
81 PaintController& GetPaintController() { return paint_controller_; } 82 PaintController& GetPaintController() { return paint_controller_; }
82 83
83 bool ContextDisabled() const { return disabled_state_; } 84 bool ContextDisabled() const { return disabled_state_; }
84 85
86 const HighContrastSettings& high_contrast_settings() {
87 return high_contrast_settings_;
88 }
89
85 // ---------- State management methods ----------------- 90 // ---------- State management methods -----------------
86 void Save(); 91 void Save();
87 void Restore(); 92 void Restore();
88 93
89 #if DCHECK_IS_ON() 94 #if DCHECK_IS_ON()
90 unsigned SaveCount() const; 95 unsigned SaveCount() const;
91 #endif 96 #endif
92 97
98 void SetHighContrast(const HighContrastSettings&);
99
93 float StrokeThickness() const { 100 float StrokeThickness() const {
94 return ImmutableState()->GetStrokeData().Thickness(); 101 return ImmutableState()->GetStrokeData().Thickness();
95 } 102 }
96 void SetStrokeThickness(float thickness) { 103 void SetStrokeThickness(float thickness) {
97 MutableState()->SetStrokeThickness(thickness); 104 MutableState()->SetStrokeThickness(thickness);
98 } 105 }
99 106
100 StrokeStyle GetStrokeStyle() const { 107 StrokeStyle GetStrokeStyle() const {
101 return ImmutableState()->GetStrokeData().Style(); 108 return ImmutableState()->GetStrokeData().Style();
102 } 109 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 431 }
425 } 432 }
426 } 433 }
427 434
428 void FillRectWithRoundedHole(const FloatRect&, 435 void FillRectWithRoundedHole(const FloatRect&,
429 const FloatRoundedRect& rounded_hole_rect, 436 const FloatRoundedRect& rounded_hole_rect,
430 const Color&); 437 const Color&);
431 438
432 const SkMetaData& MetaData() const { return meta_data_; } 439 const SkMetaData& MetaData() const { return meta_data_; }
433 440
441 Color ApplyHighContrastFilter(const Color& input) const;
442 PaintFlags ApplyHighContrastFilter(const PaintFlags* input) const;
443
434 // null indicates painting is contextDisabled. Never delete this object. 444 // null indicates painting is contextDisabled. Never delete this object.
435 PaintCanvas* canvas_; 445 PaintCanvas* canvas_;
436 446
437 PaintController& paint_controller_; 447 PaintController& paint_controller_;
438 448
439 // Paint states stack. The state controls the appearance of drawn content, so 449 // Paint states stack. The state controls the appearance of drawn content, so
440 // this stack enables local drawing state changes with save()/restore() calls. 450 // this stack enables local drawing state changes with save()/restore() calls.
441 // We do not delete from this stack to avoid memory churn. 451 // We do not delete from this stack to avoid memory churn.
442 Vector<std::unique_ptr<GraphicsContextState>> paint_state_stack_; 452 Vector<std::unique_ptr<GraphicsContextState>> paint_state_stack_;
443 453
(...skipping 10 matching lines...) Expand all
454 #if DCHECK_IS_ON() 464 #if DCHECK_IS_ON()
455 int layer_count_; 465 int layer_count_;
456 bool disable_destruction_checks_; 466 bool disable_destruction_checks_;
457 bool in_drawing_recorder_; 467 bool in_drawing_recorder_;
458 #endif 468 #endif
459 469
460 const DisabledMode disabled_state_; 470 const DisabledMode disabled_state_;
461 471
462 float device_scale_factor_; 472 float device_scale_factor_;
463 473
474 HighContrastSettings high_contrast_settings_;
475 sk_sp<SkColorFilter> high_contrast_filter_;
476
464 unsigned printing_ : 1; 477 unsigned printing_ : 1;
465 unsigned has_meta_data_ : 1; 478 unsigned has_meta_data_ : 1;
466 }; 479 };
467 480
468 } // namespace blink 481 } // namespace blink
469 482
470 #endif // GraphicsContext_h 483 #endif // GraphicsContext_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698