| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // until a balanced call to Restore() is made. | 185 // until a balanced call to Restore() is made. |
| 186 void Save(); | 186 void Save(); |
| 187 | 187 |
| 188 // As with Save(), except draws to a layer that is blended with the canvas | 188 // As with Save(), except draws to a layer that is blended with the canvas |
| 189 // at the specified alpha once Restore() is called. | 189 // at the specified alpha once Restore() is called. |
| 190 // |layer_bounds| are the bounds of the layer relative to the current | 190 // |layer_bounds| are the bounds of the layer relative to the current |
| 191 // transform. | 191 // transform. |
| 192 void SaveLayerAlpha(uint8_t alpha); | 192 void SaveLayerAlpha(uint8_t alpha); |
| 193 void SaveLayerAlpha(uint8_t alpha, const Rect& layer_bounds); | 193 void SaveLayerAlpha(uint8_t alpha, const Rect& layer_bounds); |
| 194 | 194 |
| 195 // Like SaveLayerAlpha but draws the layer with an arbitrary set of |
| 196 // PaintFlags once Restore() is called. |
| 197 void SaveLayerWithFlags(const cc::PaintFlags& flags); |
| 198 |
| 195 // Restores the drawing state after a call to Save*(). It is an error to | 199 // Restores the drawing state after a call to Save*(). It is an error to |
| 196 // call Restore() more times than Save*(). | 200 // call Restore() more times than Save*(). |
| 197 void Restore(); | 201 void Restore(); |
| 198 | 202 |
| 199 // Applies |rect| to the current clip using the specified region |op|. | 203 // Applies |rect| to the current clip using the specified region |op|. |
| 200 void ClipRect(const Rect& rect, SkClipOp op = SkClipOp::kIntersect); | 204 void ClipRect(const Rect& rect, SkClipOp op = SkClipOp::kIntersect); |
| 201 void ClipRect(const RectF& rect, SkClipOp op = SkClipOp::kIntersect); | 205 void ClipRect(const RectF& rect, SkClipOp op = SkClipOp::kIntersect); |
| 202 | 206 |
| 203 // Adds |path| to the current clip. |do_anti_alias| is true if the clip | 207 // Adds |path| to the current clip. |do_anti_alias| is true if the clip |
| 204 // should be antialiased. | 208 // should be antialiased. |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // but surface_ will be null. | 512 // but surface_ will be null. |
| 509 sk_sp<cc::PaintSurface> surface_; | 513 sk_sp<cc::PaintSurface> surface_; |
| 510 cc::PaintCanvas* canvas_; | 514 cc::PaintCanvas* canvas_; |
| 511 | 515 |
| 512 DISALLOW_COPY_AND_ASSIGN(Canvas); | 516 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 513 }; | 517 }; |
| 514 | 518 |
| 515 } // namespace gfx | 519 } // namespace gfx |
| 516 | 520 |
| 517 #endif // UI_GFX_CANVAS_H_ | 521 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |