Removed unused icon resources from app_list.
[chromium-blink-merge.git] / ui / gfx / canvas_paint_mac.h
blobb8d9974db9fcad5bd75c4e3ff8d09c183d662d86
2 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
6 #ifndef UI_GFX_CANVAS_PAINT_MAC_H_
7 #define UI_GFX_CANVAS_PAINT_MAC_H_
9 #include "skia/ext/platform_canvas.h"
10 #include "ui/gfx/canvas.h"
12 #import <Cocoa/Cocoa.h>
14 namespace gfx {
16 // A class designed to translate skia painting into a region to the current
17 // graphics context. On construction, it will set up a context for painting
18 // into, and on destruction, it will commit it to the current context.
19 // Note: The created context is always inialized to (0, 0, 0, 0).
20 class GFX_EXPORT CanvasSkiaPaint : public Canvas {
21 public:
22 // This constructor assumes the result is opaque.
23 explicit CanvasSkiaPaint(NSRect dirtyRect);
24 CanvasSkiaPaint(NSRect dirtyRect, bool opaque);
25 ~CanvasSkiaPaint() override;
27 // If true, the data painted into the CanvasSkiaPaint is blended onto the
28 // current context, else it is copied.
29 void set_composite_alpha(bool composite_alpha) {
30 composite_alpha_ = composite_alpha;
33 // Returns true if the invalid region is empty. The caller should call this
34 // function to determine if anything needs painting.
35 bool is_empty() const {
36 return NSIsEmptyRect(rectangle_);
39 const NSRect& rectangle() const {
40 return rectangle_;
43 private:
44 void Init(bool opaque);
46 CGContext* context_;
47 NSRect rectangle_;
48 // See description above setter.
49 bool composite_alpha_;
51 // Disallow copy and assign.
52 CanvasSkiaPaint(const CanvasSkiaPaint&);
53 CanvasSkiaPaint& operator=(const CanvasSkiaPaint&);
56 } // namespace gfx
59 #endif // UI_GFX_CANVAS_PAINT_MAC_H_