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

Side by Side Diff: third_party/WebKit/Source/core/paint/NinePieceImageGrid.h

Issue 1901103002: Compensate for source scaling in hidpi mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DOCTYPE to added test. 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
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 #ifndef NinePieceImageGrid_h 5 #ifndef NinePieceImageGrid_h
6 #define NinePieceImageGrid_h 6 #define NinePieceImageGrid_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/geometry/FloatRect.h" 9 #include "platform/geometry/FloatRect.h"
10 #include "platform/geometry/FloatSize.h" 10 #include "platform/geometry/FloatSize.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 FloatRect destination; 72 FloatRect destination;
73 FloatRect source; 73 FloatRect source;
74 74
75 // tileScale and tileRule are only useful for non-corners, i.e. edge and center pieces. 75 // tileScale and tileRule are only useful for non-corners, i.e. edge and center pieces.
76 FloatSize tileScale; 76 FloatSize tileScale;
77 struct { 77 struct {
78 Image::TileRule horizontal; 78 Image::TileRule horizontal;
79 Image::TileRule vertical; 79 Image::TileRule vertical;
80 } tileRule; 80 } tileRule;
81 }; 81 };
82 NinePieceDrawInfo getNinePieceDrawInfo(NinePiece) const; 82 NinePieceDrawInfo getNinePieceDrawInfo(NinePiece, float) const;
83 83
84 struct Edge { 84 struct Edge {
85 DISALLOW_NEW(); 85 DISALLOW_NEW();
86 bool isDrawable() const { return slice > 0 && width > 0; } 86 bool isDrawable() const { return slice > 0 && width > 0; }
87 float scale() const { return isDrawable() ? (float)width / slice : 1; } 87 float scale() const { return isDrawable() ? (float)width / slice : 1; }
88 int slice; 88 int slice;
89 int width; 89 int width;
90 }; 90 };
91 91
92 private: 92 private:
93 void setDrawInfoCorner(NinePieceDrawInfo&, NinePiece) const; 93 void setDrawInfoCorner(NinePieceDrawInfo&, NinePiece) const;
94 void setDrawInfoEdge(NinePieceDrawInfo&, NinePiece) const; 94 void setDrawInfoEdge(NinePieceDrawInfo&, NinePiece) const;
95 void setDrawInfoMiddle(NinePieceDrawInfo&) const; 95 void setDrawInfoMiddle(NinePieceDrawInfo&) const;
96 96
97 IntRect m_borderImageArea; 97 IntRect m_borderImageArea;
98 IntSize m_imageSize; 98 IntSize m_imageSize;
99 Image::TileRule m_horizontalTileRule; 99 Image::TileRule m_horizontalTileRule;
100 Image::TileRule m_verticalTileRule; 100 Image::TileRule m_verticalTileRule;
101 bool m_fill; 101 bool m_fill;
102 102
103 Edge m_top; 103 Edge m_top;
104 Edge m_right; 104 Edge m_right;
105 Edge m_bottom; 105 Edge m_bottom;
106 Edge m_left; 106 Edge m_left;
107 }; 107 };
108 108
109 } // namespace blink 109 } // namespace blink
110 110
111 #endif // NinePieceImageGrid_h 111 #endif // NinePieceImageGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698