Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: ui/gfx/canvas.h

Issue 1819443002: MacViews: draw combobox arrow backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/native_theme/native_theme.h » ('j') | ui/native_theme/native_theme.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 10 #include <vector>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Specifies if words can be split by new lines. 67 // Specifies if words can be split by new lines.
68 // This only works with MULTI_LINE. 68 // This only works with MULTI_LINE.
69 CHARACTER_BREAK = 1 << 8, 69 CHARACTER_BREAK = 1 << 8,
70 70
71 // Instructs DrawStringRect() to not use subpixel rendering. This is useful 71 // Instructs DrawStringRect() to not use subpixel rendering. This is useful
72 // when rendering text onto a fully- or partially-transparent background 72 // when rendering text onto a fully- or partially-transparent background
73 // that will later be blended with another image. 73 // that will later be blended with another image.
74 NO_SUBPIXEL_RENDERING = 1 << 9, 74 NO_SUBPIXEL_RENDERING = 1 << 9,
75 }; 75 };
76 76
77 // This class represents a scoped state of a Canvas. When a ScopedState is
tapted 2016/03/21 07:09:04 ui/gfx/scoped_canvas.h?
Elly Fong-Jones 2016/03/21 18:53:56 Ach! The idiom I'm used to is having these Scoped*
78 // constructed, it saves the state of the supplied Canvas; when a ScopedState
79 // is destroyed, it restores the state it saved earlier.
80 class ScopedState {
81 public:
82 ScopedState(Canvas* canvas) : canvas_(canvas) {
83 canvas_->Save();
84 }
85 ~ScopedState() {
86 canvas_->Restore();
87 }
88 private:
89 Canvas* canvas_;
90 };
91
77 // Creates an empty canvas with image_scale of 1x. 92 // Creates an empty canvas with image_scale of 1x.
78 Canvas(); 93 Canvas();
79 94
80 // Creates canvas with provided DIP |size| and |image_scale|. 95 // Creates canvas with provided DIP |size| and |image_scale|.
81 // If this canvas is not opaque, it's explicitly cleared to transparent before 96 // If this canvas is not opaque, it's explicitly cleared to transparent before
82 // being returned. 97 // being returned.
83 Canvas(const Size& size, float image_scale, bool is_opaque); 98 Canvas(const Size& size, float image_scale, bool is_opaque);
84 99
85 // Constructs a canvas with the size and the image_scale of the provided 100 // Constructs a canvas with the size and the image_scale of the provided
86 // |image_rep|, and draws the |image_rep| into it. 101 // |image_rep|, and draws the |image_rep| into it.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 float image_scale_; 465 float image_scale_;
451 466
452 skia::RefPtr<SkCanvas> canvas_; 467 skia::RefPtr<SkCanvas> canvas_;
453 468
454 DISALLOW_COPY_AND_ASSIGN(Canvas); 469 DISALLOW_COPY_AND_ASSIGN(Canvas);
455 }; 470 };
456 471
457 } // namespace gfx 472 } // namespace gfx
458 473
459 #endif // UI_GFX_CANVAS_H_ 474 #endif // UI_GFX_CANVAS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/native_theme/native_theme.h » ('j') | ui/native_theme/native_theme.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698