| Index: skia/ext/platform_canvas_mac.cc | 
| diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc | 
| index 380a78b409e650922138270dc60c00807483604f..9ada02d9630272d70b8a952be9cd648dc2445e9e 100755 | 
| --- a/skia/ext/platform_canvas_mac.cc | 
| +++ b/skia/ext/platform_canvas_mac.cc | 
| @@ -25,6 +25,14 @@ PlatformCanvasMac::PlatformCanvasMac(int width, | 
| initialize(width, height, is_opaque); | 
| } | 
|  | 
| +PlatformCanvasMac::PlatformCanvasMac(int width, | 
| +                                     int height, | 
| +                                     bool is_opaque, | 
| +                                     uint8_t* data) | 
| +    : SkCanvas() { | 
| +  initialize(width, height, is_opaque, data); | 
| +} | 
| + | 
| PlatformCanvasMac::~PlatformCanvasMac() { | 
| } | 
|  | 
| @@ -40,6 +48,33 @@ bool PlatformCanvasMac::initialize(int width, | 
| return true; | 
| } | 
|  | 
| +bool PlatformCanvasMac::initialize(int width, | 
| +                                   int height, | 
| +                                   bool is_opaque, | 
| +                                   uint8_t* data) { | 
| +  CGContextRef context = NULL; | 
| +  CGColorSpaceRef colorSpace; | 
| + | 
| +  colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); | 
| +  context = CGBitmapContextCreate( | 
| +      data, width, height, 8 /* bits per plane */, 4 * width /* stride */, | 
| +      colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); | 
| +  CGColorSpaceRelease(colorSpace); | 
| +  if (!context) | 
| +    return false; | 
| +  // Change the coordinate system to match WebCore's | 
| +  CGContextTranslateCTM(context, 0, height); | 
| +  CGContextScaleCTM(context, 1.0, -1.0); | 
| + | 
| +  SkDevice* device = createPlatformDevice(width, height, is_opaque, context); | 
| +  if (!device) | 
| +    return false; | 
| + | 
| +  setDevice(device); | 
| +  device->unref();  // was created with refcount 1, and setDevice also refs | 
| +  return true; | 
| +} | 
| + | 
| CGContextRef PlatformCanvasMac::beginPlatformPaint() { | 
| return getTopPlatformDevice().GetBitmapContext(); | 
| } | 
|  |