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

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

Issue 1908743002: Compensate for source scaling in hidpi mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame/Deprecation.h" 7 #include "core/frame/Deprecation.h"
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutBoxModelObject.h" 9 #include "core/layout/LayoutBoxModelObject.h"
10 #include "core/paint/BoxPainter.h" 10 #include "core/paint/BoxPainter.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); 62 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1);
63 63
64 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); 64 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size());
65 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality(); 65 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality();
66 graphicsContext.setImageInterpolationQuality(interpolationQuality); 66 graphicsContext.setImageInterpolationQuality(interpolationQuality);
67 67
68 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data", 68 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data",
69 InspectorPaintImageEvent::data(m_layoutObject, *styleImage)); 69 InspectorPaintImageEvent::data(m_layoutObject, *styleImage));
70 70
71 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) { 71 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) {
72 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn fo(piece); 72 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn fo(piece, styleImage->imageScaleFactor());
73
74 // The nine piece grid is computed in unscaled image coordinates but mus t be drawn using
75 // scaled image coordinates.
76 drawInfo.source.scale(styleImage->imageScaleFactor());
77 73
78 if (drawInfo.isDrawable) { 74 if (drawInfo.isDrawable) {
79 if (drawInfo.isCornerPiece) { 75 if (drawInfo.isCornerPiece) {
80 graphicsContext.drawImage(image.get(), drawInfo.destination, dra wInfo.source, op); 76 graphicsContext.drawImage(image.get(), drawInfo.destination, dra wInfo.source, op);
81 } else { 77 } else {
82 graphicsContext.drawTiledImage(image.get(), drawInfo.destination , 78 graphicsContext.drawTiledImage(image.get(), drawInfo.destination ,
83 drawInfo.source, drawInfo.tileScale, drawInfo.tileRule.horiz ontal, 79 drawInfo.source, drawInfo.tileScale, drawInfo.tileRule.horiz ontal,
84 drawInfo.tileRule.vertical, op); 80 drawInfo.tileRule.vertical, op);
85 } 81 }
86 } 82 }
87 } 83 }
88 84
89 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); 85 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality);
90 return true; 86 return true;
91 } 87 }
92 88
93 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698