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

Unified Diff: gm/extractbitmap.cpp

Issue 154163002: remove SkCanvas::createCompatibleDevice, and add SkCanvas::newSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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
Index: gm/extractbitmap.cpp
diff --git a/gm/extractbitmap.cpp b/gm/extractbitmap.cpp
index efc5d3531a4a9ea8e27a5ff984bc69b5832836fb..6e7409da2de45c03b646bf6d6b595b3372e9ffa5 100644
--- a/gm/extractbitmap.cpp
+++ b/gm/extractbitmap.cpp
@@ -1,15 +1,16 @@
-
/*
* 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 "gm.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkString.h"
+#include "SkSurface.h"
scroggo 2014/02/05 16:41:12 Did you mean to call newSurface in this file? It c
namespace skiagm {
@@ -71,24 +72,6 @@ protected:
canvas->translate(0, SkIntToScalar(bitmap.height() + 20));
canvas->drawBitmap(subset, 0, 0);
}
-
- // Now do the same but with a device bitmap as source image
- SkAutoTUnref<SkBaseDevice> secondDevice(canvas->createCompatibleDevice(
- SkBitmap::kARGB_8888_Config, bitmap.width(),
- bitmap.height(), true));
- SkCanvas secondCanvas(secondDevice.get());
- secondCanvas.writePixels(bitmap, 0, 0);
-
- SkBitmap deviceBitmap = secondDevice->accessBitmap(false);
- SkBitmap deviceSubset;
- deviceBitmap.extractSubset(&deviceSubset,
- SkIRect::MakeXYWH(x, y, x, y));
-
- canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
-
- canvas->drawBitmap(deviceBitmap, 0, 0);
- canvas->drawBitmap(deviceSubset, 0, 0);
-
}
private:

Powered by Google App Engine
This is Rietveld 408576698