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

Side by Side Diff: skia/ext/skia_utils_mac.h

Issue 7031006: Add utility for converting SkCanvas to CGContext (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 SKIA_EXT_SKIA_UTILS_MAC_H_ 5 #ifndef SKIA_EXT_SKIA_UTILS_MAC_H_
6 #define SKIA_EXT_SKIA_UTILS_MAC_H_ 6 #define SKIA_EXT_SKIA_UTILS_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include <CoreGraphics/CGColor.h> 9 #include <CoreGraphics/CGColor.h>
10 #include <vector> 10 #include <vector>
11 11
12 #include "third_party/skia/include/core/SkColor.h" 12 #include "third_party/skia/include/core/SkColor.h"
13 13
14 struct SkIRect; 14 struct SkIRect;
15 struct SkPoint; 15 struct SkPoint;
16 struct SkRect; 16 struct SkRect;
17 class SkBitmap; 17 class SkBitmap;
18 class SkCanvas;
18 class SkMatrix; 19 class SkMatrix;
19 #ifdef __LP64__ 20 #ifdef __LP64__
20 typedef CGSize NSSize; 21 typedef CGSize NSSize;
21 #else 22 #else
22 typedef struct _NSSize NSSize; 23 typedef struct _NSSize NSSize;
23 #endif 24 #endif
24 25
25 #ifdef __OBJC__ 26 #ifdef __OBJC__
26 @class NSImage; 27 @class NSImage;
27 @class NSImageRep; 28 @class NSImageRep;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // TODO(thakis): Remove this -- http://crbug.com/69432 80 // TODO(thakis): Remove this -- http://crbug.com/69432
80 NSImage* SkBitmapToNSImage(const SkBitmap& icon); 81 NSImage* SkBitmapToNSImage(const SkBitmap& icon);
81 82
82 // Given a vector of SkBitmaps, return an NSImage with each bitmap added 83 // Given a vector of SkBitmaps, return an NSImage with each bitmap added
83 // as a representation. 84 // as a representation.
84 NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps); 85 NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps);
85 86
86 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap. 87 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap.
87 SkBitmap AppplicationIconAtSize(int size); 88 SkBitmap AppplicationIconAtSize(int size);
88 89
90 // Converts a SkCanvas temporarily to a CGContext
91 class SkiaBitLocker {
92 public:
93 explicit SkiaBitLocker(SkCanvas* canvas);
94 ~SkiaBitLocker();
95 CGContextRef cgContext();
96
97 private:
98 void releaseIfNeeded();
99 SkCanvas* canvas_;
100 CGContextRef cgContext_;
101 };
102
103
89 } // namespace gfx 104 } // namespace gfx
90 105
91 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ 106 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698