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

Side by Side Diff: third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp

Issue 2941533002: Break StyleImage dependency on LayoutObject (Closed)
Patch Set: Address reviewer comments 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/NinePieceImagePainter.h" 5 #include "core/paint/NinePieceImagePainter.h"
6 6
7 #include "core/layout/ImageQualityController.h" 7 #include "core/layout/ImageQualityController.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
10 #include "core/paint/NinePieceImageGrid.h" 10 #include "core/paint/NinePieceImageGrid.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // coordinates. 80 // coordinates.
81 // 81 //
82 // FIXME: The default object size passed to imageSize() should be scaled by 82 // FIXME: The default object size passed to imageSize() should be scaled by
83 // the zoom factor passed in. In this case it means that borderImageRect 83 // the zoom factor passed in. In this case it means that borderImageRect
84 // should be passed in compensated by effective zoom, since the scale factor 84 // should be passed in compensated by effective zoom, since the scale factor
85 // is one. For generated images, the actual image data (gradient stops, etc.) 85 // is one. For generated images, the actual image data (gradient stops, etc.)
86 // are scaled to effective zoom instead so we must take care not to cause 86 // are scaled to effective zoom instead so we must take care not to cause
87 // scale of them again. 87 // scale of them again.
88 IntSize image_size = RoundedIntSize(style_image->ImageSize( 88 IntSize image_size = RoundedIntSize(style_image->ImageSize(
89 layout_object.GetDocument(), 1, border_image_rect.Size())); 89 layout_object.GetDocument(), 1, border_image_rect.Size()));
90 RefPtr<Image> image = style_image->GetImage(layout_object, image_size); 90 RefPtr<Image> image =
91 style_image->GetImage(layout_object, layout_object.GetDocument(),
92 layout_object.StyleRef(), image_size);
91 93
92 InterpolationQuality interpolation_quality = 94 InterpolationQuality interpolation_quality =
93 BoxPainter::ChooseInterpolationQuality(layout_object, image.Get(), 0, 95 BoxPainter::ChooseInterpolationQuality(layout_object, image.Get(), 0,
94 rect_with_outsets.Size()); 96 rect_with_outsets.Size());
95 InterpolationQuality previous_interpolation_quality = 97 InterpolationQuality previous_interpolation_quality =
96 graphics_context.ImageInterpolationQuality(); 98 graphics_context.ImageInterpolationQuality();
97 graphics_context.SetImageInterpolationQuality(interpolation_quality); 99 graphics_context.SetImageInterpolationQuality(interpolation_quality);
98 100
99 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", 101 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage",
100 "data", 102 "data",
101 InspectorPaintImageEvent::Data(layout_object, *style_image)); 103 InspectorPaintImageEvent::Data(layout_object, *style_image));
102 104
103 PaintPieces(graphics_context, border_image_rect, style, nine_piece_image, 105 PaintPieces(graphics_context, border_image_rect, style, nine_piece_image,
104 image.Get(), image_size, op); 106 image.Get(), image_size, op);
105 107
106 graphics_context.SetImageInterpolationQuality(previous_interpolation_quality); 108 graphics_context.SetImageInterpolationQuality(previous_interpolation_quality);
107 return true; 109 return true;
108 } 110 }
109 111
110 } // namespace blink 112 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp ('k') | third_party/WebKit/Source/core/style/StyleFetchedImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698