aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkCanvas.cpp21
-rw-r--r--src/utils/SkDumpCanvas.cpp10
-rw-r--r--src/utils/SkLuaCanvas.cpp8
-rw-r--r--src/utils/SkNWayCanvas.cpp8
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp8
5 files changed, 22 insertions, 33 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index a5fa30ff2d..45c196448d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -505,21 +505,34 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
}
SkCanvas::SkCanvas()
-: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
+ : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
+{
inc_canvas();
-
+
this->init(NULL);
}
+SkCanvas::SkCanvas(int width, int height)
+ : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
+{
+ inc_canvas();
+
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kNo_Config, width, height);
+ this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
+}
+
SkCanvas::SkCanvas(SkBaseDevice* device)
- : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
+ : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
+{
inc_canvas();
this->init(device);
}
SkCanvas::SkCanvas(const SkBitmap& bitmap)
- : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
+ : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
+{
inc_canvas();
this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index dabf0d7989..5f3a572ab9 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -163,15 +163,9 @@ static void toString(const void* text, size_t byteLen, SkPaint::TextEncoding enc
///////////////////////////////////////////////////////////////////////////////
-static SkBitmap make_wideopen_bm() {
- static const int WIDE_OPEN = 16384;
+#define WIDE_OPEN 16384
- SkBitmap bm;
- bm.setConfig(SkBitmap::kNo_Config, WIDE_OPEN, WIDE_OPEN);
- return bm;
-}
-
-SkDumpCanvas::SkDumpCanvas(Dumper* dumper) : INHERITED(make_wideopen_bm()) {
+SkDumpCanvas::SkDumpCanvas(Dumper* dumper) : INHERITED(WIDE_OPEN, WIDE_OPEN) {
fNestLevel = 0;
SkSafeRef(dumper);
fDumper = dumper;
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 0136231ce1..7f127403ae 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -73,14 +73,8 @@ void SkLuaCanvas::pushThis() {
///////////////////////////////////////////////////////////////////////////////
-static SkBitmap make_bm(int width, int height) {
- SkBitmap bm;
- bm.setConfig(SkBitmap::kNo_Config, width, height);
- return bm;
-}
-
SkLuaCanvas::SkLuaCanvas(int width, int height, lua_State* L, const char func[])
- : INHERITED(make_bm(width, height))
+ : INHERITED(width, height)
, fL(L)
, fFunc(func) {
}
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index da8bdb6f41..831d7bf6cf 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -7,14 +7,8 @@
*/
#include "SkNWayCanvas.h"
-static SkBitmap make_noconfig_bm(int width, int height) {
- SkBitmap bm;
- bm.setConfig(SkBitmap::kNo_Config, width, height);
- return bm;
-}
-
SkNWayCanvas::SkNWayCanvas(int width, int height)
- : INHERITED(make_noconfig_bm(width, height)) {}
+ : INHERITED(width, height) {}
SkNWayCanvas::~SkNWayCanvas() {
this->removeAll();
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 1c3e26e643..32a6570954 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -14,14 +14,8 @@
#include "SkDevice.h"
#include "SkXfermode.h"
-static SkBitmap make_noconfig_bm(int width, int height) {
- SkBitmap bm;
- bm.setConfig(SkBitmap::kNo_Config, width, height);
- return bm;
-}
-
SkDebugCanvas::SkDebugCanvas(int width, int height)
- : INHERITED(make_noconfig_bm(width, height))
+ : INHERITED(width, height)
, fWidth(width)
, fHeight(height)
, fFilter(false)