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

Side by Side Diff: webkit/port/platform/graphics/ThemeHelperWin.h

Issue 9008: Add support for arbitrarily transformed Windows buttons text field... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2008 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef ThemeHelperWin_h
27 #define ThemeHelperWin_h
28
29 #include <windows.h>
30
31 #include "AffineTransform.h"
32 #include "ImageBuffer.h"
33 #include "IntRect.h"
34 #include "WTF/OwnPtr.h"
35
36 namespace WebCore {
37
38 class GraphicsContext;
39 class IntRect;
40
41 // Helps drawing theme elements like buttons and scroll bars. This will handle
42 // translations and scalings that Windows might not, by either making Windows
43 // draw the appropriate sized control, or by rendering it into an off-screen
44 // context and transforming it ourselves.
45 class ThemeHelperWin {
46 enum Type {
47 // Use the original canvas with no changes. This is the normal mode
M-A Ruel 2008/11/03 20:18:46 .
48 ORIGINAL,
49
50 // Use the original canvas but scale the rectangle of the control so
51 // that it will be the correct size, undoing any scale already on the
52 // canvas. This will have the effect of just drawing the control bigger
53 // or smaller and not actually expanding or contracting the pixels in
54 // it. This usually looke better.
M-A Ruel 2008/11/03 20:18:46 look
55 SCALE,
56
57 // Make a copy of the control and then transform it ourselves after
58 // Windows draws it. This allows us to get complex effects.
59 COPY
M-A Ruel 2008/11/03 20:18:46 ,
60 };
61
62 public:
63 // Prepares drawing a control with the given rect to the given context.
64 ThemeHelperWin(GraphicsContext* context, const IntRect& rect);
65 ~ThemeHelperWin();
66
67 // Returns the context to draw the control into, which may be the original
68 // or the copy, depending on the mode.
69 GraphicsContext* context()
70 {
71 return m_newBuffer.get() ? m_newBuffer->context() : m_orgContext;
72 }
73
74 // Returns the rectangle in which to draw into the canvas() by Windows.
75 const RECT& rect() { return m_rect; }
76
77 RECT transformRect(const RECT& r) const;
78
79 private:
80 Type m_type;
81
82 // The original canvas to wrote to. Not owned by this class.
83 GraphicsContext* m_orgContext;
84 AffineTransform m_orgMatrix;
85 IntRect m_orgRect;
86
87 // When type_ == COPY, this will be a new surface owned by this class that
M-A Ruel 2008/11/03 20:18:46 m_type
88 // represents the copy.
89 OwnPtr<ImageBuffer> m_newBuffer;
90
91 // The control rectangle in the cooredinate space of canvas().
92 RECT m_rect;
93 };
94
95 } // namespace WebCore
96
97 #endif // ThemeHelperWin_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698