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/DocumentMarkerController.h" | 9 #include "core/editing/markers/DocumentMarkerController.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 #else | 810 #else |
811 // Offset it vertically by 1 so that there's some space under the text. | 811 // Offset it vertically by 1 so that there's some space under the text. |
812 origin_y += 1; | 812 origin_y += 1; |
813 #endif | 813 #endif |
814 | 814 |
815 const auto rect = SkRect::MakeWH(width, marker->cullRect().height() * zoom); | 815 const auto rect = SkRect::MakeWH(width, marker->cullRect().height() * zoom); |
816 const auto local_matrix = SkMatrix::MakeScale(zoom, zoom); | 816 const auto local_matrix = SkMatrix::MakeScale(zoom, zoom); |
817 | 817 |
818 PaintFlags flags; | 818 PaintFlags flags; |
819 flags.setAntiAlias(true); | 819 flags.setAntiAlias(true); |
820 flags.setShader(WrapSkShader(MakePaintShaderRecord( | 820 flags.setShader(WTF::MakeUnique<PaintShader>( |
821 sk_ref_sp(marker), SkShader::kRepeat_TileMode, SkShader::kClamp_TileMode, | 821 sk_ref_sp(marker), SkShader::kRepeat_TileMode, SkShader::kClamp_TileMode, |
822 &local_matrix, nullptr))); | 822 &local_matrix, nullptr)); |
823 | 823 |
824 // Apply the origin translation as a global transform. This ensures that the | 824 // Apply the origin translation as a global transform. This ensures that the |
825 // shader local matrix depends solely on zoom => Skia can reuse the same | 825 // shader local matrix depends solely on zoom => Skia can reuse the same |
826 // cached tile for all markers at a given zoom level. | 826 // cached tile for all markers at a given zoom level. |
827 GraphicsContextStateSaver saver(context); | 827 GraphicsContextStateSaver saver(context); |
828 context.Translate(origin_x, origin_y); | 828 context.Translate(origin_x, origin_y); |
829 context.DrawRect(rect, flags); | 829 context.DrawRect(rect, flags); |
830 } | 830 } |
831 | 831 |
832 } // anonymous ns | 832 } // anonymous ns |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 | 1180 |
1181 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), | 1181 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), |
1182 inline_text_box_.LogicalHeight())); | 1182 inline_text_box_.LogicalHeight())); |
1183 context.Clip(FloatRect(box_rect)); | 1183 context.Clip(FloatRect(box_rect)); |
1184 context.DrawHighlightForText(font, run, FloatPoint(box_origin), | 1184 context.DrawHighlightForText(font, run, FloatPoint(box_origin), |
1185 box_rect.Height().ToInt(), color, | 1185 box_rect.Height().ToInt(), color, |
1186 paint_offsets.first, paint_offsets.second); | 1186 paint_offsets.first, paint_offsets.second); |
1187 } | 1187 } |
1188 | 1188 |
1189 } // namespace blink | 1189 } // namespace blink |
OLD | NEW |