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

Side by Side Diff: ui/base/clipboard/clipboard_mac.mm

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 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 | Annotate | Revision Log
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 "ui/base/clipboard/clipboard.h" 5 #include "ui/base/clipboard/clipboard.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 nil] 152 nil]
153 owner:nil]; 153 owner:nil];
154 [nsurl writeToPasteboard:pb]; 154 [nsurl writeToPasteboard:pb];
155 [pb setString:title forType:kUTTypeURLName]; 155 [pb setString:title forType:kUTTypeURLName];
156 } 156 }
157 157
158 void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) { 158 void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) {
159 const gfx::Size* size = reinterpret_cast<const gfx::Size*>(size_data); 159 const gfx::Size* size = reinterpret_cast<const gfx::Size*>(size_data);
160 160
161 // Safe because the image goes away before the call returns. 161 // Safe because the image goes away before the call returns.
162 base::mac::ScopedCFTypeRef<CFDataRef> data( 162 base::ScopedCFTypeRef<CFDataRef> data(
163 CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, 163 CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
164 reinterpret_cast<const UInt8*>(pixel_data), 164 reinterpret_cast<const UInt8*>(pixel_data),
165 size->width()*size->height()*4, 165 size->width() * size->height() * 4,
166 kCFAllocatorNull)); 166 kCFAllocatorNull));
167 167
168 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 168 base::ScopedCFTypeRef<CGDataProviderRef> data_provider(
169 CGDataProviderCreateWithCFData(data)); 169 CGDataProviderCreateWithCFData(data));
170 170
171 base::mac::ScopedCFTypeRef<CGImageRef> cgimage( 171 base::ScopedCFTypeRef<CGImageRef> cgimage(
172 CGImageCreate(size->width(), 172 CGImageCreate(size->width(),
173 size->height(), 173 size->height(),
174 8, 174 8,
175 32, 175 32,
176 size->width()*4, 176 size->width() * 4,
177 base::mac::GetSRGBColorSpace(), // TODO(avi): do better 177 base::mac::GetSRGBColorSpace(), // TODO(avi): do better
178 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, 178 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
179 data_provider, 179 data_provider,
180 NULL, 180 NULL,
181 false, 181 false,
182 kCGRenderingIntentDefault)); 182 kCGRenderingIntentDefault));
183 // Aggressively free storage since image buffers can potentially be very 183 // Aggressively free storage since image buffers can potentially be very
184 // large. 184 // large.
185 data_provider.reset(); 185 data_provider.reset();
186 data.reset(); 186 data.reset();
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 return type; 479 return type;
480 } 480 }
481 481
482 // static 482 // static
483 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { 483 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() {
484 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kPepperCustomDataPboardType)); 484 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kPepperCustomDataPboardType));
485 return type; 485 return type;
486 } 486 }
487 487
488 } // namespace ui 488 } // namespace ui
OLDNEW
« no previous file with comments | « third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc ('k') | ui/base/resource/resource_bundle_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698