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 // until skia lands its new virtual for this method | |
286 return onCreateCompatibleDevice(cinfo); | |
287 } | |
288 | |
289 // PlatformCanvas impl | 283 // PlatformCanvas impl |
290 | 284 |
291 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, | 285 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, |
292 bool is_opaque, OnFailureType failureType) { | 286 bool is_opaque, OnFailureType failureType) { |
293 const bool do_clear = false; | 287 const bool do_clear = false; |
294 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 288 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
295 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); | 289 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); |
296 return CreateCanvas(dev, failureType); | 290 return CreateCanvas(dev, failureType); |
297 } | 291 } |
298 | 292 |
(...skipping 20 matching lines...) Expand all Loading... |
319 | 313 |
320 if (!is_opaque) | 314 if (!is_opaque) |
321 bitmap_.eraseColor(0); | 315 bitmap_.eraseColor(0); |
322 | 316 |
323 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), | 317 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), |
324 bitmap_.height()); | 318 bitmap_.height()); |
325 return true; | 319 return true; |
326 } | 320 } |
327 | 321 |
328 } // namespace skia | 322 } // namespace skia |
OLD | NEW |