OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/InlineTextBoxPainter.h" | 5 #include "core/paint/InlineTextBoxPainter.h" |
6 | 6 |
7 #include "core/editing/CompositionUnderline.h" | 7 #include "core/editing/CompositionUnderline.h" |
8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
9 #include "core/editing/markers/CompositionMarker.h" | 9 #include "core/editing/markers/CompositionMarker.h" |
10 #include "core/editing/markers/DocumentMarkerController.h" | 10 #include "core/editing/markers/DocumentMarkerController.h" |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 #else | 806 #else |
807 // Offset it vertically by 1 so that there's some space under the text. | 807 // Offset it vertically by 1 so that there's some space under the text. |
808 origin_y += 1; | 808 origin_y += 1; |
809 #endif | 809 #endif |
810 | 810 |
811 const auto rect = SkRect::MakeWH(width, kMarkerHeight * zoom); | 811 const auto rect = SkRect::MakeWH(width, kMarkerHeight * zoom); |
812 const auto local_matrix = SkMatrix::MakeScale(zoom, zoom); | 812 const auto local_matrix = SkMatrix::MakeScale(zoom, zoom); |
813 | 813 |
814 PaintFlags flags; | 814 PaintFlags flags; |
815 flags.setAntiAlias(true); | 815 flags.setAntiAlias(true); |
816 flags.setShader(WrapSkShader(MakePaintShaderRecord( | 816 flags.setShader(WTF::MakeUnique<PaintShader>( |
817 sk_ref_sp(marker), FloatRect(0, 0, kMarkerWidth, kMarkerHeight), | 817 sk_ref_sp(marker), FloatRect(0, 0, kMarkerWidth, kMarkerHeight), |
818 SkShader::kRepeat_TileMode, SkShader::kClamp_TileMode, &local_matrix))); | 818 SkShader::kRepeat_TileMode, SkShader::kClamp_TileMode, &local_matrix)); |
819 | 819 |
820 // Apply the origin translation as a global transform. This ensures that the | 820 // Apply the origin translation as a global transform. This ensures that the |
821 // shader local matrix depends solely on zoom => Skia can reuse the same | 821 // shader local matrix depends solely on zoom => Skia can reuse the same |
822 // cached tile for all markers at a given zoom level. | 822 // cached tile for all markers at a given zoom level. |
823 GraphicsContextStateSaver saver(context); | 823 GraphicsContextStateSaver saver(context); |
824 context.Translate(origin_x, origin_y); | 824 context.Translate(origin_x, origin_y); |
825 context.DrawRect(rect, flags); | 825 context.DrawRect(rect, flags); |
826 } | 826 } |
827 | 827 |
828 } // anonymous ns | 828 } // anonymous ns |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 | 1176 |
1177 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), | 1177 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), |
1178 inline_text_box_.LogicalHeight())); | 1178 inline_text_box_.LogicalHeight())); |
1179 context.Clip(FloatRect(box_rect)); | 1179 context.Clip(FloatRect(box_rect)); |
1180 context.DrawHighlightForText(font, run, FloatPoint(box_origin), | 1180 context.DrawHighlightForText(font, run, FloatPoint(box_origin), |
1181 box_rect.Height().ToInt(), color, | 1181 box_rect.Height().ToInt(), color, |
1182 paint_offsets.first, paint_offsets.second); | 1182 paint_offsets.first, paint_offsets.second); |
1183 } | 1183 } |
1184 | 1184 |
1185 } // namespace blink | 1185 } // namespace blink |
OLD | NEW |