Index: src/core/SkRasterCanvasLayerAllocator.cpp |
diff --git a/src/core/SkRasterCanvasLayerAllocator.cpp b/src/core/SkRasterCanvasLayerAllocator.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e76000163ed9516dd26f68a9d970f169415794c |
--- /dev/null |
+++ b/src/core/SkRasterCanvasLayerAllocator.cpp |
@@ -0,0 +1,28 @@ |
+/* |
+ * Copyright 2016 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkRasterCanvasLayerAllocator.h" |
+ |
+#include "SkCanvas.h" |
+#include "SkPaint.h" |
+#include "SkRefCnt.h" |
+ |
+SkRasterCanvasLayerAllocator::SkRasterCanvasLayerAllocator() { } |
+ |
+SkRasterCanvasLayerAllocator::~SkRasterCanvasLayerAllocator() { } |
+ |
+SkCanvas* SkRasterCanvasLayerAllocator::CreateCanvas(const SkImageInfo& info) { |
+ SkBitmap bmp; |
+ size_t rowBytes; |
+ void* layer = this->allocateLayer(info, &rowBytes); |
+ if (layer) { |
+ bmp.installPixels(info, layer, rowBytes); |
+ } |
+ return new SkCanvas(bmp, sk_ref_sp(this)); |
+} |
+ |
+ |