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

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

Issue 10785047: Remove all the OS X 10.6 SDK forward declarations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 | « remoting/host/capturer_mac.mm ('k') | ui/gfx/video_decode_acceleration_support_mac.h » ('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) 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 #include "skia/ext/skia_utils_mac.h" 5 #include "skia/ext/skia_utils_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "skia/ext/bitmap_platform_device_mac.h" 14 #include "skia/ext/bitmap_platform_device_mac.h"
15 #include "third_party/skia/include/core/SkRegion.h" 15 #include "third_party/skia/include/core/SkRegion.h"
16 #include "third_party/skia/include/utils/mac/SkCGUtils.h" 16 #include "third_party/skia/include/utils/mac/SkCGUtils.h"
17 17
18 // 10.6 API that we use if available.
19 #if !defined(MAC_OS_X_VERSION_10_6) || \
20 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
21
22 @interface NSImageRep (NSObject)
23
24 - (BOOL)drawInRect:(NSRect)dstSpacePortionRect
25 fromRect:(NSRect)srcSpacePortionRect
26 operation:(NSCompositingOperation)op
27 fraction:(CGFloat)requestedAlpha
28 respectFlipped:(BOOL)respectContextIsFlipped
29 hints:(NSDictionary*)hints;
30
31 @end
32
33 #endif // OSes < Mac OS X 10.6
34
35 namespace { 18 namespace {
36 19
37 // Draws an NSImage or an NSImageRep with a given size into a SkBitmap. 20 // Draws an NSImage or an NSImageRep with a given size into a SkBitmap.
38 SkBitmap NSImageOrNSImageRepToSkBitmap( 21 SkBitmap NSImageOrNSImageRepToSkBitmap(
39 NSImage* image, 22 NSImage* image,
40 NSImageRep* image_rep, 23 NSImageRep* image_rep,
41 NSSize size, 24 NSSize size,
42 bool is_opaque) { 25 bool is_opaque) {
43 // Only image or image_rep should be provided, not both. 26 // Only image or image_rep should be provided, not both.
44 DCHECK((image != 0) ^ (image_rep != 0)); 27 DCHECK((image != 0) ^ (image_rep != 0));
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // Apply content matrix. 421 // Apply content matrix.
439 SkMatrix skMatrix = canvas_->getTotalMatrix(); 422 SkMatrix skMatrix = canvas_->getTotalMatrix();
440 skMatrix.postTranslate(-SkIntToScalar(pt.fX), -SkIntToScalar(pt.fY)); 423 skMatrix.postTranslate(-SkIntToScalar(pt.fX), -SkIntToScalar(pt.fY));
441 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix); 424 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix);
442 CGContextConcatCTM(cgContext_, affine); 425 CGContextConcatCTM(cgContext_, affine);
443 426
444 return cgContext_; 427 return cgContext_;
445 } 428 }
446 429
447 } // namespace gfx 430 } // namespace gfx
OLDNEW
« no previous file with comments | « remoting/host/capturer_mac.mm ('k') | ui/gfx/video_decode_acceleration_support_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698