gecko-dev/layout/painting/BorderCache.h
Ehsan Akhgari aca985efab Bug 1318805 - Move the code for the Web Painting module to layout/painting; r=mattwoodrow
This will help make it clearer that this code lives in a different
module for contributors.


--HG--
rename : layout/base/ActiveLayerTracker.cpp => layout/painting/ActiveLayerTracker.cpp
rename : layout/base/ActiveLayerTracker.h => layout/painting/ActiveLayerTracker.h
rename : layout/base/BorderCache.h => layout/painting/BorderCache.h
rename : layout/base/BorderConsts.h => layout/painting/BorderConsts.h
rename : layout/base/DashedCornerFinder.cpp => layout/painting/DashedCornerFinder.cpp
rename : layout/base/DashedCornerFinder.h => layout/painting/DashedCornerFinder.h
rename : layout/base/DisplayItemClip.cpp => layout/painting/DisplayItemClip.cpp
rename : layout/base/DisplayItemClip.h => layout/painting/DisplayItemClip.h
rename : layout/base/DisplayItemScrollClip.cpp => layout/painting/DisplayItemScrollClip.cpp
rename : layout/base/DisplayItemScrollClip.h => layout/painting/DisplayItemScrollClip.h
rename : layout/base/DisplayListClipState.cpp => layout/painting/DisplayListClipState.cpp
rename : layout/base/DisplayListClipState.h => layout/painting/DisplayListClipState.h
rename : layout/base/DottedCornerFinder.cpp => layout/painting/DottedCornerFinder.cpp
rename : layout/base/DottedCornerFinder.h => layout/painting/DottedCornerFinder.h
rename : layout/base/FrameLayerBuilder.cpp => layout/painting/FrameLayerBuilder.cpp
rename : layout/base/FrameLayerBuilder.h => layout/painting/FrameLayerBuilder.h
rename : layout/base/LayerState.h => layout/painting/LayerState.h
rename : layout/base/MaskLayerImageCache.cpp => layout/painting/MaskLayerImageCache.cpp
rename : layout/base/MaskLayerImageCache.h => layout/painting/MaskLayerImageCache.h
rename : layout/base/PaintTracker.cpp => layout/painting/PaintTracker.cpp
rename : layout/base/PaintTracker.h => layout/painting/PaintTracker.h
rename : layout/base/nsCSSRendering.cpp => layout/painting/nsCSSRendering.cpp
rename : layout/base/nsCSSRendering.h => layout/painting/nsCSSRendering.h
rename : layout/base/nsCSSRenderingBorders.cpp => layout/painting/nsCSSRenderingBorders.cpp
rename : layout/base/nsCSSRenderingBorders.h => layout/painting/nsCSSRenderingBorders.h
rename : layout/base/nsDisplayItemTypes.h => layout/painting/nsDisplayItemTypes.h
rename : layout/base/nsDisplayItemTypesList.h => layout/painting/nsDisplayItemTypesList.h
rename : layout/base/nsDisplayList.cpp => layout/painting/nsDisplayList.cpp
rename : layout/base/nsDisplayList.h => layout/painting/nsDisplayList.h
rename : layout/base/nsDisplayListInvalidation.cpp => layout/painting/nsDisplayListInvalidation.cpp
rename : layout/base/nsDisplayListInvalidation.h => layout/painting/nsDisplayListInvalidation.h
2016-11-21 20:01:15 -05:00

76 lines
1.7 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_BorderCache_h_
#define mozilla_BorderCache_h_
#include "mozilla/gfx/2D.h"
#include "mozilla/HashFunctions.h"
#include "nsDataHashtable.h"
#include "PLDHashTable.h"
namespace mozilla {
// Cache for best overlap and best dashLength.
struct FourFloats
{
typedef mozilla::gfx::Float Float;
Float n[4];
FourFloats()
{
n[0] = 0.0f;
n[1] = 0.0f;
n[2] = 0.0f;
n[3] = 0.0f;
}
FourFloats(Float a, Float b, Float c, Float d)
{
n[0] = a;
n[1] = b;
n[2] = c;
n[3] = d;
}
bool
operator==(const FourFloats& aOther) const
{
return n[0] == aOther.n[0] &&
n[1] == aOther.n[1] &&
n[2] == aOther.n[2] &&
n[3] == aOther.n[3];
}
};
class FourFloatsHashKey : public PLDHashEntryHdr
{
public:
typedef const FourFloats& KeyType;
typedef const FourFloats* KeyTypePointer;
explicit FourFloatsHashKey(KeyTypePointer aKey) : mValue(*aKey) {}
FourFloatsHashKey(const FourFloatsHashKey& aToCopy) : mValue(aToCopy.mValue) {}
~FourFloatsHashKey() {}
KeyType GetKey() const { return mValue; }
bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; }
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
static PLDHashNumber HashKey(KeyTypePointer aKey)
{
return HashBytes(aKey->n, sizeof(mozilla::gfx::Float) * 4);
}
enum { ALLOW_MEMMOVE = true };
private:
const FourFloats mValue;
};
} // namespace mozilla
#endif /* mozilla_BorderCache_h_ */