diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-31 19:42:58 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-31 19:42:58 +0000 |
commit | e254310a55d55a710309714c48f7fbbe7a6126f7 (patch) | |
tree | 4676918f0af988ca0f21fefb948477e818244cf0 /src | |
parent | 2fc672dd460ea91e9fc824a35e39518ab838762c (diff) |
add SkCanvas constructor that explicitly creates no_config with dimensions
BUG=skia:
R=scroggo@google.com, halcanary@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/137833016
git-svn-id: http://skia.googlecode.com/svn/trunk@13272 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 21 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 10 | ||||
-rw-r--r-- | src/utils/SkLuaCanvas.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 8 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 8 |
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) |