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

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

Issue 2001653002: Remove SkDevice, obsolete constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trim another out-of-date comment Created 4 years, 6 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 | skia/ext/skia_utils_mac.mm » ('j') | skia/ext/skia_utils_mac_unittest.mm » ('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 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 7
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 CGColorSpaceRef colorSpace); 90 CGColorSpaceRef colorSpace);
91 91
92 // Given an SkBitmap, return an autoreleased NSImage in the generic color space. 92 // Given an SkBitmap, return an autoreleased NSImage in the generic color space.
93 // DEPRECATED, use SkBitmapToNSImageWithColorSpace() instead. 93 // DEPRECATED, use SkBitmapToNSImageWithColorSpace() instead.
94 // TODO(thakis): Remove this -- http://crbug.com/69432 94 // TODO(thakis): Remove this -- http://crbug.com/69432
95 SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon); 95 SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon);
96 96
97 // Converts a SkCanvas temporarily to a CGContext 97 // Converts a SkCanvas temporarily to a CGContext
98 class SK_API SkiaBitLocker { 98 class SK_API SkiaBitLocker {
99 public: 99 public:
100 // TODO(ccameron): delete this constructor 100 /**
101 explicit SkiaBitLocker(SkCanvas* canvas); 101 User clip rect is an *additional* clip to be applied in addition to the
102 current state of the canvas, in *local* rather than device coordinates.
103 If no additional clipping is desired, pass in
104 SkIRect::MakeSize(canvas->getBaseLayerSize()).
f(malita) 2016/06/08 13:16:54 If the clip is in local coords, then the last part
tomhudson 2016/06/08 14:19:35 Done.
105 */
102 SkiaBitLocker(SkCanvas* canvas, 106 SkiaBitLocker(SkCanvas* canvas,
103 const SkIRect& userClipRect, 107 const SkIRect& userClipRect,
f(malita) 2016/06/08 13:27:17 Not new to this CL, but userClipRect should be an
tomhudson 2016/06/08 14:19:36 Blink has always provided an IntRect.
104 SkScalar bitmapScaleFactor = 1); 108 SkScalar bitmapScaleFactor = 1);
105 ~SkiaBitLocker(); 109 ~SkiaBitLocker();
106 CGContextRef cgContext(); 110 CGContextRef cgContext();
107 bool hasEmptyClipRegion() const; 111 bool hasEmptyClipRegion() const;
108 112
109 private: 113 private:
110 void releaseIfNeeded(); 114 void releaseIfNeeded();
111 SkIRect computeDirtyRect(); 115 SkIRect computeDirtyRect();
112 116
113 SkCanvas* canvas_; 117 SkCanvas* canvas_;
114 118
115 // If the user specified a clip rect it would draw into then the locker may
116 // skip the step of searching for a rect bounding the pixels that the user
117 // has drawn into.
118 bool userClipRectSpecified_;
119
120 CGContextRef cgContext_; 119 CGContextRef cgContext_;
121 // offscreen_ is only valid if useDeviceBits_ is false 120 // offscreen_ is only valid if useDeviceBits_ is false
122 SkBitmap offscreen_; 121 SkBitmap offscreen_;
123 SkIPoint bitmapOffset_; 122 SkIPoint bitmapOffset_;
124 SkScalar bitmapScaleFactor_; 123 SkScalar bitmapScaleFactor_;
125 124
126 // True if we are drawing to |canvas_|'s backing store directly. 125 // True if we are drawing to |canvas_|'s backing store directly.
127 // Otherwise, the bits in |bitmap_| are our allocation and need to 126 // Otherwise, the bits in |bitmap_| are our allocation and need to
128 // be copied over to |canvas_|. 127 // be copied over to |canvas_|.
129 bool useDeviceBits_; 128 bool useDeviceBits_;
130 129
131 // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating 130 // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating
132 // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not 131 // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not
133 // be copied to |canvas_|. This will happen if |canvas_|'s clip region is 132 // be copied to |canvas_|. This will happen if |canvas_|'s clip region is
134 // empty. 133 // empty.
135 bool bitmapIsDummy_; 134 bool bitmapIsDummy_;
136 }; 135 };
137 136
138 137
139 } // namespace skia 138 } // namespace skia
140 139
141 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ 140 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.mm » ('j') | skia/ext/skia_utils_mac_unittest.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698