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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "gfx/canvas.h" | 9 #include "gfx/canvas.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #endif | 77 #endif |
78 | 78 |
79 // Extracts a bitmap from the contents of this canvas. | 79 // Extracts a bitmap from the contents of this canvas. |
80 SkBitmap ExtractBitmap() const; | 80 SkBitmap ExtractBitmap() const; |
81 | 81 |
82 // Overridden from Canvas: | 82 // Overridden from Canvas: |
83 virtual void Save(); | 83 virtual void Save(); |
84 virtual void SaveLayerAlpha(uint8 alpha); | 84 virtual void SaveLayerAlpha(uint8 alpha); |
85 virtual void SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds); | 85 virtual void SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds); |
86 virtual void Restore(); | 86 virtual void Restore(); |
87 virtual bool GetClipRect(gfx::Rect* clip_rect); | |
88 virtual bool ClipRectInt(int x, int y, int w, int h); | 87 virtual bool ClipRectInt(int x, int y, int w, int h); |
89 virtual bool IntersectsClipRectInt(int x, int y, int w, int h); | |
90 virtual void TranslateInt(int x, int y); | 88 virtual void TranslateInt(int x, int y); |
91 virtual void ScaleInt(int x, int y); | 89 virtual void ScaleInt(int x, int y); |
92 virtual void FillRectInt(int x, int y, int w, int h, | 90 virtual void FillRectInt(int x, int y, int w, int h, |
93 const SkPaint& paint); | 91 const SkPaint& paint); |
94 virtual void FillRectInt(const SkColor& color, int x, int y, int w, | 92 virtual void FillRectInt(const SkColor& color, int x, int y, int w, |
95 int h); | 93 int h); |
96 virtual void DrawRectInt(const SkColor& color, int x, int y, int w, | 94 virtual void DrawRectInt(const SkColor& color, int x, int y, int w, |
97 int h); | 95 int h); |
98 virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h, | 96 virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h, |
99 SkXfermode::Mode mode); | 97 SkXfermode::Mode mode); |
(...skipping 21 matching lines...) Expand all Loading... |
121 virtual void DrawFocusRect(int x, int y, int width, int height); | 119 virtual void DrawFocusRect(int x, int y, int width, int height); |
122 virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); | 120 virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); |
123 virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, | 121 virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, |
124 int dest_x, int dest_y, int w, int h); | 122 int dest_x, int dest_y, int w, int h); |
125 virtual gfx::NativeDrawingContext BeginPlatformPaint(); | 123 virtual gfx::NativeDrawingContext BeginPlatformPaint(); |
126 virtual void EndPlatformPaint(); | 124 virtual void EndPlatformPaint(); |
127 virtual CanvasSkia* AsCanvasSkia(); | 125 virtual CanvasSkia* AsCanvasSkia(); |
128 virtual const CanvasSkia* AsCanvasSkia() const; | 126 virtual const CanvasSkia* AsCanvasSkia() const; |
129 | 127 |
130 private: | 128 private: |
| 129 // Test whether the provided rectangle intersects the current clip rect. |
| 130 bool IntersectsClipRectInt(int x, int y, int w, int h); |
| 131 |
131 #if defined(OS_WIN) | 132 #if defined(OS_WIN) |
132 // Draws text with the specified color, font and location. The text is | 133 // Draws text with the specified color, font and location. The text is |
133 // aligned to the left, vertically centered, clipped to the region. If the | 134 // aligned to the left, vertically centered, clipped to the region. If the |
134 // text is too big, it is truncated and '...' is added to the end. | 135 // text is too big, it is truncated and '...' is added to the end. |
135 void DrawStringInt(const std::wstring& text, HFONT font, | 136 void DrawStringInt(const std::wstring& text, HFONT font, |
136 const SkColor& color, int x, int y, int w, int h, | 137 const SkColor& color, int x, int y, int w, int h, |
137 int flags); | 138 int flags); |
138 #endif | 139 #endif |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); | 141 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); |
141 }; | 142 }; |
142 | 143 |
143 } // namespace gfx; | 144 } // namespace gfx; |
144 | 145 |
145 #endif // GFX_CANVAS_SKIA_H_ | 146 #endif // GFX_CANVAS_SKIA_H_ |
OLD | NEW |