diff options
author | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 17:33:18 +0000 |
---|---|---|
committer | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 17:33:18 +0000 |
commit | 81ac89b73f48fc3bd320295609252767d0d78056 (patch) | |
tree | 60d3cdf818a6245d531022487577df3e201d8ef0 /ui/gfx/canvas_skia.cc | |
parent | e265ad798d7713116f2e9168eaa4913854029c20 (diff) | |
download | chromium_src-81ac89b73f48fc3bd320295609252767d0d78056.zip chromium_src-81ac89b73f48fc3bd320295609252767d0d78056.tar.gz chromium_src-81ac89b73f48fc3bd320295609252767d0d78056.tar.bz2 |
Remove redundant memory clears when constructing BitmapPlatformDevice instances on Mac and Windows. PlatformCanvas construction is showing up as a performance bottleneck due to unnecessary initialization.
The change moves the clear to the call sites where it is necessary.
Note: On Linux, cairo always allocates an initialized surface, so there is no way to bypass the performance penalty.
BUG=112009
TEST=All of them
Review URL: http://codereview.chromium.org/9416017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/canvas_skia.cc')
-rw-r--r-- | ui/gfx/canvas_skia.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc index 71c7de0..a74a0f6 100644 --- a/ui/gfx/canvas_skia.cc +++ b/ui/gfx/canvas_skia.cc @@ -54,6 +54,12 @@ CanvasSkia::CanvasSkia(const gfx::Size& size, bool is_opaque) : owned_canvas_(new skia::PlatformCanvas(size.width(), size.height(), is_opaque)), canvas_(owned_canvas_.get()) { +#if defined(OS_WIN) || defined(OS_MACOSX) + // skia::PlatformCanvas instances are initialized to 0 by Cairo on Linux, but + // uninitialized on Win and Mac. + if (!is_opaque) + owned_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); +#endif } CanvasSkia::CanvasSkia(const SkBitmap& bitmap, bool is_opaque) |