2010-09-09 Sheriff Bot <webkit.review.bot@gmail.com>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Sep 2010 01:29:34 +0000 (01:29 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Sep 2010 01:29:34 +0000 (01:29 +0000)
        Unreviewed, rolling out r67126.
        http://trac.webkit.org/changeset/67126
        https://bugs.webkit.org/show_bug.cgi?id=45510

        broke chromium mac compile, it also uses PlatformContextSkia
        (Requested by jamesr on #webkit).

        * platform/graphics/chromium/ContentLayerChromium.cpp:
        (WebCore::ContentLayerChromium::updateContents):
        * platform/graphics/chromium/FontLinux.cpp:
        (WebCore::adjustTextRenderMode):
        (WebCore::Font::drawGlyphs):
        (WebCore::Font::drawComplexText):
        * platform/graphics/chromium/LayerRendererChromium.cpp:
        (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
        * platform/graphics/chromium/VideoLayerChromium.cpp:
        (WebCore::VideoLayerChromium::updateContents):
        * platform/graphics/skia/ImageBufferSkia.cpp:
        (WebCore::ImageBuffer::ImageBuffer):
        (WebCore::ImageBuffer::clip):
        * platform/graphics/skia/PlatformContextSkia.cpp:
        (WebCore::PlatformContextSkia::State::State):
        (WebCore::PlatformContextSkia::PlatformContextSkia):
        (WebCore::PlatformContextSkia::save):
        (WebCore::PlatformContextSkia::restore):
        * platform/graphics/skia/PlatformContextSkia.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
WebCore/platform/graphics/chromium/FontLinux.cpp
WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
WebCore/platform/graphics/skia/ImageBufferSkia.cpp
WebCore/platform/graphics/skia/PlatformContextSkia.cpp
WebCore/platform/graphics/skia/PlatformContextSkia.h

index 759d64ccce0823ff57e967d692faa0fa518f5ad7..a240befd772268c84b77ab2e82d8ea3ea8a4f43a 100644 (file)
@@ -1,3 +1,32 @@
+2010-09-09  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r67126.
+        http://trac.webkit.org/changeset/67126
+        https://bugs.webkit.org/show_bug.cgi?id=45510
+
+        broke chromium mac compile, it also uses PlatformContextSkia
+        (Requested by jamesr on #webkit).
+
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerChromium::updateContents):
+        * platform/graphics/chromium/FontLinux.cpp:
+        (WebCore::adjustTextRenderMode):
+        (WebCore::Font::drawGlyphs):
+        (WebCore::Font::drawComplexText):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::updateContents):
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::ImageBuffer):
+        (WebCore::ImageBuffer::clip):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::State::State):
+        (WebCore::PlatformContextSkia::PlatformContextSkia):
+        (WebCore::PlatformContextSkia::save):
+        (WebCore::PlatformContextSkia::restore):
+        * platform/graphics/skia/PlatformContextSkia.h:
+
 2010-09-09  Simon Fraser  <simon.fraser@apple.com>
 
         Attempt to fix Qt build.
index 48119bbbfd30db609dc3388803838a3dde86120b..5c8b8693da7de63a239998282d9acfcbebce1b83 100644 (file)
@@ -176,9 +176,14 @@ void ContentLayerChromium::updateContents()
     canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false));
     skiaContext.set(new PlatformContextSkia(canvas.get()));
 
-    // This is needed to get text to show up correctly.
+#if OS(WINDOWS)
+    // This is needed to get text to show up correctly. Without it,
+    // GDI renders with zero alpha and the text becomes invisible.
+    // Unfortunately, setting this to true disables cleartype.
     // FIXME: Does this take us down a very slow text rendering path?
+    // FIXME: why is this is a windows-only call ?
     skiaContext->setDrawingToImageBuffer(true);
+#endif
 
     graphicsContext.set(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(skiaContext.get())));
 
index 696cd9cea0d110e47b08a4b97f2bae3dee2764d2..ab3045e422382f192c58c98261e369cafae7eb93 100644 (file)
@@ -65,13 +65,13 @@ static bool isCanvasMultiLayered(SkCanvas* canvas)
     return !layerIterator.done();
 }
 
-static void adjustTextRenderMode(SkPaint* paint, PlatformContextSkia* skiaContext)
+static void adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered)
 {
     // Our layers only have a single alpha channel. This means that subpixel
     // rendered text cannot be compositied correctly when the layer is
     // collapsed. Therefore, subpixel text is disabled when we are drawing
-    // onto a layer or when the compositor is being used.
-    if (isCanvasMultiLayered(skiaContext->canvas()) || skiaContext->isDrawingToImageBuffer())
+    // onto a layer.
+    if (isCanvasMultiLayered)
         paint->setLCDRenderText(false);
 }
 
@@ -104,13 +104,14 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
 
     SkCanvas* canvas = gc->platformContext()->canvas();
     int textMode = gc->platformContext()->getTextDrawingMode();
