| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef UI_GFX_CANVAS_H_ |
| 6 #define UI_GFX_CANVAS_H_ | 6 #define UI_GFX_CANVAS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // use. Must be balanced by a call to EndPlatformPaint(). | 356 // use. Must be balanced by a call to EndPlatformPaint(). |
| 357 NativeDrawingContext BeginPlatformPaint(); | 357 NativeDrawingContext BeginPlatformPaint(); |
| 358 | 358 |
| 359 // Signifies the end of platform drawing using the native drawing context | 359 // Signifies the end of platform drawing using the native drawing context |
| 360 // returned by BeginPlatformPaint(). | 360 // returned by BeginPlatformPaint(). |
| 361 void EndPlatformPaint(); | 361 void EndPlatformPaint(); |
| 362 | 362 |
| 363 // Apply transformation on the canvas. | 363 // Apply transformation on the canvas. |
| 364 void Transform(const ui::Transform& transform); | 364 void Transform(const ui::Transform& transform); |
| 365 | 365 |
| 366 #if defined(OS_WIN) | |
| 367 // Draws the given string with the beginning and/or the end using a fade | 366 // Draws the given string with the beginning and/or the end using a fade |
| 368 // gradient. When truncating the head | 367 // gradient. When truncating the head |
| 369 // |desired_characters_to_truncate_from_head| specifies the maximum number of | 368 // |desired_characters_to_truncate_from_head| specifies the maximum number of |
| 370 // characters that can be truncated. | 369 // characters that can be truncated. |
| 371 void DrawFadeTruncatingString( | 370 void DrawFadeTruncatingString( |
| 372 const string16& text, | 371 const string16& text, |
| 373 TruncateFadeMode truncate_mode, | 372 TruncateFadeMode truncate_mode, |
| 374 size_t desired_characters_to_truncate_from_head, | 373 size_t desired_characters_to_truncate_from_head, |
| 375 const gfx::Font& font, | 374 const gfx::Font& font, |
| 376 SkColor color, | 375 SkColor color, |
| 377 const gfx::Rect& display_rect); | 376 const gfx::Rect& display_rect); |
| 378 #endif | |
| 379 | 377 |
| 380 skia::PlatformCanvas* platform_canvas() const { return owned_canvas_.get(); } | 378 skia::PlatformCanvas* platform_canvas() const { return owned_canvas_.get(); } |
| 381 SkCanvas* sk_canvas() const { return canvas_; } | 379 SkCanvas* sk_canvas() const { return canvas_; } |
| 382 ui::ScaleFactor scale_factor() const { return scale_factor_; } | 380 ui::ScaleFactor scale_factor() const { return scale_factor_; } |
| 383 | 381 |
| 384 private: | 382 private: |
| 385 // Test whether the provided rectangle intersects the current clip rect. | 383 // Test whether the provided rectangle intersects the current clip rect. |
| 386 bool IntersectsClipRectInt(int x, int y, int w, int h); | 384 bool IntersectsClipRectInt(int x, int y, int w, int h); |
| 387 bool IntersectsClipRect(const gfx::Rect& rect); | 385 bool IntersectsClipRect(const gfx::Rect& rect); |
| 388 | 386 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // An additional scale can be applied via Canvas::Scale(). However, | 425 // An additional scale can be applied via Canvas::Scale(). However, |
| 428 // Canvas::Scale() does not affect |scale_factor_|. | 426 // Canvas::Scale() does not affect |scale_factor_|. |
| 429 ui::ScaleFactor scale_factor_; | 427 ui::ScaleFactor scale_factor_; |
| 430 | 428 |
| 431 DISALLOW_COPY_AND_ASSIGN(Canvas); | 429 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 432 }; | 430 }; |
| 433 | 431 |
| 434 } // namespace gfx | 432 } // namespace gfx |
| 435 | 433 |
| 436 #endif // UI_GFX_CANVAS_H_ | 434 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |