Bug 539356 - Part 6 - Add compositing paint flashing to BasicLayers. r=roc

This commit is contained in:
Matt Woodrow
2012-07-17 13:03:51 -04:00
parent 3b5ab2f5fe
commit 1a636f084f
3 changed files with 31 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include "BasicLayersImpl.h" #include "BasicLayersImpl.h"
#include "BasicThebesLayer.h" #include "BasicThebesLayer.h"
#include "BasicContainerLayer.h" #include "BasicContainerLayer.h"
#include "mozilla/Preferences.h"
using namespace mozilla::gfx; using namespace mozilla::gfx;
@@ -434,6 +435,9 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
} }
PaintLayer(mTarget, mRoot, aCallback, aCallbackData, nsnull); PaintLayer(mTarget, mRoot, aCallback, aCallbackData, nsnull);
if (mWidget) {
FlashWidgetUpdateArea(mTarget);
}
if (!mTransactionIncomplete) { if (!mTransactionIncomplete) {
// Clear out target if we have a complete transaction. // Clear out target if we have a complete transaction.
@@ -466,6 +470,27 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
return !mTransactionIncomplete; return !mTransactionIncomplete;
} }
void
BasicLayerManager::FlashWidgetUpdateArea(gfxContext *aContext)
{
static bool sWidgetFlashingEnabled;
static bool sWidgetFlashingPrefCached = false;
if (!sWidgetFlashingPrefCached) {
sWidgetFlashingPrefCached = true;
mozilla::Preferences::AddBoolVarCache(&sWidgetFlashingEnabled,
"nglayout.debug.widget_update_flashing");
}
if (sWidgetFlashingEnabled) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
aContext->SetColor(gfxRGBA(r, g, b, 0.2));
aContext->Paint();
}
}
bool bool
BasicLayerManager::EndEmptyTransaction() BasicLayerManager::EndEmptyTransaction()
{ {

View File

@@ -172,6 +172,8 @@ protected:
void* aCallbackData, void* aCallbackData,
EndTransactionFlags aFlags = END_DEFAULT); EndTransactionFlags aFlags = END_DEFAULT);
void FlashWidgetUpdateArea(gfxContext* aContext);
// Widget whose surface should be used as the basis for ThebesLayer // Widget whose surface should be used as the basis for ThebesLayer
// buffers. // buffers.
nsIWidget* mWidget; nsIWidget* mWidget;

View File

@@ -353,6 +353,10 @@ pref("nglayout.enable_drag_images", true);
// enable/disable paint flashing --- useful for debugging // enable/disable paint flashing --- useful for debugging
pref("nglayout.debug.paint_flashing", false); pref("nglayout.debug.paint_flashing", false);
// enable/disable widget update area flashing --- only supported with
// BasicLayers (other layer managers always update the entire widget area)
pref("nglayout.debug.widget_update_flashing", false);
// scrollbar snapping region // scrollbar snapping region
// 0 - off // 0 - off
// 1 and higher - slider thickness multiple // 1 and higher - slider thickness multiple