OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 GFX_CANVAS_SKIA_H_ | 5 #ifndef GFX_CANVAS_SKIA_H_ |
6 #define GFX_CANVAS_SKIA_H_ | 6 #define GFX_CANVAS_SKIA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); | 68 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); |
69 #endif | 69 #endif |
70 | 70 |
71 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) | 71 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) |
72 // Draws text with a 1-pixel halo around it of the given color. | 72 // Draws text with a 1-pixel halo around it of the given color. |
73 // On Windows, it allows ClearType to be drawn to an otherwise transparenct | 73 // On Windows, it allows ClearType to be drawn to an otherwise transparenct |
74 // bitmap for drag images. Drag images have only 1-bit of transparency, so | 74 // bitmap for drag images. Drag images have only 1-bit of transparency, so |
75 // we don't do any fancy blurring. | 75 // we don't do any fancy blurring. |
76 // On Linux, text with halo is created by stroking it with 2px |halo_color| | 76 // On Linux, text with halo is created by stroking it with 2px |halo_color| |
77 // then filling it with |text_color|. | 77 // then filling it with |text_color|. |
78 void DrawStringWithHalo(const string16& text, | 78 void DrawStringWithHalo(const std::wstring& text, |
79 const gfx::Font& font, | 79 const gfx::Font& font, |
80 const SkColor& text_color, | 80 const SkColor& text_color, |
81 const SkColor& halo_color, | 81 const SkColor& halo_color, |
82 int x, int y, int w, int h, | 82 int x, int y, int w, int h, |
83 int flags); | 83 int flags); |
84 #endif | 84 #endif |
85 | 85 |
86 // Extracts a bitmap from the contents of this canvas. | 86 // Extracts a bitmap from the contents of this canvas. |
87 SkBitmap ExtractBitmap() const; | 87 SkBitmap ExtractBitmap() const; |
88 | 88 |
(...skipping 23 matching lines...) Expand all Loading... |
112 const SkPaint& paint); | 112 const SkPaint& paint); |
113 virtual void DrawBitmapInt(const SkBitmap& bitmap, | 113 virtual void DrawBitmapInt(const SkBitmap& bitmap, |
114 int src_x, int src_y, int src_w, int src_h, | 114 int src_x, int src_y, int src_w, int src_h, |
115 int dest_x, int dest_y, int dest_w, int dest_h, | 115 int dest_x, int dest_y, int dest_w, int dest_h, |
116 bool filter); | 116 bool filter); |
117 virtual void DrawBitmapInt(const SkBitmap& bitmap, | 117 virtual void DrawBitmapInt(const SkBitmap& bitmap, |
118 int src_x, int src_y, int src_w, int src_h, | 118 int src_x, int src_y, int src_w, int src_h, |
119 int dest_x, int dest_y, int dest_w, int dest_h, | 119 int dest_x, int dest_y, int dest_w, int dest_h, |
120 bool filter, | 120 bool filter, |
121 const SkPaint& paint); | 121 const SkPaint& paint); |
122 virtual void DrawStringInt(const string16& text, | 122 virtual void DrawStringInt(const std::wstring& text, |
123 const gfx::Font& font, | 123 const gfx::Font& font, |
124 const SkColor& color, | 124 const SkColor& color, |
125 int x, int y, int w, int h); | 125 int x, int y, int w, int h); |
126 virtual void DrawStringInt(const string16& text, | 126 virtual void DrawStringInt(const std::wstring& text, |
127 const gfx::Font& font, | 127 const gfx::Font& font, |
128 const SkColor& color, | 128 const SkColor& color, |
129 const gfx::Rect& display_rect); | 129 const gfx::Rect& display_rect); |
130 virtual void DrawStringInt(const string16& text, | 130 virtual void DrawStringInt(const std::wstring& text, |
131 const gfx::Font& font, | 131 const gfx::Font& font, |
132 const SkColor& color, | 132 const SkColor& color, |
133 int x, int y, int w, int h, | 133 int x, int y, int w, int h, |
134 int flags); | 134 int flags); |
135 virtual void DrawFocusRect(int x, int y, int width, int height); | 135 virtual void DrawFocusRect(int x, int y, int width, int height); |
136 virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); | 136 virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); |
137 virtual void TileImageInt(const SkBitmap& bitmap, | 137 virtual void TileImageInt(const SkBitmap& bitmap, |
138 int src_x, int src_y, | 138 int src_x, int src_y, |
139 int dest_x, int dest_y, int w, int h); | 139 int dest_x, int dest_y, int w, int h); |
140 virtual gfx::NativeDrawingContext BeginPlatformPaint(); | 140 virtual gfx::NativeDrawingContext BeginPlatformPaint(); |
141 virtual void EndPlatformPaint(); | 141 virtual void EndPlatformPaint(); |
142 virtual CanvasSkia* AsCanvasSkia(); | 142 virtual CanvasSkia* AsCanvasSkia(); |
143 virtual const CanvasSkia* AsCanvasSkia() const; | 143 virtual const CanvasSkia* AsCanvasSkia() const; |
144 | 144 |
145 private: | 145 private: |
146 // Test whether the provided rectangle intersects the current clip rect. | 146 // Test whether the provided rectangle intersects the current clip rect. |
147 bool IntersectsClipRectInt(int x, int y, int w, int h); | 147 bool IntersectsClipRectInt(int x, int y, int w, int h); |
148 | 148 |
149 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
150 // Draws text with the specified color, font and location. The text is | 150 // Draws text with the specified color, font and location. The text is |
151 // aligned to the left, vertically centered, clipped to the region. If the | 151 // aligned to the left, vertically centered, clipped to the region. If the |
152 // text is too big, it is truncated and '...' is added to the end. | 152 // text is too big, it is truncated and '...' is added to the end. |
153 void DrawStringInt(const string16& text, | 153 void DrawStringInt(const std::wstring& text, |
154 HFONT font, | 154 HFONT font, |
155 const SkColor& color, | 155 const SkColor& color, |
156 int x, int y, int w, int h, | 156 int x, int y, int w, int h, |
157 int flags); | 157 int flags); |
158 #endif | 158 #endif |
159 | 159 |
160 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); | 160 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); |
161 }; | 161 }; |
162 | 162 |
163 } // namespace gfx; | 163 } // namespace gfx; |
164 | 164 |
165 #endif // GFX_CANVAS_SKIA_H_ | 165 #endif // GFX_CANVAS_SKIA_H_ |
OLD | NEW |