OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... |
41 // This is a pointer to a static object, so no ownership transferral. | 41 // This is a pointer to a static object, so no ownership transferral. |
42 m_theme = painter.m_theme; | 42 m_theme = painter.m_theme; |
43 m_scrollbar = painter.m_scrollbar; | 43 m_scrollbar = painter.m_scrollbar; |
44 } | 44 } |
45 | 45 |
46 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const
WebRect& rect) | 46 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const
WebRect& rect) |
47 { | 47 { |
48 SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height); | 48 SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height); |
49 canvas->clipRect(clip); | 49 canvas->clipRect(clip); |
50 | 50 |
51 PlatformContextSkia platformContext(canvas); | 51 GraphicsContext context(canvas); |
52 platformContext.setDrawingToImageBuffer(true); | 52 context.platformContext()->setDrawingToImageBuffer(true); |
53 GraphicsContext context(&platformContext); | |
54 m_theme->paintScrollbarBackground(&context, m_scrollbar); | 53 m_theme->paintScrollbarBackground(&context, m_scrollbar); |
55 } | 54 } |
56 | 55 |
57 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) | 56 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) |
58 { | 57 { |
59 PlatformContextSkia platformContext(canvas); | 58 GraphicsContext context(canvas); |
60 platformContext.setDrawingToImageBuffer(true); | 59 context.platformContext()->setDrawingToImageBuffer(true); |
61 GraphicsContext context(&platformContext); | |
62 m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect)); | 60 m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect)); |
63 } | 61 } |
64 | 62 |
65 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) | 63 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) |
66 { | 64 { |
67 PlatformContextSkia platformContext(canvas); | 65 GraphicsContext context(canvas); |
68 platformContext.setDrawingToImageBuffer(true); | 66 context.platformContext()->setDrawingToImageBuffer(true); |
69 GraphicsContext context(&platformContext); | |
70 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::Back
TrackPart); | 67 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::Back
TrackPart); |
71 } | 68 } |
72 | 69 |
73 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const We
bRect& rect) | 70 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const We
bRect& rect) |
74 { | 71 { |
75 PlatformContextSkia platformContext(canvas); | 72 GraphicsContext context(canvas); |
76 platformContext.setDrawingToImageBuffer(true); | 73 context.platformContext()->setDrawingToImageBuffer(true); |
77 GraphicsContext context(&platformContext); | |
78 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::Forw
ardTrackPart); | 74 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::Forw
ardTrackPart); |
79 } | 75 } |
80 | 76 |
81 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const Web
Rect& rect) | 77 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const Web
Rect& rect) |
82 { | 78 { |
83 PlatformContextSkia platformContext(canvas); | 79 GraphicsContext context(canvas); |
84 platformContext.setDrawingToImageBuffer(true); | 80 context.platformContext()->setDrawingToImageBuffer(true); |
85 GraphicsContext context(&platformContext); | |
86 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButt
onStartPart); | 81 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButt
onStartPart); |
87 } | 82 } |
88 | 83 |
89 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRe
ct& rect) | 84 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRe
ct& rect) |
90 { | 85 { |
91 PlatformContextSkia platformContext(canvas); | 86 GraphicsContext context(canvas); |
92 platformContext.setDrawingToImageBuffer(true); | 87 context.platformContext()->setDrawingToImageBuffer(true); |
93 GraphicsContext context(&platformContext); | |
94 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButt
onEndPart); | 88 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButt
onEndPart); |
95 } | 89 } |
96 | 90 |
97 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const
WebRect& rect) | 91 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const
WebRect& rect) |
98 { | 92 { |
99 PlatformContextSkia platformContext(canvas); | 93 GraphicsContext context(canvas); |
100 platformContext.setDrawingToImageBuffer(true); | 94 context.platformContext()->setDrawingToImageBuffer(true); |
101 GraphicsContext context(&platformContext); | |
102 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardB
uttonStartPart); | 95 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardB
uttonStartPart); |
103 } | 96 } |
104 | 97 |
105 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const We
bRect& rect) | 98 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const We
bRect& rect) |
106 { | 99 { |
107 PlatformContextSkia platformContext(canvas); | 100 GraphicsContext context(canvas); |
108 platformContext.setDrawingToImageBuffer(true); | 101 context.platformContext()->setDrawingToImageBuffer(true); |
109 GraphicsContext context(&platformContext); | |
110 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardB
uttonEndPart); | 102 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardB
uttonEndPart); |
111 } | 103 } |
112 | 104 |
113 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect&
rect) | 105 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect&
rect) |
114 { | 106 { |
115 PlatformContextSkia platformContext(canvas); | 107 GraphicsContext context(canvas); |
116 platformContext.setDrawingToImageBuffer(true); | 108 context.platformContext()->setDrawingToImageBuffer(true); |
117 GraphicsContext context(&platformContext); | |
118 m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect)); | 109 m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect)); |
119 } | 110 } |
120 | 111 |
121 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) | 112 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) |
122 { | 113 { |
123 PlatformContextSkia platformContext(canvas); | 114 GraphicsContext context(canvas); |
124 platformContext.setDrawingToImageBuffer(true); | 115 context.platformContext()->setDrawingToImageBuffer(true); |
125 GraphicsContext context(&platformContext); | |
126 m_theme->paintThumb(&context, m_scrollbar, IntRect(rect)); | 116 m_theme->paintThumb(&context, m_scrollbar, IntRect(rect)); |
127 } | 117 } |
128 | 118 |
129 WebScrollbarThemePainter::WebScrollbarThemePainter(WebCore::ScrollbarThemeCompos
ite* theme, WebCore::Scrollbar* scrollbar) | 119 WebScrollbarThemePainter::WebScrollbarThemePainter(WebCore::ScrollbarThemeCompos
ite* theme, WebCore::Scrollbar* scrollbar) |
130 : m_theme(theme) | 120 : m_theme(theme) |
131 , m_scrollbar(scrollbar) | 121 , m_scrollbar(scrollbar) |
132 { | 122 { |
133 } | 123 } |
134 | 124 |
135 } // namespace WebKit | 125 } // namespace WebKit |
OLD | NEW |