| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_GFX_CANVAS_SKIA_H_ | 5 #ifndef UI_GFX_CANVAS_SKIA_H_ |
| 6 #define UI_GFX_CANVAS_SKIA_H_ | 6 #define UI_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" |
| 11 #include "skia/ext/platform_canvas.h" | 11 #include "skia/ext/platform_canvas.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 | 13 |
| 14 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 14 #if defined(TOOLKIT_USES_GTK) |
| 15 typedef struct _GdkPixbuf GdkPixbuf; | 15 typedef struct _GdkPixbuf GdkPixbuf; |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 | 19 |
| 20 class Canvas; | 20 class Canvas; |
| 21 | 21 |
| 22 // CanvasSkia is a SkCanvas subclass that provides a number of methods for | 22 // CanvasSkia is a SkCanvas subclass that provides a number of methods for |
| 23 // common operations used throughout an application built using base/gfx and | 23 // common operations used throughout an application built using base/gfx and |
| 24 // app/gfx. | 24 // app/gfx. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Returns the default text alignment to be used when drawing text on a | 62 // Returns the default text alignment to be used when drawing text on a |
| 63 // gfx::CanvasSkia based on the directionality of the system locale language. | 63 // gfx::CanvasSkia based on the directionality of the system locale language. |
| 64 // This function is used by gfx::Canvas::DrawStringInt when the text alignment | 64 // This function is used by gfx::Canvas::DrawStringInt when the text alignment |
| 65 // is not specified. | 65 // is not specified. |
| 66 // | 66 // |
| 67 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or | 67 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or |
| 68 // gfx::Canvas::TEXT_ALIGN_RIGHT. | 68 // gfx::Canvas::TEXT_ALIGN_RIGHT. |
| 69 static int DefaultCanvasTextAlignment(); | 69 static int DefaultCanvasTextAlignment(); |
| 70 | 70 |
| 71 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 71 #if defined(TOOLKIT_USES_GTK) |
| 72 // Draw the pixbuf in its natural size at (x, y). | 72 // Draw the pixbuf in its natural size at (x, y). |
| 73 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); | 73 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) | 76 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) |
| 77 // Draws text with a 1-pixel halo around it of the given color. | 77 // Draws text with a 1-pixel halo around it of the given color. |
| 78 // On Windows, it allows ClearType to be drawn to an otherwise transparenct | 78 // On Windows, it allows ClearType to be drawn to an otherwise transparenct |
| 79 // bitmap for drag images. Drag images have only 1-bit of transparency, so | 79 // bitmap for drag images. Drag images have only 1-bit of transparency, so |
| 80 // we don't do any fancy blurring. | 80 // we don't do any fancy blurring. |
| 81 // On Linux, text with halo is created by stroking it with 2px |halo_color| | 81 // On Linux, text with halo is created by stroking it with 2px |halo_color| |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 int x, int y, int w, int h, | 178 int x, int y, int w, int h, |
| 179 int flags); | 179 int flags); |
| 180 #endif | 180 #endif |
| 181 | 181 |
| 182 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); | 182 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 } // namespace gfx; | 185 } // namespace gfx; |
| 186 | 186 |
| 187 #endif // UI_GFX_CANVAS_SKIA_H_ | 187 #endif // UI_GFX_CANVAS_SKIA_H_ |
| OLD | NEW |