OLD | NEW |
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/bitmap_platform_device_mac.h" | 5 #include "skia/ext/bitmap_platform_device_mac.h" |
6 | 6 |
7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
8 #include <time.h> | 8 #include <time.h> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bounds.size.width = width(); | 230 bounds.size.width = width(); |
231 bounds.size.height = height(); | 231 bounds.size.height = height(); |
232 CGContextDrawImage(context, bounds, image); | 232 CGContextDrawImage(context, bounds, image); |
233 } | 233 } |
234 CGImageRelease(image); | 234 CGImageRelease(image); |
235 | 235 |
236 if (created_dc) | 236 if (created_dc) |
237 ReleaseBitmapContext(); | 237 ReleaseBitmapContext(); |
238 } | 238 } |
239 | 239 |
240 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const SkImageInfo& info, | 240 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
241 Usage /*usage*/) { | 241 const CreateInfo& info) { |
242 SkASSERT(info.colorType() == kN32_SkColorType); | 242 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
243 return BitmapPlatformDevice::CreateAndClear(info.width(), info.height(), | 243 return BitmapPlatformDevice::CreateAndClear(info.fInfo.width(), |
244 info.isOpaque()); | 244 info.fInfo.height(), |
| 245 info.fInfo.isOpaque()); |
245 } | 246 } |
246 | 247 |
247 // PlatformCanvas impl | 248 // PlatformCanvas impl |
248 | 249 |
249 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, | 250 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, |
250 bool is_opaque, OnFailureType failureType) { | 251 bool is_opaque, OnFailureType failureType) { |
251 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 252 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
252 BitmapPlatformDevice::Create(ctx, width, height, is_opaque)); | 253 BitmapPlatformDevice::Create(ctx, width, height, is_opaque)); |
253 return CreateCanvas(dev, failureType); | 254 return CreateCanvas(dev, failureType); |
254 } | 255 } |
(...skipping 21 matching lines...) Expand all Loading... |
276 | 277 |
277 if (!is_opaque) | 278 if (!is_opaque) |
278 bitmap_.eraseColor(0); | 279 bitmap_.eraseColor(0); |
279 | 280 |
280 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), | 281 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), |
281 bitmap_.height()); | 282 bitmap_.height()); |
282 return true; | 283 return true; |
283 } | 284 } |
284 | 285 |
285 } // namespace skia | 286 } // namespace skia |
OLD | NEW |