+    bool haveMultipleLayers = isCanvasMultiLayered(canvas);
 
     // We draw text up to two times (once for fill, once for stroke).
     if (textMode & cTextFill) {
         SkPaint paint;
         gc->platformContext()->setupPaintForFilling(&paint);
         font->platformData().setupPaint(&paint);
-        adjustTextRenderMode(&paint, gc->platformContext());
+        adjustTextRenderMode(&paint, haveMultipleLayers);
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->fillColor().rgb());
         canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
@@ -123,7 +124,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
         SkPaint paint;
         gc->platformContext()->setupPaintForStroking(&paint, 0, 0);
         font->platformData().setupPaint(&paint);
-        adjustTextRenderMode(&paint, gc->platformContext());
+        adjustTextRenderMode(&paint, haveMultipleLayers);
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->strokeColor().rgb());
 
@@ -645,6 +646,7 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
     }
 
     TextRunWalker walker(run, point.x(), this);
+    bool haveMultipleLayers = isCanvasMultiLayered(canvas);
     walker.setWordSpacingAdjustment(wordSpacing());
     walker.setLetterSpacingAdjustment(letterSpacing());
     walker.setPadding(run.padding());
@@ -652,13 +654,13 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
     while (walker.nextScriptRun()) {
         if (fill) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&fillPaint);
-            adjustTextRenderMode(&fillPaint, gc->platformContext());
+            adjustTextRenderMode(&fillPaint, haveMultipleLayers);
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), fillPaint);
         }
 
         if (stroke) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&strokePaint);
-            adjustTextRenderMode(&strokePaint, gc->platformContext());
+            adjustTextRenderMode(&strokePaint, haveMultipleLayers);
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), strokePaint);
         }
     }
index 4708310349797f987b210c98d08647d3f915eb32..789298aed8ce9763020cfe0ae2248e3733df2c8c 100644 (file)
@@ -125,7 +125,10 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size)
     // the old ones.
     m_rootLayerCanvas = new skia::PlatformCanvas(size.width(), size.height(), false);
     m_rootLayerSkiaContext = new PlatformContextSkia(m_rootLayerCanvas.get());
+#if OS(WINDOWS)
+    // FIXME: why is this is a windows-only call ?
     m_rootLayerSkiaContext->setDrawingToImageBuffer(true);
+#endif
     m_rootLayerGraphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_rootLayerSkiaContext.get()));
 #elif PLATFORM(CG)
     // Release the previous CGBitmapContext before reallocating the backing store as a precaution.
index c0da28567b3fe9c1dde69172268cf65d7292427f..7ff98b93fd03ada2da68fc4d1f6e29b5740ff4be 100644 (file)
@@ -96,9 +96,14 @@ void VideoLayerChromium::updateContents()
         m_canvas = new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), true);
         m_skiaContext = new PlatformContextSkia(m_canvas.get());
 
-        // This is needed to get text to show up correctly.
+#if OS(WINDOWS)
+        // This is needed to get text to show up correctly. Without it,
+        // GDI renders with zero alpha and the text becomes invisible.
+        // Unfortunately, setting this to true disables cleartype.
         // FIXME: Does this take us down a very slow text rendering path?
+        // FIXME: Why is this is a windows-only call?
         m_skiaContext->setDrawingToImageBuffer(true);
+#endif
         m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get()));
     }
 
index 2be7dc57a62f0c08229ab7ccb923ab1ad2175f65..9c96673a656d05d2d92c709a5672e8735893fe08 100644 (file)
@@ -69,7 +69,9 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b
 
     m_data.m_platformContext.setCanvas(&m_data.m_canvas);
     m_context.set(new GraphicsContext(&m_data.m_platformContext));
+#if OS(WINDOWS)
     m_context->platformContext()->setDrawingToImageBuffer(true);
+#endif
 
     // Make the background transparent. It would be nice if this wasn't
     // required, but the canvas is currently filled with the magic transparency
@@ -100,7 +102,9 @@ PassRefPtr<Image> ImageBuffer::copyImage() const
 
 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
 {
+#if OS(LINUX) || OS(WINDOWS)
     context->platformContext()->beginLayerClippedToImage(rect, this);
+#endif
 }
 
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
index f0073e23f5104905e5f47969059f76e070da17e8..f0d6548c75f8fb678ebb78200383f250e2cbf637 100644 (file)
@@ -97,10 +97,12 @@ struct PlatformContextSkia::State {
     // color to produce a new output color.
     SkColor applyAlpha(SkColor) const;
 
+#if OS(LINUX) || OS(WINDOWS)
     // If non-empty, the current State is clipped to this image.
     SkBitmap m_imageBufferClip;
     // If m_imageBufferClip is non-empty, this is the region the image is clipped to.
     FloatRect m_clip;
+#endif
 
     // This is a list of clipping paths which are currently active, in the
     // order in which they were pushed.
@@ -156,8 +158,10 @@ PlatformContextSkia::State::State(const State& other)
     , m_lineJoin(other.m_lineJoin)
     , m_dash(other.m_dash)
     , m_textDrawingMode(other.m_textDrawingMode)
+#if OS(LINUX) || OS(WINDOWS)
     , m_imageBufferClip(other.m_imageBufferClip)
     , m_clip(other.m_clip)
+#endif
     , m_antiAliasClipPaths(other.m_antiAliasClipPaths)
     , m_interpolationQuality(other.m_interpolationQuality)
     , m_canvasClipApplied(other.m_canvasClipApplied)
@@ -205,7 +209,9 @@ SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const
 // Danger: canvas can be NULL.
 PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas)
     : m_canvas(canvas)
