| 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 // Creates an empty canvas with image_scale of 1x. | 77 // Creates an empty canvas with image_scale of 1x. |
| 78 Canvas(); | 78 Canvas(); |
| 79 | 79 |
| 80 // Creates canvas with provided DIP |size| and |image_scale|. | 80 // Creates canvas with provided DIP |size| and |image_scale|. |
| 81 // If this canvas is not opaque, it's explicitly cleared to transparent before | 81 // If this canvas is not opaque, it's explicitly cleared to transparent before |
| 82 // being returned. | 82 // being returned. |
| 83 Canvas(const Size& size, float image_scale, bool is_opaque); | 83 Canvas(const Size& size, float image_scale, bool is_opaque); |
| 84 | 84 |
| 85 // Constructs a canvas with the size and the image_scale of the provided | |
| 86 // |image_rep|, and draws the |image_rep| into it. | |
| 87 Canvas(const ImageSkiaRep& image_rep, bool is_opaque); | |
| 88 | |
| 89 // Creates a Canvas backed by an |sk_canvas| with |image_scale_|. | 85 // Creates a Canvas backed by an |sk_canvas| with |image_scale_|. |
| 90 // |sk_canvas| is assumed to be already scaled based on |image_scale| | 86 // |sk_canvas| is assumed to be already scaled based on |image_scale| |
| 91 // so no additional scaling is applied. | 87 // so no additional scaling is applied. |
| 92 Canvas(sk_sp<SkCanvas> sk_canvas, float image_scale); | 88 Canvas(sk_sp<SkCanvas> sk_canvas, float image_scale); |
| 93 | 89 |
| 94 virtual ~Canvas(); | 90 virtual ~Canvas(); |
| 95 | 91 |
| 96 // Recreates the backing platform canvas with DIP |size| and |image_scale_|. | 92 // Recreates the backing platform canvas with DIP |size| and |image_scale_|. |
| 97 // If the canvas is not opaque, it is explicitly cleared. | 93 // If the canvas is not opaque, it is explicitly cleared. |
| 98 // This method is public so that canvas_skia_paint can recreate the platform | 94 // This method is public so that canvas_skia_paint can recreate the platform |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 float image_scale_; | 446 float image_scale_; |
| 451 | 447 |
| 452 sk_sp<SkCanvas> canvas_; | 448 sk_sp<SkCanvas> canvas_; |
| 453 | 449 |
| 454 DISALLOW_COPY_AND_ASSIGN(Canvas); | 450 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 455 }; | 451 }; |
| 456 | 452 |
| 457 } // namespace gfx | 453 } // namespace gfx |
| 458 | 454 |
| 459 #endif // UI_GFX_CANVAS_H_ | 455 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |