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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 275 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
276 const CreateInfo& cinfo) { | 276 const CreateInfo& cinfo) { |
277 const SkImageInfo& info = cinfo.fInfo; | 277 const SkImageInfo& info = cinfo.fInfo; |
278 const bool do_clear = !info.isOpaque(); | 278 const bool do_clear = !info.isOpaque(); |
279 SkASSERT(info.colorType() == kN32_SkColorType); | 279 SkASSERT(info.colorType() == kN32_SkColorType); |
280 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); | 280 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); |
281 } | 281 } |
282 | 282 |
| 283 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, |
| 284 const SkPaint*) { |
| 285 const SkImageInfo& info = cinfo.fInfo; |
| 286 const bool do_clear = !info.isOpaque(); |
| 287 SkASSERT(info.colorType() == kN32_SkColorType); |
| 288 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); |
| 289 } |
| 290 |
283 // PlatformCanvas impl | 291 // PlatformCanvas impl |
284 | 292 |
285 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, | 293 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, |
286 bool is_opaque, OnFailureType failureType) { | 294 bool is_opaque, OnFailureType failureType) { |
287 const bool do_clear = false; | 295 const bool do_clear = false; |
288 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 296 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
289 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); | 297 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); |
290 return CreateCanvas(dev, failureType); | 298 return CreateCanvas(dev, failureType); |
291 } | 299 } |
292 | 300 |
(...skipping 20 matching lines...) Expand all Loading... |
313 | 321 |
314 if (!is_opaque) | 322 if (!is_opaque) |
315 bitmap_.eraseColor(0); | 323 bitmap_.eraseColor(0); |
316 | 324 |
317 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), | 325 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), |
318 bitmap_.height()); | 326 bitmap_.height()); |
319 return true; | 327 return true; |
320 } | 328 } |
321 | 329 |
322 } // namespace skia | 330 } // namespace skia |
OLD | NEW |