+#if OS(WINDOWS)
     , m_drawingToImageBuffer(false)
+#endif
     , m_useGPU(false)
     , m_gpuCanvas(0)
     , m_backingStoreState(None)
@@ -225,6 +231,7 @@ void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas)
     m_canvas = canvas;
 }
 
+#if OS(WINDOWS)
 void PlatformContextSkia::setDrawingToImageBuffer(bool value)
 {
     m_drawingToImageBuffer = value;
@@ -234,6 +241,7 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const
 {
     return m_drawingToImageBuffer;
 }
+#endif
 
 void PlatformContextSkia::save()
 {
@@ -242,14 +250,17 @@ void PlatformContextSkia::save()
     m_stateStack.append(m_state->cloneInheritedProperties());
     m_state = &m_stateStack.last();
 
+#if OS(LINUX) || OS(WINDOWS)
     // The clip image only needs to be applied once. Reset the image so that we
     // don't attempt to clip multiple times.
     m_state->m_imageBufferClip.reset();
+#endif
 
     // Save our native canvas.
     canvas()->save();
 }
 
+#if OS(LINUX) || OS(WINDOWS)
 void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
                                                    const ImageBuffer* imageBuffer)
 {
@@ -278,6 +289,7 @@ void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
         m_state->m_imageBufferClip = *bitmap;
     }
 }
+#endif
 
 void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
 {
@@ -296,10 +308,12 @@ void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
 
 void PlatformContextSkia::restore()
 {
+#if OS(LINUX) || OS(WINDOWS)
     if (!m_state->m_imageBufferClip.empty()) {
         applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip);
         canvas()->restore();
     }
+#endif
 
     if (!m_state->m_antiAliasClipPaths.isEmpty())
         applyAntiAliasedClipPaths(m_state->m_antiAliasClipPaths);
@@ -624,6 +638,7 @@ bool PlatformContextSkia::hasImageResamplingHint() const
     return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty();
 }
 
+#if OS(LINUX) || OS(WINDOWS)
 void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitmap& imageBuffer)
 {
     // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we
@@ -632,6 +647,7 @@ void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitm
     paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
     m_canvas->drawBitmap(imageBuffer, SkFloatToScalar(rect.x()), SkFloatToScalar(rect.y()), &paint);
 }
+#endif
 
 void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths)
 {
index 4ba85d1601ec60451ed764c087e757af95a1461e..e6d58750a03a8ffa52a03c63d171a9307c2f2706 100644 (file)
@@ -78,6 +78,7 @@ public:
     // to the constructor.
     void setCanvas(skia::PlatformCanvas*);
 
+#if OS(WINDOWS)
     // If false we're rendering to a GraphicsContext for a web page, if false
     // we're not (as is the case when rendering to a canvas object).
     // If this is true the contents have not been marked up with the magic
@@ -85,6 +86,7 @@ public:
     // correctly updated.
     void setDrawingToImageBuffer(bool);
     bool isDrawingToImageBuffer() const;
+#endif
 
     void save();
     void restore();
@@ -93,7 +95,9 @@ public:
     // |rect|. This layer is implicitly restored when the next restore is
     // invoked.
     // NOTE: |imageBuffer| may be deleted before the |restore| is invoked.
+#if OS(LINUX) || OS(WINDOWS)
     void beginLayerClippedToImage(const FloatRect&, const ImageBuffer*);
+#endif
     void clipPathAntiAliased(const SkPath&);
 
     // Sets up the common flags on a paint for antialiasing, effects, etc.
@@ -193,9 +197,11 @@ public:
     void markDirtyRect(const IntRect& rect);
 
 private:
+#if OS(LINUX) || OS(WINDOWS)
     // Used when restoring and the state has an image clip. Only shows the pixels in
     // m_canvas that are also in imageBuffer.
     void applyClipFromImage(const FloatRect&, const SkBitmap&);
+#endif
     void applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths);
 
     void uploadSoftwareToHardware(CompositeOperator) const;
@@ -221,7 +227,9 @@ private:
     // Values are used in ImageSkia.cpp
     IntSize m_imageResamplingHintSrcSize;
     FloatSize m_imageResamplingHintDstSize;
+#if OS(WINDOWS)
     bool m_drawingToImageBuffer;
+#endif
     bool m_useGPU;
     OwnPtr<GLES2Canvas> m_gpuCanvas;
     mutable enum { None, Software, Mixed, Hardware } m_backingStoreState;