diff options
Diffstat (limited to 'WebCore/platform/graphics/skia/PlatformContextSkia.cpp')
-rw-r--r-- | WebCore/platform/graphics/skia/PlatformContextSkia.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index b469312..3f9e4c1 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -34,12 +34,10 @@ #include "AffineTransform.h" #include "DrawingBuffer.h" -#include "GLES2Canvas.h" #include "GraphicsContext.h" #include "GraphicsContext3D.h" #include "ImageBuffer.h" #include "NativeImageSkia.h" -#include "SharedGraphicsContext3D.h" #include "SkiaUtils.h" #include "Texture.h" #include "TilingData.h" @@ -56,6 +54,11 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/Vector.h> +#if ENABLE(ACCELERATED_2D_CANVAS) +#include "GLES2Canvas.h" +#include "SharedGraphicsContext3D.h" +#endif + namespace WebCore { extern bool isPathSkiaSafe(const SkMatrix& transform, const SkPath& path); @@ -207,7 +210,9 @@ PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas) : m_canvas(canvas) , m_drawingToImageBuffer(false) , m_useGPU(false) +#if ENABLE(ACCELERATED_2D_CANVAS) , m_gpuCanvas(0) +#endif , m_backingStoreState(None) { m_stateStack.append(State()); @@ -216,8 +221,10 @@ PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas) PlatformContextSkia::~PlatformContextSkia() { +#if ENABLE(ACCELERATED_2D_CANVAS) if (m_gpuCanvas) m_gpuCanvas->drawingBuffer()->setWillPublishCallback(0); +#endif } void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas) @@ -705,6 +712,7 @@ private: void PlatformContextSkia::setSharedGraphicsContext3D(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const WebCore::IntSize& size) { +#if ENABLE(ACCELERATED_2D_CANVAS) if (context && drawingBuffer) { m_useGPU = true; m_gpuCanvas = new GLES2Canvas(context, drawingBuffer, size); @@ -716,6 +724,7 @@ void PlatformContextSkia::setSharedGraphicsContext3D(SharedGraphicsContext3D* co m_gpuCanvas.clear(); m_useGPU = false; } +#endif } void PlatformContextSkia::prepareForSoftwareDraw() const @@ -808,6 +817,7 @@ void PlatformContextSkia::markDirtyRect(const IntRect& rect) void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const { +#if ENABLE(ACCELERATED_2D_CANVAS) const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); SkAutoLockPixels lock(bitmap); SharedGraphicsContext3D* context = m_gpuCanvas->context(); @@ -816,7 +826,7 @@ void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const m_uploadTexture->updateSubRect(bitmap.getPixels(), m_softwareDirtyRect); AffineTransform identity; - gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, DeviceColorSpace, op); + gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op); // Clear out the region of the software canvas we just uploaded. m_canvas->save(); m_canvas->resetMatrix(); @@ -825,10 +835,12 @@ void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const m_canvas->drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode); m_canvas->restore(); m_softwareDirtyRect.setWidth(0); // Clear dirty rect. +#endif } void PlatformContextSkia::readbackHardwareToSoftware() const { +#if ENABLE(ACCELERATED_2D_CANVAS) const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true); SkAutoLockPixels lock(bitmap); int width = bitmap.width(), height = bitmap.height(); @@ -850,6 +862,7 @@ void PlatformContextSkia::readbackHardwareToSoftware() const } } m_softwareDirtyRect.unite(IntRect(0, 0, width, height)); // Mark everything as dirty. +#endif } } // namespace WebCore |