forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverting r19244 as it unintentionally broke ui tests: OtherRedirects…
…DontForkProcess InEmptyFrame TestLifetimeOfDomAutomationController git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19245 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
avi@chromium.org
committed
Jun 25, 2009
1 parent
ef8ca82
commit a4ae3e1
Showing
9 changed files
with
82 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2009 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. | ||
|
||
#include <Cocoa/Cocoa.h> | ||
#include "third_party/skia/include/core/SkBitmap.h" | ||
|
||
// Generic Cocoa utilities which fit nowhere else. | ||
|
||
namespace CocoaUtils { | ||
|
||
// Given an SkBitmap, return an autoreleased NSImage. This function | ||
// was not placed in | ||
// third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp since that | ||
// would make Skia dependent on Cocoa. | ||
NSImage* SkBitmapToNSImage(const SkBitmap& icon); | ||
|
||
|
||
}; // namespace CocoaUtils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2009 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. | ||
|
||
#include <base/logging.h> | ||
#include "chrome/browser/cocoa/cocoa_utils.h" | ||
#import <QuartzCore/CIImage.h> | ||
#include "third_party/skia/include/utils/mac/SkCGUtils.h" | ||
#include "third_party/skia/include/core/SkColorPriv.h" | ||
|
||
namespace { | ||
|
||
// Callback passed to CGDataProviderCreateWithData() | ||
void ReleaseData(void* info, const void* pixelData, size_t size) { | ||
// info is a non-const pixelData | ||
if (info) | ||
free(info); | ||
} | ||
|
||
} | ||
|
||
namespace CocoaUtils { | ||
|
||
NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) { | ||
// First convert SkBitmap to CGImageRef. | ||
CGImageRef cgimage = SkCreateCGImageRef(skiaBitmap); | ||
|
||
// Now convert to NSImage. | ||
NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] | ||
initWithCGImage:cgimage] autorelease]; | ||
CFRelease(cgimage); | ||
NSImage* image = [[[NSImage alloc] init] autorelease]; | ||
[image addRepresentation:bitmap]; | ||
return image; | ||
} | ||
|
||
} // namespace CocoaUtils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters