Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "SkRasterCanvasLayerAllocator.h" | |
| 9 | |
| 10 #include "SkBitmapDevice.h" | |
| 11 | |
| 12 SkRasterCanvasLayerAllocator::SkRasterCanvasLayerAllocator() { } | |
| 13 | |
| 14 SkRasterCanvasLayerAllocator::~SkRasterCanvasLayerAllocator() { } | |
| 15 | |
| 16 SkCanvas* SkRasterCanvasLayerAllocator::CreateCanvas(const SkImageInfo& info, | |
| 17 const SkSurfaceProps& props , | |
| 18 void* initialData) { | |
| 19 SkAutoTUnref<SkBaseDevice> newDevice; | |
| 20 SkBitmap bitmap; | |
| 21 size_t rowBytes; | |
| 22 void* pixels = this->allocateLayer(info, &rowBytes, initialData); | |
| 23 if (!pixels) { | |
| 24 return nullptr; | |
| 25 } | |
| 26 bitmap.installPixels(info, pixels, rowBytes); | |
| 27 SkBitmapDevice* device = new SkBitmapDevice(bitmap, props); | |
|
reed1
2016/09/16 13:15:00
why do we allocate a device here?
| |
| 28 return new SkCanvas(bitmap, this); | |
| 29 } | |
| 30 | |
| 31 | |
| OLD | NEW |