diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-04 18:21:12 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-04 18:21:12 +0000 |
commit | d60655b86f1d6a15e88ca51a77ccb7d3a3945612 (patch) | |
tree | ef45576279e8b904b3ffb50a25df5401d9098ec4 /chrome/browser/cocoa/image_utils.h | |
parent | e9b084c2af3b8831f1d872691184da32e7df5b92 (diff) | |
download | chromium_src-d60655b86f1d6a15e88ca51a77ccb7d3a3945612.zip chromium_src-d60655b86f1d6a15e88ca51a77ccb7d3a3945612.tar.gz chromium_src-d60655b86f1d6a15e88ca51a77ccb7d3a3945612.tar.bz2 |
[Mac] Image-drawing which doesn't require image-flipping.
Snow Leopard deprecated -[NSImage setFlipped:] for good reasons. This
implements a method similar to the new
-[NSImage drawInRect:*:respectFlipped:] method, which allows images to
be drawn so that they always look right visually regardless of the
-isFlipped status of the view being drawn.
BUG=38943
TEST=Autocomplete, download, and reload button look right.
Review URL: http://codereview.chromium.org/2587003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/image_utils.h')
-rw-r--r-- | chrome/browser/cocoa/image_utils.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/image_utils.h b/chrome/browser/cocoa/image_utils.h new file mode 100644 index 0000000..36a3bb45 --- /dev/null +++ b/chrome/browser/cocoa/image_utils.h @@ -0,0 +1,25 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_COCOA_IMAGE_UTILS_H_ +#define CHROME_BROWSER_COCOA_IMAGE_UTILS_H_ + +#import <Cocoa/Cocoa.h> + +@interface NSImage (FlippedAdditions) + +// Works like |-drawInRect:fromRect:operation:fraction:|, except that +// if |neverFlipped| is |YES|, and the context is flipped, the a +// transform is applied to flip it again before drawing the image. +// +// Compare to the 10.6 method +// |-drawInRect:fromRect:operation:fraction:respectFlipped:hints:|. +- (void)drawInRect:(NSRect)dstRect + fromRect:(NSRect)srcRect + operation:(NSCompositingOperation)op + fraction:(CGFloat)requestedAlpha + neverFlipped:(BOOL)neverFlipped; +@end + +#endif // CHROME_BROWSER_COCOA_IMAGE_UTILS_H_ |