Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Unified Diff: src/views/SkWindow.cpp

Issue 580073003: use surface in SkView/SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleBitmapRect.cpp ('k') | src/views/mac/SkNSView.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/SkWindow.cpp
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 99c2d30e8a6afe44c6fcb8c9950df1e046f9614a..90ef2804e672cb956a6c1ac2e0e9e141e00335ea 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 @@ SkWindow::~SkWindow() {
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 @@ bool SkWindow::update(SkIRect* updateArea) {
bm.setPixels(buffer);
#endif
- SkAutoTUnref<SkCanvas> canvas(this->createCanvas());
+ SkAutoTUnref<SkSurface> surface(this->createSurface());
+ SkCanvas* canvas = surface->getCanvas();
canvas->clipRegion(fDirtyRgn);
if (updateArea)
« no previous file with comments | « samplecode/SampleBitmapRect.cpp ('k') | src/views/mac/SkNSView.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698