Bug 753784; add the ability to force a single tile. r=roc

This commit is contained in:
Nicholas Cameron 2012-05-22 19:14:03 -04:00
Родитель 3a9339038d
Коммит 13553ad870
8 изменённых файлов: 31 добавлений и 10 удалений

Просмотреть файл

@ -916,7 +916,8 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL,
, mTextureState(Created)
, mIterationCallback(nsnull)
{
mTileSize = mGL->WantsSmallTiles() ? 256 : mGL->GetMaxTextureSize();
mTileSize = (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles())
? 256 : mGL->GetMaxTextureSize();
if (aSize != nsIntSize(0,0)) {
Resize(aSize);
}

Просмотреть файл

@ -94,7 +94,8 @@ public:
enum Flags {
NoFlags = 0x0,
UseNearestFilter = 0x1,
NeedsYFlip = 0x2
NeedsYFlip = 0x2,
ForceSingleTile = 0x4
};
typedef gfxASurface::gfxContentType ContentType;

Просмотреть файл

@ -604,10 +604,19 @@ public:
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
}
/**
* if true, the image will only be backed by a single tile texture
*/
void SetForceSingleTile(bool aForceSingleTile)
{
mForceSingleTile = aForceSingleTile;
Mutated();
}
protected:
ImageLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData), mFilter(gfxPattern::FILTER_GOOD)
, mScaleMode(SCALE_NONE) {}
, mScaleMode(SCALE_NONE), mForceSingleTile(false) {}
virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix);
@ -616,6 +625,7 @@ protected:
gfxPattern::GraphicsFilter mFilter;
gfxIntSize mScaleToSize;
ScaleMode mScaleMode;
bool mForceSingleTile;
};
/****** Image subtypes for the different formats ******/

Просмотреть файл

@ -2546,7 +2546,7 @@ public:
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = ImageLayerAttributes(mFilter);
aAttrs = ImageLayerAttributes(mFilter, mForceSingleTile);
}
virtual Layer* AsLayer() { return this; }

Просмотреть файл

@ -94,7 +94,10 @@ struct ThebesLayerAttributes {
struct ContainerLayerAttributes{ FrameMetrics metrics; };
struct ColorLayerAttributes { gfxRGBA color; };
struct CanvasLayerAttributes { GraphicsFilterType filter; };
struct ImageLayerAttributes { GraphicsFilterType filter; };
struct ImageLayerAttributes {
GraphicsFilterType filter;
bool forceSingleTile;
};
union SpecificLayerAttributes {
null_t;

Просмотреть файл

@ -253,13 +253,15 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
specific.get_CanvasLayerAttributes().filter());
break;
case Specific::TImageLayerAttributes:
case Specific::TImageLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
static_cast<ImageLayer*>(layer)->SetFilter(
specific.get_ImageLayerAttributes().filter());
ImageLayer* imageLayer = static_cast<ImageLayer*>(layer);
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
imageLayer->SetFilter(attrs.filter());
imageLayer->SetForceSingleTile(attrs.forceSingleTile());
break;
}
default:
NS_RUNTIMEABORT("not reached");
}

Просмотреть файл

@ -660,7 +660,10 @@ ShadowImageLayerOGL::Init(const SharedImage& aFront)
mSize = surf->GetSize();
mTexImage = gl()->CreateTextureImage(nsIntSize(mSize.width, mSize.height),
surf->GetContentType(),
LOCAL_GL_CLAMP_TO_EDGE);
LOCAL_GL_CLAMP_TO_EDGE,
mForceSingleTile
? TextureImage::ForceSingleTile
: TextureImage::NoFlags);
return true;
} else {
YUVImage yuv = aFront.get_YUVImage();

Просмотреть файл

@ -885,6 +885,7 @@ ContainerState::CreateOrRecycleMaskImageLayerFor(Layer* aLayer)
if (!result)
return nsnull;
result->SetUserData(&gMaskLayerUserData, new MaskLayerUserData());
result->SetForceSingleTile(true);
}
return result.forget();