use surface in SkView/SampleApp
BUG=skia:
R=bsalomon@google.com, robertphillips@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/580073003
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 99c2d30..90ef280 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -1,14 +1,14 @@
-
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SkWindow.h"
#include "SkCanvas.h"
-#include "SkDevice.h"
#include "SkOSMenu.h"
+#include "SkSurface.h"
#include "SkSystemEventTypes.h"
#include "SkTime.h"
@@ -32,8 +32,9 @@
fMenus.deleteAll();
}
-SkCanvas* SkWindow::createCanvas() {
- return new SkCanvas(this->getBitmap());
+SkSurface* SkWindow::createSurface() {
+ const SkBitmap& bm = this->getBitmap();
+ return SkSurface::NewRasterDirect(bm.info(), bm.getPixels(), bm.rowBytes());
}
void SkWindow::setMatrix(const SkMatrix& matrix) {
@@ -126,7 +127,8 @@
bm.setPixels(buffer);
#endif
- SkAutoTUnref<SkCanvas> canvas(this->createCanvas());
+ SkAutoTUnref<SkSurface> surface(this->createSurface());
+ SkCanvas* canvas = surface->getCanvas();
canvas->clipRegion(fDirtyRgn);
if (updateArea)