| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 APP_GFX_CANVAS_H_ | 5 #ifndef APP_GFX_CANVAS_H_ |
| 6 #define APP_GFX_CANVAS_H_ | 6 #define APP_GFX_CANVAS_H_ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
| 16 | 16 |
| 17 #if defined(OS_LINUX) | 17 #if defined(USE_X11) |
| 18 typedef struct _cairo cairo_t; | 18 typedef struct _cairo cairo_t; |
| 19 typedef struct _GdkPixbuf GdkPixbuf; | 19 typedef struct _GdkPixbuf GdkPixbuf; |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 | 23 |
| 24 class Font; | 24 class Font; |
| 25 class Rect; | 25 class Rect; |
| 26 | 26 |
| 27 // Canvas is a SkCanvas subclass that provides a number of methods for common | 27 // Canvas is a SkCanvas subclass that provides a number of methods for common |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void DrawFocusRect(int x, int y, int width, int height); | 175 void DrawFocusRect(int x, int y, int width, int height); |
| 176 | 176 |
| 177 // Tiles the image in the specified region. | 177 // Tiles the image in the specified region. |
| 178 void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); | 178 void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); |
| 179 void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, | 179 void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, |
| 180 int dest_x, int dest_y, int w, int h); | 180 int dest_x, int dest_y, int w, int h); |
| 181 | 181 |
| 182 // Extracts a bitmap from the contents of this canvas. | 182 // Extracts a bitmap from the contents of this canvas. |
| 183 SkBitmap ExtractBitmap(); | 183 SkBitmap ExtractBitmap(); |
| 184 | 184 |
| 185 #if defined(OS_LINUX) | 185 #if defined(USE_X11) |
| 186 // Applies current matrix on the canvas to the cairo context. This should be | 186 // Applies current matrix on the canvas to the cairo context. This should be |
| 187 // invoked anytime you plan on drawing directly to the cairo context. Be | 187 // invoked anytime you plan on drawing directly to the cairo context. Be |
| 188 // sure and set the matrix back to the identity when done. | 188 // sure and set the matrix back to the identity when done. |
| 189 void ApplySkiaMatrixToCairoContext(cairo_t* cr); | 189 void ApplySkiaMatrixToCairoContext(cairo_t* cr); |
| 190 | 190 |
| 191 // Draw the pixbuf in its natural size at (x, y). | 191 // Draw the pixbuf in its natural size at (x, y). |
| 192 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); | 192 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); |
| 193 #endif | 193 #endif |
| 194 | 194 |
| 195 // Compute the size required to draw some text with the provided font. | 195 // Compute the size required to draw some text with the provided font. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 208 const SkColor& color, int x, int y, int w, int h, | 208 const SkColor& color, int x, int y, int w, int h, |
| 209 int flags); | 209 int flags); |
| 210 #endif | 210 #endif |
| 211 | 211 |
| 212 DISALLOW_COPY_AND_ASSIGN(Canvas); | 212 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 } // namespace gfx; | 215 } // namespace gfx; |
| 216 | 216 |
| 217 #endif // APP_GFX_CANVAS_H_ | 217 #endif // APP_GFX_CANVAS_H_ |
| OLD | NEW |