Diff
Modified: trunk/Source/WebCore/ChangeLog (125282 => 125283)
--- trunk/Source/WebCore/ChangeLog 2012-08-10 15:29:02 UTC (rev 125282)
+++ trunk/Source/WebCore/ChangeLog 2012-08-10 15:36:47 UTC (rev 125283)
@@ -1,5 +1,32 @@
2012-08-10 Dana Jansens <[email protected]>
+ [chromium] Fix the colors in the debugging HUD
+ https://bugs.webkit.org/show_bug.cgi?id=93656
+
+ Reviewed by Adrienne Walker.
+
+ The R and B channels became swapped in our compositor debug HUD when
+ wkb.ug/92182 happened. This corrects the problem by swizzling the
+ color channels when we draw to the SkCanvas, so that it matches the
+ expectations of the shader.
+
+ Chromium bug: crbug.com/139908
+
+ * platform/graphics/chromium/cc/CCFontAtlas.cpp:
+ (WebCore::CCFontAtlas::drawText):
+ (WebCore::CCFontAtlas::drawOneLineOfTextInternal):
+ * platform/graphics/chromium/cc/CCFontAtlas.h:
+ (CCFontAtlas):
+ * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp:
+ (WebCore::createPaint):
+ (WebCore):
+ (WebCore::CCHeadsUpDisplayLayerImpl::drawHudContents):
+ (WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounter):
+ (WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounterText):
+ (WebCore::CCHeadsUpDisplayLayerImpl::drawDebugRects):
+
+2012-08-10 Dana Jansens <[email protected]>
+
[chromium] Remove scissor from the namings in CCOcclusionTracker
https://bugs.webkit.org/show_bug.cgi?id=93630
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.cpp (125282 => 125283)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.cpp 2012-08-10 15:29:02 UTC (rev 125282)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.cpp 2012-08-10 15:36:47 UTC (rev 125283)
@@ -46,7 +46,7 @@
{
}
-void CCFontAtlas::drawText(SkCanvas* canvas, const String& text, const IntPoint& destPosition, const IntSize& clip) const
+void CCFontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const String& text, const IntPoint& destPosition, const IntSize& clip) const
{
ASSERT(CCProxy::isImplThread());
@@ -55,14 +55,14 @@
IntPoint position = destPosition;
for (size_t i = 0; i < lines.size(); ++i) {
- drawOneLineOfTextInternal(canvas, lines[i], position);
+ drawOneLineOfTextInternal(canvas, paint, lines[i], position);
position.setY(position.y() + m_fontHeight);
if (position.y() > clip.height())
return;
}
}
-void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const String& textLine, const IntPoint& destPosition) const
+void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint, const String& textLine, const IntPoint& destPosition) const
{
ASSERT(CCProxy::isImplThread());
@@ -72,7 +72,7 @@
int asciiIndex = (textLine[i] < 128) ? textLine[i] : 0;
IntRect glyphBounds = m_asciiToRectTable[asciiIndex];
SkIRect source = SkIRect::MakeXYWH(glyphBounds.x(), glyphBounds.y(), glyphBounds.width(), glyphBounds.height());
- canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(position.x(), position.y(), glyphBounds.width(), glyphBounds.height()));
+ canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(position.x(), position.y(), glyphBounds.width(), glyphBounds.height()), &paint);
position.setX(position.x() + glyphBounds.width());
}
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.h (125282 => 125283)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.h 2012-08-10 15:29:02 UTC (rev 125282)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFontAtlas.h 2012-08-10 15:36:47 UTC (rev 125283)
@@ -59,7 +59,7 @@
// - IntSize clip is used to avoid wasting time drawing things that are outside the
// target canvas bounds.
// - Should only be called only on the impl thread.
- void drawText(SkCanvas*, const String& text, const IntPoint& destPosition, const IntSize& clip) const;
+ void drawText(SkCanvas*, const SkPaint&, const String& text, const IntPoint& destPosition, const IntSize& clip) const;
// Draws the entire atlas at the specified position, just for debugging purposes.
void drawDebugAtlas(SkCanvas*, const IntPoint& destPosition) const;
@@ -67,7 +67,7 @@
private:
CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
- void drawOneLineOfTextInternal(SkCanvas*, const String&, const IntPoint& destPosition) const;
+ void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const String&, const IntPoint& destPosition) const;
// The actual texture atlas containing all the pre-rendered glyphs.
SkBitmap m_atlas;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp (125282 => 125283)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp 2012-08-10 15:29:02 UTC (rev 125282)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp 2012-08-10 15:36:47 UTC (rev 125283)
@@ -31,6 +31,7 @@
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
#include "SkBitmap.h"
+#include "SkColorMatrixFilter.h"
#include "SkPaint.h"
#include "cc/CCDebugRectHistory.h"
#include "cc/CCFontAtlas.h"
@@ -43,6 +44,23 @@
namespace WebCore {
+static inline SkPaint createPaint()
+{
+ // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to
+ // swizzle our colors when drawing to the SkCanvas.
+ SkColorMatrix swizzleMatrix;
+ for (int i = 0; i < 20; ++i)
+ swizzleMatrix.fMat[i] = 0;
+ swizzleMatrix.fMat[0 + 5 * 2] = 1;
+ swizzleMatrix.fMat[1 + 5 * 1] = 1;
+ swizzleMatrix.fMat[2 + 5 * 0] = 1;
+ swizzleMatrix.fMat[3 + 5 * 3] = 1;
+
+ SkPaint paint;
+ paint.setColorFilter(new SkColorMatrixFilter(swizzleMatrix))->unref();
+ return paint;
+}
+
CCHeadsUpDisplayLayerImpl::CCHeadsUpDisplayLayerImpl(int id)
: CCLayerImpl(id)
{
@@ -119,7 +137,7 @@
const CCLayerTreeSettings& settings = layerTreeHostImpl()->settings();
if (settings.showPlatformLayerTree) {
- SkPaint paint;
+ SkPaint paint = createPaint();
paint.setColor(SkColorSetARGB(192, 0, 0, 0));
canvas->drawRect(SkRect::MakeXYWH(0, 0, bounds().width(), bounds().height()), paint);
}
@@ -138,7 +156,7 @@
if (settings.showPlatformLayerTree && m_fontAtlas) {
String layerTree = layerTreeHostImpl()->layerTreeAsText();
- m_fontAtlas->drawText(canvas, layerTree, IntPoint(2, platformLayerTreeTop), bounds());
+ m_fontAtlas->drawText(canvas, createPaint(), layerTree, IntPoint(2, platformLayerTreeTop), bounds());
}
if (settings.showDebugRects())
@@ -156,7 +174,7 @@
// Draw FPS graph.
const double loFPS = 0;
const double hiFPS = 80;
- SkPaint paint;
+ SkPaint paint = createPaint();
paint.setColor(SkColorSetRGB(154, 205, 50));
canvas->drawRect(SkRect::MakeXYWH(2 + textWidth, top, graphWidth, height / 2), paint);
@@ -207,13 +225,13 @@
fpsCounter->getAverageFPSAndStandardDeviation(averageFPS, stdDeviation);
// Draw background.
- SkPaint paint;
+ SkPaint paint = createPaint();
paint.setColor(SK_ColorBLACK);
canvas->drawRect(SkRect::MakeXYWH(2, top, width, height), paint);
// Draw FPS text.
if (m_fontAtlas)
- m_fontAtlas->drawText(canvas, String::format("FPS: %4.1f +/- %3.1f", averageFPS, stdDeviation), IntPoint(10, height / 3), IntSize(width, height));
+ m_fontAtlas->drawText(canvas, createPaint(), String::format("FPS: %4.1f +/- %3.1f", averageFPS, stdDeviation), IntPoint(10, height / 3), IntSize(width, height));
}
void CCHeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, CCDebugRectHistory* debugRectHistory)
@@ -259,7 +277,7 @@
const FloatRect& rect = debugRects[i].rect;
SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height());
- SkPaint paint;
+ SkPaint paint = createPaint();
paint.setColor(fillColor);
canvas->drawRect(skRect, paint);