1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "skia/ext/platform_canvas.h"
7 #include "base/debug/trace_event.h"
8 #include "skia/ext/bitmap_platform_device.h"
9 #include "third_party/skia/include/core/SkTypes.h"
13 PlatformCanvas::PlatformCanvas(int width
, int height
, bool is_opaque
) {
14 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
15 "width", width
, "height", height
);
16 initialize(width
, height
, is_opaque
);
19 PlatformCanvas::PlatformCanvas(int width
,
22 CGContextRef context
) {
23 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
24 "width", width
, "height", height
);
25 initialize(context
, width
, height
, is_opaque
);
28 PlatformCanvas::PlatformCanvas(int width
,
32 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
33 "width", width
, "height", height
);
34 initialize(width
, height
, is_opaque
, data
);
37 PlatformCanvas::~PlatformCanvas() {
40 bool PlatformCanvas::initialize(int width
,
44 return initializeWithDevice(BitmapPlatformDevice::CreateWithData(
45 data
, width
, height
, is_opaque
));
48 bool PlatformCanvas::initialize(CGContextRef context
,
52 return initializeWithDevice(BitmapPlatformDevice::Create(
53 context
, width
, height
, is_opaque
));