summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp')
-rw-r--r--Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp b/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp
index 29589f4..afaa6f7 100644
--- a/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp
+++ b/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp
@@ -34,7 +34,7 @@
#include "PlatformContextSkia.h"
#include "SkColorPriv.h"
#include "skia/ext/platform_canvas.h"
-#elif PLATFORM(CG)
+#elif USE(CG)
#include <CoreGraphics/CGBitmapContext.h>
#endif
@@ -52,8 +52,8 @@ void PlatformCanvas::resize(const IntSize& size)
{
m_size = size;
#if USE(SKIA)
- m_skiaCanvas = new skia::PlatformCanvas(size.width(), size.height(), false);
-#elif PLATFORM(CG)
+ m_skiaCanvas = skia::CreateBitmapCanvas(size.width(), size.height(), false);
+#elif USE(CG)
size_t bufferSize = size.width() * size.height() * 4;
m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]);
memset(m_pixelData.get(), 0, bufferSize);
@@ -73,8 +73,9 @@ PlatformCanvas::AutoLocker::AutoLocker(PlatformCanvas* canvas)
m_pixels = static_cast<uint8_t*>(m_bitmap->getPixels());
} else
m_bitmap = 0;
-#elif PLATFORM(CG)
- m_pixels = &canvas->m_pixelData[0];
+#elif USE(CG)
+ if (canvas->m_pixelData)
+ m_pixels = &canvas->m_pixelData[0];
#endif
}
@@ -86,16 +87,15 @@ PlatformCanvas::AutoLocker::~AutoLocker()
#endif
}
-PlatformCanvas::Painter::Painter(PlatformCanvas* canvas)
+PlatformCanvas::Painter::Painter(PlatformCanvas* canvas, PlatformCanvas::Painter::TextOption option)
{
#if USE(SKIA)
m_skiaContext = adoptPtr(new PlatformContextSkia(canvas->m_skiaCanvas.get()));
- // This is needed to get text to show up correctly.
- m_skiaContext->setDrawingToImageBuffer(true);
+ m_skiaContext->setDrawingToImageBuffer(option == GrayscaleText);
m_context = adoptPtr(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get())));
-#elif PLATFORM(CG)
+#elif USE(CG)
m_colorSpace = CGColorSpaceCreateDeviceRGB();
size_t rowBytes = canvas->size().width() * 4;