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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.cc

Issue 2607603004: Remove PlatformCanvas::GetBitmapContext() (Closed)
Patch Set: Mac build fix Created 3 years, 11 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
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 <stddef.h> 8 #include <stddef.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // We must save the state once so that we can use the restore/save trick 237 // We must save the state once so that we can use the restore/save trick
238 // in LoadConfig(). 238 // in LoadConfig().
239 CGContextSaveGState(bitmap_context_); 239 CGContextSaveGState(bitmap_context_);
240 } 240 }
241 241
242 BitmapPlatformDevice::~BitmapPlatformDevice() { 242 BitmapPlatformDevice::~BitmapPlatformDevice() {
243 if (bitmap_context_) 243 if (bitmap_context_)
244 CGContextRelease(bitmap_context_); 244 CGContextRelease(bitmap_context_);
245 } 245 }
246 246
247 CGContextRef BitmapPlatformDevice::GetBitmapContext(const SkMatrix& transform, 247 NativeDrawingContext BitmapPlatformDevice::BeginPlatformPaint(
248 const SkIRect& clip_bounds) { 248 const SkMatrix& transform,
249 const SkIRect& clip_bounds) {
249 LoadConfig(transform, clip_bounds); 250 LoadConfig(transform, clip_bounds);
250 return bitmap_context_; 251 return bitmap_context_;
251 } 252 }
252 253
253 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, 254 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo,
254 const SkPaint*) { 255 const SkPaint*) {
255 const SkImageInfo& info = cinfo.fInfo; 256 const SkImageInfo& info = cinfo.fInfo;
256 const bool do_clear = !info.isOpaque(); 257 const bool do_clear = !info.isOpaque();
257 SkASSERT(info.colorType() == kN32_SkColorType); 258 SkASSERT(info.colorType() == kN32_SkColorType);
258 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); 259 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear);
259 } 260 }
260 261
261 // PlatformCanvas impl 262 // PlatformCanvas impl
262 263
263 std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( 264 std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels(
264 int width, 265 int width,
265 int height, 266 int height,
266 bool is_opaque, 267 bool is_opaque,
267 uint8_t* data, 268 uint8_t* data,
268 OnFailureType failureType) { 269 OnFailureType failureType) {
269 sk_sp<SkBaseDevice> dev( 270 sk_sp<SkBaseDevice> dev(
270 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); 271 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque));
271 return CreateCanvas(dev, failureType); 272 return CreateCanvas(dev, failureType);
272 } 273 }
273 274
274 } // namespace skia 275 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698