diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 23:51:09 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 23:51:09 +0000 |
commit | 83c6bda785fa8fffa47bf2af47513d9bd399e7ca (patch) | |
tree | f61a3feefe2e88805f49c6408426a40bdae9af1a /webkit | |
parent | b767c3cba89315029209f1f898d7cea1da7a8aa0 (diff) | |
download | chromium_src-83c6bda785fa8fffa47bf2af47513d9bd399e7ca.zip chromium_src-83c6bda785fa8fffa47bf2af47513d9bd399e7ca.tar.gz chromium_src-83c6bda785fa8fffa47bf2af47513d9bd399e7ca.tar.bz2 |
Address reivew comments from previous patch.
Review URL: http://codereview.chromium.org/9703
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/platform/graphics/ImageBufferSkia.cpp | 3 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.cpp | 9 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.h | 8 |
3 files changed, 14 insertions, 6 deletions
diff --git a/webkit/port/platform/graphics/ImageBufferSkia.cpp b/webkit/port/platform/graphics/ImageBufferSkia.cpp index 9b14c05..42e9a9f 100644 --- a/webkit/port/platform/graphics/ImageBufferSkia.cpp +++ b/webkit/port/platform/graphics/ImageBufferSkia.cpp @@ -48,7 +48,7 @@ namespace WebCore { // the ownership easier to manage. ImageBufferData::ImageBufferData(const IntSize& size) : m_canvas() - , m_platformContext(&m_canvas) + , m_platformContext(NULL) // Canvas is set in ImageBuffer constructor. { } @@ -61,6 +61,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, bool grayScale, bool& success) return; } + m_data.m_platformContext.setCanvas(&m_data.m_canvas); m_context.set(new GraphicsContext(&m_data.m_platformContext)); // Make the background transparent. It would be nice if this wasn't diff --git a/webkit/port/platform/graphics/PlatformContextSkia.cpp b/webkit/port/platform/graphics/PlatformContextSkia.cpp index 351e8ea..dd50cb0 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.cpp +++ b/webkit/port/platform/graphics/PlatformContextSkia.cpp @@ -138,9 +138,7 @@ SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const // PlatformContextSkia --------------------------------------------------------- -// Danger: the canvas is not guaranteed to be initialized yet, so we can't use -// it in the constructor. In ImageBufferSkia, we pass a canvas in here that will -// be initialized at a later phase. +// Danger: canvas can be NULL. PlatformContextSkia::PlatformContextSkia(gfx::PlatformCanvas* canvas) : m_canvas(canvas) , m_stateStack(sizeof(State)) @@ -153,6 +151,11 @@ PlatformContextSkia::~PlatformContextSkia() { } +void PlatformContextSkia::setCanvas(gfx::PlatformCanvas* canvas) +{ + m_canvas = canvas; +} + void PlatformContextSkia::save() { m_stateStack.append(*m_state); diff --git a/webkit/port/platform/graphics/PlatformContextSkia.h b/webkit/port/platform/graphics/PlatformContextSkia.h index ecc56020..a0c72e0 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.h +++ b/webkit/port/platform/graphics/PlatformContextSkia.h @@ -59,12 +59,16 @@ // state to be pushed and popped along with the bitmap. class PlatformContextSkia { public: - // For printing, there shouldn't be any canvas. canvas can be NULL. + // For printing, there shouldn't be any canvas. canvas can be NULL. If you + // supply a NULL canvas, you can also call setCanvas later. PlatformContextSkia(gfx::PlatformCanvas* canvas); ~PlatformContextSkia(); - void save(); + // Sets the canvas associated with this context. Use when supplying NULL + // to the constructor. + void setCanvas(gfx::PlatformCanvas* canvas); + void save(); void restore(); // Sets up the common flags on a paint for antialiasing, effects, etc. |