Merge m-c to b2g-inbound

This commit is contained in:
Wes Kocher 2014-04-28 16:26:34 -07:00
commit 048b39c570
155 changed files with 1480 additions and 3777 deletions

View File

@ -100,3 +100,4 @@ ad0ae007aa9e03cd74e9005cd6652e544139b3b5 FIREFOX_AURORA_25_BASE
9f12a9fab080f2d363d7424e25b9ffe85ebc3414 FIREFOX_AURORA_28_BASE
ba2cc1eda988a1614d8986ae145d28e1268409b9 FIREFOX_AURORA_29_BASE
83c9853e136451474dfa6d1aaa60a7fca7d2d83a FIREFOX_AURORA_30_BASE
cfde3603b0206e119abea76fdd6e134b634348f1 FIREFOX_AURORA_31_BASE

View File

@ -143,7 +143,7 @@ const WorkerSandbox = Class({
sandboxPrototype: proto,
wantXrays: true,
wantGlobalProperties: wantGlobalProperties,
wantExportHelpers: !waiveSecurityMembrane,
wantExportHelpers: true,
sameZoneAs: window,
metadata: {
SDKContentScript: true,

View File

@ -5,7 +5,7 @@
MOZ_APP_BASENAME=B2G
MOZ_APP_VENDOR=Mozilla
MOZ_APP_VERSION=31.0a1
MOZ_APP_VERSION=32.0a1
MOZ_APP_UA_NAME=Firefox
MOZ_UA_OS_AGNOSTIC=1

View File

@ -200,6 +200,10 @@ const PanelUI = {
}
},
isReady: function() {
return !!this._isReady;
},
/**
* Registering the menu panel is done lazily for performance reasons. This
* method is exposed so that CustomizationMode can force panel-readyness in the
@ -263,6 +267,7 @@ const PanelUI = {
}
this._updateQuitTooltip();
this.panel.hidden = false;
this._isReady = true;
}.bind(this)).then(null, Cu.reportError);
return this._readyPromise;

View File

@ -188,10 +188,12 @@ CustomizeMode.prototype = {
// The menu panel is lazy, and registers itself when the popup shows. We
// need to force the menu panel to register itself, or else customization
// is really not going to work. We pass "true" to ensureRegistered to
// is really not going to work. We pass "true" to ensureReady to
// indicate that we're handling calling startBatchUpdate and
// endBatchUpdate.
yield window.PanelUI.ensureReady(true);
if (!window.PanelUI.isReady()) {
yield window.PanelUI.ensureReady(true);
}
// Hide the palette before starting the transition for increased perf.
this.visiblePalette.hidden = true;

View File

@ -1 +1 @@
31.0a1
32.0a1

View File

@ -1123,7 +1123,9 @@ Experiments.Experiments.prototype = {
let desc = TELEMETRY_LOG.ACTIVATION;
let data = [TELEMETRY_LOG.ACTIVATION.REJECTED, id];
data = data.concat(reason);
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY, data);
const key = TELEMETRY_LOG.ACTIVATION_KEY;
TelemetryLog.log(key, data);
this._log.trace("evaluateExperiments() - added " + key + " to TelemetryLog: " + JSON.stringify(data));
}
if (!applicable) {

View File

@ -175,6 +175,7 @@ add_task(function* test_telemetryBasics() {
expectedLogLength += 2;
let log = TelemetryPing.getPayload().log;
do_print("Telemetry log: " + JSON.stringify(log));
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
checkEvent(log[log.length-2], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT1_ID, "startTime"]);

View File

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
31.0a1
32.0a1

View File

@ -954,13 +954,16 @@ FragmentOrElement::SetXBLBinding(nsXBLBinding* aBinding,
bindingManager->RemoveFromAttachedQueue(oldBinding);
}
nsDOMSlots *slots = DOMSlots();
if (aBinding) {
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
nsDOMSlots *slots = DOMSlots();
slots->mXBLBinding = aBinding;
bindingManager->AddBoundContent(this);
} else {
slots->mXBLBinding = nullptr;
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots) {
slots->mXBLBinding = nullptr;
}
bindingManager->RemoveBoundContent(this);
if (oldBinding) {
oldBinding->SetBoundElement(nullptr);
@ -1011,11 +1014,16 @@ FragmentOrElement::SetShadowRoot(ShadowRoot* aShadowRoot)
void
FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent)
{
nsDOMSlots *slots = DOMSlots();
if (aContent) {
nsDOMSlots *slots = DOMSlots();
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
slots->mXBLInsertionParent = aContent;
} else {
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots) {
slots->mXBLInsertionParent = nullptr;
}
}
slots->mXBLInsertionParent = aContent;
}
CustomElementData*

View File

@ -102,8 +102,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
if (slots) {
slots->Traverse(cb);
}
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
@ -715,11 +713,16 @@ nsGenericDOMDataNode::GetXBLInsertionParent() const
void
nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent)
{
nsDataSlots *slots = DataSlots();
if (aContent) {
nsDataSlots *slots = DataSlots();
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
slots->mXBLInsertionParent = aContent;
} else {
nsDataSlots *slots = GetExistingDataSlots();
if (slots) {
slots->mXBLInsertionParent = nullptr;
}
}
slots->mXBLInsertionParent = aContent;
}
CustomElementData *

View File

@ -3848,6 +3848,11 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState()
mAudioChannelAgent->SetVisibilityState(!OwnerDoc()->Hidden());
}
// This is needed to pass nsContentUtils::IsCallerChrome().
// AudioChannel API should not called from content but it can happen that
// this method has some content JS in its stack.
AutoNoJSAPI nojsapi;
if (mPlayingThroughTheAudioChannel) {
int32_t canPlay;
mAudioChannelAgent->StartPlaying(&canPlay);

View File

@ -151,7 +151,7 @@ this.DataStoreCursor.prototype = {
self._revision = aEvent.target.result.value;
self._objectId = 0;
self._state = STATE_SEND_ALL;
aResolve(Cu.cloneInto({ operation: 'clear' }, self._window));
aResolve(self.createTask('clear', null, '', null));
}
},
@ -291,7 +291,7 @@ this.DataStoreCursor.prototype = {
if (self._revision.revisionId != aEvent.target.result.value.revisionId) {
self._revision = aEvent.target.result.value;
self._objectId = 0;
aResolve(Cu.cloneInto({ operation: 'clear' }, self._window));
aResolve(self.createTask('clear', null, '', null));
return;
}
@ -305,8 +305,7 @@ this.DataStoreCursor.prototype = {
}
self._objectId = cursor.key;
aResolve(Cu.cloneInto({ operation: 'add', id: self._objectId,
data: cursor.value }, self._window));
aResolve(self.createTask('add', self._objectId, '', cursor.value));
};
};
},
@ -324,8 +323,7 @@ this.DataStoreCursor.prototype = {
switch (this._revision.operation) {
case REVISION_REMOVED:
aResolve(Cu.cloneInto({ operation: 'remove', id: this._revision.objectId },
this._window));
aResolve(this.createTask('remove', this._revision.objectId, '', null));
break;
case REVISION_ADDED: {
@ -337,8 +335,8 @@ this.DataStoreCursor.prototype = {
return;
}
aResolve(Cu.cloneInto({ operation: 'add', id: self._revision.objectId,
data: aEvent.target.result }, self._window));
aResolve(self.createTask('add', self._revision.objectId, '',
aEvent.target.result));
}
break;
}
@ -357,8 +355,8 @@ this.DataStoreCursor.prototype = {
return;
}
aResolve(Cu.cloneInto({ operation: 'update', id: self._revision.objectId,
data: aEvent.target.result }, self._window));
aResolve(self.createTask('update', self._revision.objectId, '',
aEvent.target.result));
}
break;
}
@ -377,8 +375,7 @@ this.DataStoreCursor.prototype = {
stateMachineDone: function(aStore, aRevisionStore, aResolve, aReject) {
this.close();
aResolve(Cu.cloneInto({ revisionId: this._revision.revisionId,
operation: 'done' }, this._window));
aResolve(this.createTask('done', null, this._revision.revisionId, null));
},
// public interface
@ -405,5 +402,10 @@ this.DataStoreCursor.prototype = {
close: function() {
this._dataStore.syncTerminated(this);
},
createTask: function(aOperation, aId, aRevisionId, aData) {
return Cu.cloneInto({ operation: aOperation, id: aId,
revisionId: aRevisionId, data: aData }, this._window);
}
};

View File

@ -275,7 +275,7 @@ this.DataStore.prototype = {
function() {
debug("Revisions cleared");
self.addRevision(aRevisionStore, 0, REVISION_VOID,
self.addRevision(aRevisionStore, null, REVISION_VOID,
function() {
debug("ClearInternal - revisionId increased");
aResolve();

View File

@ -66,11 +66,10 @@
}
function eventListener(evt) {
ok(evt instanceof DataStoreChangeEvent, "DataStoreChangeEvent has been received");
ok(evt, "OnChangeListener is called with data");
is(/[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}/.test(evt.revisionId), true, "event.revisionId returns something");
if (gChangeId) {
is(evt.id, gChangeId, "OnChangeListener is called with the right ID: " + evt.id);
}
is(evt.id, gChangeId, "OnChangeListener is called with the right ID: " + evt.id);
is(evt.operation, gChangeOperation, "OnChangeListener is called with the right operation:" + evt.operation + " " + gChangeOperation);
runTest();
}
@ -99,7 +98,7 @@
testStoreRemove(1, true); },
// Clear
function() { gChangeId = 0; gChangeOperation = 'cleared';
function() { gChangeId = null; gChangeOperation = 'cleared';
testStoreClear(); },
// Remove onchange function and replace it with addEventListener
@ -122,7 +121,7 @@
testStoreRemove(2, true); },
// Clear
function() { gChangeId = 0; gChangeOperation = 'cleared';
function() { gChangeId = null; gChangeOperation = 'cleared';
testStoreClear(); },
// Remove event listener

View File

@ -71,9 +71,14 @@
switch (data.operation) {
case 'clear':
is (data.id, null, "'clear' operation wants a null id");
break;
case 'done':
is(/[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}/.test(data.revisionId), true, "done has a valid revisionId");
is (data.revisionId, gRevisions[gRevisions.length-1], "Last revision matches");
is (data.id, null, "'done' operation wants a null id");
break;
case 'add':

View File

@ -147,12 +147,6 @@ TabChildBase::InitializeRootMetrics()
mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0));
}
bool
TabChildBase::HasValidInnerSize()
{
return (mInnerSize.width != 0) && (mInnerSize.height != 0);
}
void
TabChildBase::SetCSSViewport(const CSSSize& aSize)
{
@ -696,6 +690,7 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mWaitingTouchListeners(false)
, mIgnoreKeyPressEvent(false)
, mActiveElementManager(new ActiveElementManager())
, mHasValidInnerSize(false)
{
if (!sActiveDurationMsSet) {
Preferences::AddIntVarCache(&sActiveDurationMs,
@ -1288,6 +1283,12 @@ TabChild::BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
return NS_OK;
}
bool
TabChild::HasValidInnerSize()
{
return mHasValidInnerSize;
}
#ifdef DEBUG
PContentPermissionRequestChild*
TabChild:: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
@ -1614,6 +1615,9 @@ TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const
bool initialSizing = !HasValidInnerSize()
&& (size.width != 0 && size.height != 0);
if (initialSizing) {
mHasValidInnerSize = true;
}
mOrientation = orientation;
mInnerSize = ScreenIntSize::FromUnknownSize(

View File

@ -205,7 +205,6 @@ protected:
nsEventStatus DispatchWidgetEvent(WidgetGUIEvent& event);
bool HasValidInnerSize();
void InitializeRootMetrics();
mozilla::layers::FrameMetrics ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
@ -522,6 +521,8 @@ private:
bool* aWindowIsNew,
nsIDOMWindow** aReturn);
bool HasValidInnerSize();
class CachedFileDescriptorInfo;
class CachedFileDescriptorCallbackRunnable;
@ -560,6 +561,7 @@ private:
bool mIgnoreKeyPressEvent;
nsRefPtr<ActiveElementManager> mActiveElementManager;
bool mHasValidInnerSize;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -103,6 +103,8 @@ dictionary DataStoreTask {
DOMString revisionId;
DataStoreOperation operation;
DataStoreKey id;
// When |operation| is "clear" or "done", this must return null.
DataStoreKey? id;
any data;
};

View File

@ -6,7 +6,10 @@
dictionary DataStoreChangeEventInit : EventInit {
DOMString revisionId = "";
DataStoreKey id = 0;
// When |operation| is "clear" or "done", this must return null.
DataStoreKey? id = null;
DOMString operation = "";
DOMString owner = "";
};
@ -15,7 +18,7 @@ dictionary DataStoreChangeEventInit : EventInit {
Constructor(DOMString type, optional DataStoreChangeEventInit eventInitDict)]
interface DataStoreChangeEvent : Event {
readonly attribute DOMString revisionId;
readonly attribute DataStoreKey id;
readonly attribute DataStoreKey? id;
readonly attribute DOMString operation;
readonly attribute DOMString owner;
};

View File

@ -447,7 +447,7 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
else if (!(strcmp(operation, "replace")))
{
status.Assign("Replacing HistoryIndex: ");
AppentIntToCString(info1, status);
AppendIntToCString(info1, status);
}
nsString wstatus;

View File

@ -9236,420 +9236,422 @@
> diatomaceous
20481a26300
> disclose/DSG
20830c26649
20633a26453
> dissentious
20830c26650
< dogie/M
---
> dogie/SM
20895a26715
20895a26716
> donator/MS
21820a27641
21820a27642
> elicitor/MS
22071a27893
22071a27894
> encyclopaedia
22196a28019
22196a28020
> enqueue/DSG
22556a28380
22556a28381
> estoppel
22638c28462
22638c28463
< euthanize
---
> euthanize/DSG
22719a28544
22719a28545
> exabyte/MS
22947a28773
22947a28774
> experimentalism
23207,23208d29032
23207,23208d29033
< faecal
< faeces/M
23215c29039
23215c29040
< faggoting's
---
> faggot/SMG
23701a29526
23701a29527
> filesystem/MS
24155c29980
24155c29981
< fluidized
---
> fluidize/DSG
24216a30042
24216a30043
> foci
24736d30561
24736d30562
< frier/M
24855,24856c30680,30681
24855,24856c30681,30682
< fucker/M!
< fuckhead/S!
---
> fucker/SM!
> fuckhead/SM!
24953d30777
24953d30778
< furore/MS
25125c30949
25125c30950
< gaolbird/S
---
> gaolbirds
25180d31003
25180d31004
< gasolene/M
25190a31014
25190a31015
> gastroenterologist/M
25262c31086
25262c31087
< geezer/M
---
> geezer/MS
25327c31151
25327c31152
< genomic
---
> genomic/S
25462a31287
25462a31288
> gigabit/MS
25464a31290,31292
25464a31291,31293
> gigajoule/MS
> gigapixel/MS
> gigawatt/MS
25560d31387
25560d31388
< glamourize/DSG
25674c31501
25674c31502
< glycerine's
---
> glycerine/M
25905c31732
25905c31733
< gram/MS
---
> gram/KMS
25909d31735
25909d31736
< gramme/SM
26063c31889,31890
26063c31890,31891
< greybeard
---
> grey/MDRTGSP
> greybeard/SM
26066c31893
26066c31894
< greyness
---
> greyness/M
26246,26247d32072
26246,26247d32073
< guerilla's
< guerillas
26432,26436d32256
26432,26436d32257
< haemoglobin's
< haemophilia/M
< haemorrhage/DSMG
< haemorrhoid/S
< haemorrhoids/M
27167c32987
27167c32988
< hexane
---
> hexane/SM
27273a33094
27273a33095
> hippopotami
27875d33695
27875d33696
< hyaena/SM
28017c33837
28017c33838
< iPod/M
---
> iPod/MS
28105a33926
28105a33927
> idolator/SM
28513c34334
28513c34335
< inbound
---
> inbound/s
28590,28591c34411
28590,28591c34412
< incorrigibility/M
< incorrigible
---
> incorrigibleness
28593d34412
28593d34413
< incorruptibly
28650a34470
28650a34471
> indices
28812d34631
28812d34632
< inflexion/SM
29216a35036
29216a35037
> intern/GDL
29266a35087
29266a35088
> interruptible/U
29272a35094,35097
29272a35095,35098
> intersex
> intersexual/MS
> intersexualism
> intersexuality
29724c35549
29724c35550
< jewellery's
---
> jewellery/M
29870a35696
29870a35697
> judgement/MS
30066c35892
30066c35893
< kiddie/M
---
> kiddie/SM
30262,30263c36088
30262,30263c36089
< kraut's
< kraut/S!
---
> kraut/MS!
30665a36491
30665a36492
> lector/MS
31031c36857
31031c36858
< linguini's
---
> linguini/M
31034c36860
31034c36861
< linguistically
---
> linguistical/Y
31151,31152c36977
31151,31152c36978
< liver's
< liver/S
---
> liver/MS
32230c38055
32230c38056
< meanie/M
---
> meanie/MS
32317,32318c38142
32317,32318c38143
< megadeath/M
< megadeaths
---
> megadeath/SM
32320c38144
32320c38145
< megajoules
---
> megajoule/SM
32329c38153
32329c38154
< megapixel/S
---
> megapixel/MS
32708a38533
32708a38534
> might've
32717a38543
32717a38544
> migrator/SM
32760a38587
32760a38588
> millennia
32777d38603
32777d38604
< millionnaire/M
32934a38761
32934a38762
> miscommunication/S
32991a38819
32991a38820
> misjudgement/MS
33784a39613
33784a39614
> must've
33963c39792
33963c39793
< native/MS
---
> native/MSY
34169,34171c39998,39999
34169,34171c39999,40000
< neurone/S
< neurophysiology
< neuroscience
---
> neurophysiology/M
> neuroscience/MS
34275c40103
34275c40104
< nightie/M
---
> nightie/SM
35104a40933
35104a40934
> octopi
35219d41047
35219d41048
< oleomargarin/M
35226a41055
35226a41056
> oligo
35913c41742
35913c41743
< oversize/D
---
> oversize
36056,36059d41884
36056,36059d41885
< paederast/S
< paediatrician's
< paediatricians
< paediatrics/M
36291a42117
36291a42118
> paralyses
36403d42228
36403d42229
< parrakeet/MS
36449d42273
36449d42274
< partizan/SM
37093a42918
37093a42919
> petabyte/MS
37102c42927
37102c42928
< petitioner/M
---
> petitioner/MS
37264a43090
37264a43091
> phosphorylate/DSGN
37316d43141
37316d43142
< phrenetic
37630a43456
37630a43457
> plaintext
37796a43623
37796a43624
> plugin/MS
37987c43814
37987c43815
< polypeptide/S
---
> polypeptide/MS
38291d44117
38291d44118
< practise's
38451a44278
38451a44279
> prejudgement/MS
38805a44633
38805a44634
> profiler/SM
38835a44664
38835a44665
> programmatically
38891a44721,44722
38891a44722,44723
> pronate/DSGN
> pronator/MS
38951c44782
38951c44783
< proprietorship/M
---
> proprietorship/MS
39039a44871
39039a44872
> provender/M
39095a44928
39095a44929
> pseudorandom/Y
39564a45398
39564a45399
> quinoa
39873a45708,45709
39873a45709,45710
> rasterization/M
> rasterize/SGDR
40036a45873
40036a45874
> recency
40140a45978
40140a45979
> recurse/DGSV
40141a45980
40141a45981
> recuse/DGS
40208a46048
40208a46049
> refactor/SMDG
40244d46083
40244d46084
< reflexion/SM
40659d46497
40659d46498
< resizing
40829c46667
40829c46668
< reverie/M
---
> reverie/MS
41415a47254
41415a47255
> sabre/MS
41914c47753
41914c47754
< schnaps's
---
> schnaps/M
41949c47788
41949c47789
< schrod's
---
> schrod/SM
41998a47838
41998a47839
> scot-free
42883,42885c48723
42883,42885c48724
< shit's
< shit/S!
< shite/S!
---
> shit/MS!
42887,42888c48725,48726
42887,42888c48726,48727
< shithead/S!
< shitload/!
---
> shithead/MS!
> shitload/MS!
42891c48729
42891c48730
< shitty/RT!
---
> shitty/TR!
42976a48815
42976a48816
> should've
43008c48847
43008c48848
< showtime
---
> showtime/MS
43328c49167
43328c49168
< size/MGBDRS
---
> size/AMGBDRS
43724,43726c49563
43724,43726c49564
< smoulder's
< smouldered
< smoulders
---
> smoulder/GSMD
43766a49604,49605
43766a49605,49606
> snarkily
> snarky/TR
44062c49901
44062c49902
< sonofabitch
---
> sonofabitch/!
44346a50186
44346a50187
> spelled
44348a50189
44348a50190
> spelt
44371a50213
44371a50214
> spick/S!
44383c50225
44383c50226
< spik/S
---
> spik/S!
46106a51949
46106a51950
> syllabi
46160c52003
46160c52004
< synch/GMD
---
> synch/GMDS
46167d52009
46167d52010
< synchs
46203,46204c52045,52046
46203,46204c52046,52047
< sysadmin/S
< sysop/S
---
> sysadmin/MS
> sysop/MS
46752a52595
46752a52596
> terabit/MS
46753a52597,52598
46753a52598,52599
> terahertz/M
> terapixel/MS
46817a52663
46817a52664
> testcase/MS
46831a52678
46831a52679
> testsuite/MS
46925a52773
46925a52774
> theremin/MS
47455c53303
47455c53304
< toolbar
---
> toolbar/MS
47755a53604
47755a53605
> transfect/DSMG
47774a53624,53625
47774a53625,53626
> transgenderism
> transgene/MS
47951c53802
47951c53803
< triage/M
---
> triage/MG
48869a54721
48869a54722
> unlikeable
49211c55063
49211c55064
< vagina/M
---
> vagina/MS
49368,49369c55220
49368,49369c55221
< velour's
< velours's
---
> velour/MS
49478a55330
49478a55331
> vertices
50148a56001
50148a56002
> weaponize/DSG
50260,50261d56112
50260,50261d56113
< werwolf/M
< werwolves
50728c56579
50728c56580
< women
---
> women/M
50794c56645
50794c56646
< wop/S!
---
> wop/MS!

View File

@ -1,4 +1,4 @@
57467
57468
0/nm
0th/pt
1/n1
@ -26724,6 +26724,7 @@ dissemination/M
dissension/MS
dissent/SMDRZG
dissenter/M
dissentious
dissertation/MS
dissidence/M
dissident/MS

View File

@ -52,7 +52,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
float blitScaleY = float(aDstRect.height) / float(aSrcRect.height);
// We start iterating over all destination tiles
aDst->BeginTileIteration();
aDst->BeginBigImageIteration();
do {
// calculate portion of the tile that is going to be painted to
nsIntRect dstSubRect;
@ -73,7 +73,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
SetBlitFramebufferForDestTexture(aDst->GetTextureID());
UseBlitProgram();
aSrc->BeginTileIteration();
aSrc->BeginBigImageIteration();
// now iterate over all tiles in the source Image...
do {
// calculate portion of the source tile that is in the source rect

View File

@ -362,7 +362,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
bool result = true;
int oldCurrentImage = mCurrentImage;
BeginTileIteration();
BeginBigImageIteration();
do {
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
int xPos = tileRect.x;
@ -547,7 +547,7 @@ TiledTextureImage::EndUpdate()
mTextureState = Valid;
}
void TiledTextureImage::BeginTileIteration()
void TiledTextureImage::BeginBigImageIteration()
{
mCurrentImage = 0;
}
@ -567,7 +567,7 @@ bool TiledTextureImage::NextTile()
return false;
}
void TiledTextureImage::SetIterationCallback(TileIterationCallback aCallback,
void TiledTextureImage::SetIterationCallback(BigImageIterationCallback aCallback,
void* aCallbackData)
{
mIterationCallback = aCallback;

View File

@ -123,7 +123,7 @@ public:
* The Image may contain several textures for different regions (tiles).
* These functions iterate over each sub texture image tile.
*/
virtual void BeginTileIteration() {
virtual void BeginBigImageIteration() {
}
virtual bool NextTile() {
@ -133,12 +133,12 @@ public:
// Function prototype for a tile iteration callback. Returning false will
// cause iteration to be interrupted (i.e. the corresponding NextTile call
// will return false).
typedef bool (* TileIterationCallback)(TextureImage* aImage,
typedef bool (* BigImageIterationCallback)(TextureImage* aImage,
int aTileNumber,
void* aCallbackData);
// Sets a callback to be called every time NextTile is called.
virtual void SetIterationCallback(TileIterationCallback aCallback,
virtual void SetIterationCallback(BigImageIterationCallback aCallback,
void* aCallbackData) {
}
@ -335,9 +335,9 @@ public:
virtual void EndUpdate();
virtual void Resize(const gfx::IntSize& aSize);
virtual uint32_t GetTileCount();
virtual void BeginTileIteration();
virtual void BeginBigImageIteration();
virtual bool NextTile();
virtual void SetIterationCallback(TileIterationCallback aCallback,
virtual void SetIterationCallback(BigImageIterationCallback aCallback,
void* aCallbackData);
virtual gfx::IntRect GetTileRect();
virtual GLuint GetTextureID() {
@ -351,7 +351,7 @@ protected:
virtual gfx::IntRect GetSrcTileRect();
unsigned int mCurrentImage;
TileIterationCallback mIterationCallback;
BigImageIterationCallback mIterationCallback;
void* mIterationCallbackData;
nsTArray< nsRefPtr<TextureImage> > mImages;
bool mInUpdate;

View File

@ -75,7 +75,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
allocator,
gfx::ImageFormatToSurfaceFormat(format),
gfx::BackendType::NONE, // we don't need to use it with a DrawTarget
TEXTURE_FLAGS_DEFAULT);
layers::TextureFlags::DEFAULT);
if (!grallocTC->AllocateForGLRendering(size)) {
return nullptr;

View File

@ -323,6 +323,35 @@ struct ParamTraits<mozilla::gfx::ColorSpace>
mozilla::gfx::ColorSpace::Max>
{};
template <>
struct ParamTraits<mozilla::layers::TextureFlags>
: public BitFlagsTypedEnumSerializer<
mozilla::layers::TextureFlags,
mozilla::layers::TextureFlags::ALL_BITS>
{};
template <>
struct ParamTraits<mozilla::layers::TextureIdentifier>
: public ContiguousTypedEnumSerializer<
mozilla::layers::TextureIdentifier,
mozilla::layers::TextureIdentifier::Front,
mozilla::layers::TextureIdentifier::HighBound>
{};
template <>
struct ParamTraits<mozilla::layers::DeprecatedTextureHostFlags>
: public BitFlagsTypedEnumSerializer<
mozilla::layers::DeprecatedTextureHostFlags,
mozilla::layers::DeprecatedTextureHostFlags::ALL_BITS>
{};
template <>
struct ParamTraits<mozilla::layers::DiagnosticTypes>
: public BitFlagsTypedEnumSerializer<
mozilla::layers::DiagnosticTypes,
mozilla::layers::DiagnosticTypes::ALL_BITS>
{};
/*
template <>
struct ParamTraits<mozilla::PixelFormat>
@ -809,10 +838,10 @@ struct ParamTraits<mozilla::layers::TextureInfo>
template <>
struct ParamTraits<mozilla::layers::CompositableType>
: public ContiguousEnumSerializer<
: public ContiguousTypedEnumSerializer<
mozilla::layers::CompositableType,
mozilla::layers::BUFFER_UNKNOWN,
mozilla::layers::BUFFER_COUNT>
mozilla::layers::CompositableType::BUFFER_UNKNOWN,
mozilla::layers::CompositableType::BUFFER_COUNT>
{};
template <>

View File

@ -51,14 +51,14 @@ Compositor::AssertOnCompositorThread()
bool
Compositor::ShouldDrawDiagnostics(DiagnosticFlags aFlags)
{
if ((aFlags & DIAGNOSTIC_TILE) && !(mDiagnosticTypes & DIAGNOSTIC_TILE_BORDERS)) {
if ((aFlags & DiagnosticFlags::TILE) && !(mDiagnosticTypes & DiagnosticTypes::TILE_BORDERS)) {
return false;
}
if ((aFlags & DIAGNOSTIC_BIGIMAGE) &&
!(mDiagnosticTypes & DIAGNOSTIC_BIGIMAGE_BORDERS)) {
if ((aFlags & DiagnosticFlags::BIGIMAGE) &&
!(mDiagnosticTypes & DiagnosticTypes::BIGIMAGE_BORDERS)) {
return false;
}
if (!mDiagnosticTypes) {
if (mDiagnosticTypes == DiagnosticTypes::NO_DIAGNOSTIC) {
return false;
}
return true;
@ -80,7 +80,7 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
while (const nsIntRect* rect = screenIter.Next())
{
DrawDiagnostics(aFlags | DIAGNOSTIC_REGION_RECT,
DrawDiagnostics(aFlags | DiagnosticFlags::REGION_RECT,
ToRect(*rect), aClipRect, aTransform, aFlashCounter);
}
}
@ -153,23 +153,23 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
float opacity = 0.7f;
gfx::Color color;
if (aFlags & DIAGNOSTIC_CONTENT) {
if (aFlags & DiagnosticFlags::CONTENT) {
color = gfx::Color(0.0f, 1.0f, 0.0f, 1.0f); // green
if (aFlags & DIAGNOSTIC_COMPONENT_ALPHA) {
if (aFlags & DiagnosticFlags::COMPONENT_ALPHA) {
color = gfx::Color(0.0f, 1.0f, 1.0f, 1.0f); // greenish blue
}
} else if (aFlags & DIAGNOSTIC_IMAGE) {
} else if (aFlags & DiagnosticFlags::IMAGE) {
color = gfx::Color(1.0f, 0.0f, 0.0f, 1.0f); // red
} else if (aFlags & DIAGNOSTIC_COLOR) {
} else if (aFlags & DiagnosticFlags::COLOR) {
color = gfx::Color(0.0f, 0.0f, 1.0f, 1.0f); // blue
} else if (aFlags & DIAGNOSTIC_CONTAINER) {
} else if (aFlags & DiagnosticFlags::CONTAINER) {
color = gfx::Color(0.8f, 0.0f, 0.8f, 1.0f); // purple
}
// make tile borders a bit more transparent to keep layer borders readable.
if (aFlags & DIAGNOSTIC_TILE ||
aFlags & DIAGNOSTIC_BIGIMAGE ||
aFlags & DIAGNOSTIC_REGION_RECT) {
if (aFlags & DiagnosticFlags::TILE ||
aFlags & DiagnosticFlags::BIGIMAGE ||
aFlags & DiagnosticFlags::REGION_RECT) {
lWidth = 1;
opacity = 0.5f;
color.r *= 0.7f;
@ -177,7 +177,7 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
color.b *= 0.7f;
}
if (mDiagnosticTypes & DIAGNOSTIC_FLASH_BORDERS) {
if (mDiagnosticTypes & DiagnosticTypes::FLASH_BORDERS) {
float flash = (float)aFlashCounter / (float)DIAGNOSTIC_FLASH_COUNTER_MAX;
color.r *= flash;
color.g *= flash;

View File

@ -199,13 +199,13 @@ public:
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)
, mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
, mParent(aParent)
, mScreenRotation(ROTATION_0)
{
}
virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = 0) = 0;
virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) = 0;
virtual bool Initialize() = 0;
virtual void Destroy() = 0;

View File

@ -11,6 +11,9 @@
#include "LayersTypes.h" // for LayersBackend, etc
#include "nsXULAppAPI.h" // for GeckoProcessType, etc
#include "mozilla/TypedEnum.h"
#include "mozilla/TypedEnumBits.h"
namespace mozilla {
namespace layers {
@ -25,65 +28,69 @@ const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
*
* XXX - switch to all caps constant names which seems to be the standard in gecko
*/
typedef uint32_t TextureFlags;
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
const TextureFlags TEXTURE_USE_NEAREST_FILTER = 1 << 0;
// The texture should be flipped around the y-axis when composited.
const TextureFlags TEXTURE_NEEDS_Y_FLIP = 1 << 1;
// Force the texture to be represented using a single tile (note that this means
// tiled textures, not tiled layers).
const TextureFlags TEXTURE_DISALLOW_BIGIMAGE = 1 << 2;
// Allow using 'repeat' mode for wrapping.
const TextureFlags TEXTURE_ALLOW_REPEAT = 1 << 3;
// The texture represents a tile which is newly created.
const TextureFlags TEXTURE_NEW_TILE = 1 << 4;
// The texture is part of a component-alpha pair
const TextureFlags TEXTURE_COMPONENT_ALPHA = 1 << 5;
// The buffer will be treated as if the RB bytes are swapped.
// This is useful for rendering using Cairo/Thebes, because there is no
// BGRX Android pixel format, and so we have to do byte swapping.
//
// For example, if the GraphicBuffer has an Android pixel format of
// PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
// (for example, with GL), a BGRA shader should be used.
const TextureFlags TEXTURE_RB_SWAPPED = 1 << 6;
MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
NO_FLAGS = 0,
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
USE_NEAREST_FILTER = 1 << 0,
// The texture should be flipped around the y-axis when composited.
NEEDS_Y_FLIP = 1 << 1,
// Force the texture to be represented using a single tile (note that this means
// tiled textures, not tiled layers).
DISALLOW_BIGIMAGE = 1 << 2,
// Allow using 'repeat' mode for wrapping.
ALLOW_REPEAT = 1 << 3,
// The texture represents a tile which is newly created.
NEW_TILE = 1 << 4,
// The texture is part of a component-alpha pair
COMPONENT_ALPHA = 1 << 5,
// The buffer will be treated as if the RB bytes are swapped.
// This is useful for rendering using Cairo/Thebes, because there is no
// BGRX Android pixel format, and so we have to do byte swapping.
//
// For example, if the GraphicBuffer has an Android pixel format of
// PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
// (for example, with GL), a BGRA shader should be used.
RB_SWAPPED = 1 << 6,
const TextureFlags TEXTURE_FRONT = 1 << 12;
// A texture host on white for component alpha
const TextureFlags TEXTURE_ON_WHITE = 1 << 13;
// A texture host on black for component alpha
const TextureFlags TEXTURE_ON_BLACK = 1 << 14;
// A texture host that supports tiling
const TextureFlags TEXTURE_TILE = 1 << 15;
// A texture should be recycled when no longer in used
const TextureFlags TEXTURE_RECYCLE = 1 << 16;
// Texture contents should be initialized
// from the previous texture.
const TextureFlags TEXTURE_COPY_PREVIOUS = 1 << 24;
// Who is responsible for deallocating the shared data.
// if TEXTURE_DEALLOCATE_CLIENT is set, the shared data is deallocated on the
// client side and requires some extra synchronizaion to ensure race-free
// deallocation.
// The default behaviour is to deallocate on the host side.
const TextureFlags TEXTURE_DEALLOCATE_CLIENT = 1 << 25;
// After being shared ith the compositor side, an immutable texture is never
// modified, it can only be read. It is safe to not Lock/Unlock immutable
// textures.
const TextureFlags TEXTURE_IMMUTABLE = 1 << 27;
// The contents of the texture must be uploaded or copied immediately
// during the transaction, because the producer may want to write
// to it again.
const TextureFlags TEXTURE_IMMEDIATE_UPLOAD = 1 << 28;
// The texture is going to be used as part of a double
// buffered pair, and so we can guarantee that the producer/consumer
// won't be racing to access its contents.
const TextureFlags TEXTURE_DOUBLE_BUFFERED = 1 << 29;
// We've previously tried a texture and it didn't work for some reason. If there
// is a fallback available, try that.
const TextureFlags TEXTURE_ALLOC_FALLBACK = 1 << 31;
// the default flags
const TextureFlags TEXTURE_FLAGS_DEFAULT = TEXTURE_FRONT;
FRONT = 1 << 7,
// A texture host on white for component alpha
ON_WHITE = 1 << 8,
// A texture host on black for component alpha
ON_BLACK = 1 << 9,
// A texture host that supports tiling
TILE = 1 << 10,
// A texture should be recycled when no longer in used
RECYCLE = 1 << 11,
// Texture contents should be initialized
// from the previous texture.
COPY_PREVIOUS = 1 << 12,
// Who is responsible for deallocating the shared data.
// if DEALLOCATE_CLIENT is set, the shared data is deallocated on the
// client side and requires some extra synchronizaion to ensure race-free
// deallocation.
// The default behaviour is to deallocate on the host side.
DEALLOCATE_CLIENT = 1 << 13,
// After being shared ith the compositor side, an immutable texture is never
// modified, it can only be read. It is safe to not Lock/Unlock immutable
// textures.
IMMUTABLE = 1 << 14,
// The contents of the texture must be uploaded or copied immediately
// during the transaction, because the producer may want to write
// to it again.
IMMEDIATE_UPLOAD = 1 << 15,
// The texture is going to be used as part of a double
// buffered pair, and so we can guarantee that the producer/consumer
// won't be racing to access its contents.
DOUBLE_BUFFERED = 1 << 16,
// We've previously tried a texture and it didn't work for some reason. If there
// is a fallback available, try that.
ALLOC_FALLBACK = 1 << 17,
// OR union of all valid bits
ALL_BITS = (1 << 18) - 1,
// the default flags
DEFAULT = FRONT
MOZ_END_ENUM_CLASS(TextureFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
static inline bool
TextureRequiresLocking(TextureFlags aFlags)
@ -91,57 +98,61 @@ TextureRequiresLocking(TextureFlags aFlags)
// If we're not double buffered, or uploading
// within a transaction, then we need to support
// locking correctly.
return !(aFlags & (TEXTURE_IMMEDIATE_UPLOAD |
TEXTURE_DOUBLE_BUFFERED |
TEXTURE_IMMUTABLE));
return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
TextureFlags::DOUBLE_BUFFERED |
TextureFlags::IMMUTABLE));
}
/**
* The type of debug diagnostic to enable.
*/
typedef uint32_t DiagnosticTypes;
const DiagnosticTypes DIAGNOSTIC_NONE = 0;
const DiagnosticTypes DIAGNOSTIC_TILE_BORDERS = 1 << 0;
const DiagnosticTypes DIAGNOSTIC_LAYER_BORDERS = 1 << 1;
const DiagnosticTypes DIAGNOSTIC_BIGIMAGE_BORDERS = 1 << 2;
const DiagnosticTypes DIAGNOSTIC_FLASH_BORDERS = 1 << 3;
MOZ_BEGIN_ENUM_CLASS(DiagnosticTypes, uint8_t)
NO_DIAGNOSTIC = 0,
TILE_BORDERS = 1 << 0,
LAYER_BORDERS = 1 << 1,
BIGIMAGE_BORDERS = 1 << 2,
FLASH_BORDERS = 1 << 3,
ALL_BITS = (1 << 4) - 1
MOZ_END_ENUM_CLASS(DiagnosticTypes)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticTypes)
#define DIAGNOSTIC_FLASH_COUNTER_MAX 100
/**
* Information about the object that is being diagnosed.
*/
typedef uint32_t DiagnosticFlags;
const DiagnosticFlags DIAGNOSTIC_IMAGE = 1 << 0;
const DiagnosticFlags DIAGNOSTIC_CONTENT = 1 << 1;
const DiagnosticFlags DIAGNOSTIC_CANVAS = 1 << 2;
const DiagnosticFlags DIAGNOSTIC_COLOR = 1 << 3;
const DiagnosticFlags DIAGNOSTIC_CONTAINER = 1 << 4;
const DiagnosticFlags DIAGNOSTIC_TILE = 1 << 5;
const DiagnosticFlags DIAGNOSTIC_BIGIMAGE = 1 << 6;
const DiagnosticFlags DIAGNOSTIC_COMPONENT_ALPHA = 1 << 7;
const DiagnosticFlags DIAGNOSTIC_REGION_RECT = 1 << 8;
MOZ_BEGIN_ENUM_CLASS(DiagnosticFlags, uint16_t)
NO_DIAGNOSTIC = 0,
IMAGE = 1 << 0,
CONTENT = 1 << 1,
CANVAS = 1 << 2,
COLOR = 1 << 3,
CONTAINER = 1 << 4,
TILE = 1 << 5,
BIGIMAGE = 1 << 6,
COMPONENT_ALPHA = 1 << 7,
REGION_RECT = 1 << 8
MOZ_END_ENUM_CLASS(DiagnosticFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticFlags)
/**
* See gfx/layers/Effects.h
*/
enum EffectTypes
{
EFFECT_MASK,
EFFECT_MAX_SECONDARY, // sentinel for the count of secondary effect types
EFFECT_RGB,
EFFECT_YCBCR,
EFFECT_COMPONENT_ALPHA,
EFFECT_SOLID_COLOR,
EFFECT_RENDER_TARGET,
EFFECT_MAX //sentinel for the count of all effect types
};
MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_t)
MASK,
MAX_SECONDARY, // sentinel for the count of secondary effect types
RGB,
YCBCR,
COMPONENT_ALPHA,
SOLID_COLOR,
RENDER_TARGET,
MAX //sentinel for the count of all effect types
MOZ_END_ENUM_CLASS(EffectTypes)
/**
* How the Compositable should manage textures.
*/
enum CompositableType
{
MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
BUFFER_UNKNOWN,
// the deprecated compositable types
BUFFER_IMAGE_SINGLE, // image/canvas with a single texture, single buffered
@ -153,23 +164,23 @@ enum CompositableType
BUFFER_TILED, // tiled thebes layer
BUFFER_SIMPLE_TILED,
// the new compositable types
COMPOSITABLE_IMAGE, // image with single buffering
COMPOSITABLE_CONTENT_SINGLE, // thebes layer interface, single buffering
COMPOSITABLE_CONTENT_DOUBLE, // thebes layer interface, double buffering
IMAGE, // image with single buffering
CONTENT_SINGLE, // thebes layer interface, single buffering
CONTENT_DOUBLE, // thebes layer interface, double buffering
BUFFER_COUNT
};
MOZ_END_ENUM_CLASS(CompositableType)
/**
* How the texture host is used for composition,
*/
enum DeprecatedTextureHostFlags
{
TEXTURE_HOST_DEFAULT = 0, // The default texture host for the given
// SurfaceDescriptor
TEXTURE_HOST_TILED = 1 << 0, // A texture host that supports tiling
TEXTURE_HOST_COPY_PREVIOUS = 1 << 1 // Texture contents should be initialized
MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
DEFAULT = 0, // The default texture host for the given SurfaceDescriptor
TILED = 1 << 0, // A texture host that supports tiling
COPY_PREVIOUS = 1 << 1, // Texture contents should be initialized
// from the previous texture.
};
ALL_BITS = (1 << 2) - 1
MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DeprecatedTextureHostFlags)
/**
* Sent from the compositor to the content-side LayerManager, includes properties
@ -203,11 +214,13 @@ struct TextureFactoryIdentifier
* XXX - This is now redundant with TextureFlags. it ill be removed along with
* deprecated texture classes.
*/
typedef uint32_t TextureIdentifier;
const TextureIdentifier TextureFront = 1;
const TextureIdentifier TextureBack = 2;
const TextureIdentifier TextureOnWhiteFront = 3;
const TextureIdentifier TextureOnWhiteBack = 4;
MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
Front = 1,
Back = 2,
OnWhiteFront = 3,
OnWhiteBack = 4,
HighBound
MOZ_END_ENUM_CLASS(TextureIdentifier)
/**
* Information required by the compositor from the content-side for creating or
@ -219,19 +232,19 @@ const TextureIdentifier TextureOnWhiteBack = 4;
struct TextureInfo
{
CompositableType mCompositableType;
uint32_t mDeprecatedTextureHostFlags;
uint32_t mTextureFlags;
DeprecatedTextureHostFlags mDeprecatedTextureHostFlags;
TextureFlags mTextureFlags;
TextureInfo()
: mCompositableType(BUFFER_UNKNOWN)
, mDeprecatedTextureHostFlags(0)
, mTextureFlags(0)
: mCompositableType(CompositableType::BUFFER_UNKNOWN)
, mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
, mTextureFlags(TextureFlags::NO_FLAGS)
{}
TextureInfo(CompositableType aType)
: mCompositableType(aType)
, mDeprecatedTextureHostFlags(0)
, mTextureFlags(0)
, mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
, mTextureFlags(TextureFlags::NO_FLAGS)
{}
bool operator==(const TextureInfo& aOther) const
@ -247,21 +260,24 @@ struct TextureInfo
*
* See ShadowLayerForwarder::OpenDescriptor for example.
*/
typedef uint32_t OpenMode;
const OpenMode OPEN_READ = 0x1;
const OpenMode OPEN_WRITE = 0x2;
const OpenMode OPEN_READ_WRITE = OPEN_READ|OPEN_WRITE;
const OpenMode OPEN_READ_ONLY = OPEN_READ;
const OpenMode OPEN_WRITE_ONLY = OPEN_WRITE;
MOZ_BEGIN_ENUM_CLASS(OpenMode, uint8_t)
OPEN_NONE = 0,
OPEN_READ = 0x1,
OPEN_WRITE = 0x2,
OPEN_READ_WRITE = OPEN_READ|OPEN_WRITE,
OPEN_READ_ONLY = OPEN_READ,
OPEN_WRITE_ONLY = OPEN_WRITE
MOZ_END_ENUM_CLASS(OpenMode)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OpenMode)
// The kinds of mask texture a shader can support
// We rely on the items in this enum being sequential
enum MaskType {
MOZ_BEGIN_ENUM_CLASS(MaskType, uint8_t)
MaskNone = 0, // no mask layer
Mask2d, // mask layer for layers with 2D transforms
Mask3d, // mask layer for layers with 3D transforms
NumMaskTypes
};
MOZ_END_ENUM_CLASS(MaskType)
} // namespace layers
} // namespace mozilla

View File

@ -131,7 +131,7 @@ D3D9SurfaceImage::GetTextureClient(CompositableClient* aClient)
EnsureSynchronized();
if (!mTextureClient) {
RefPtr<SharedTextureClientD3D9> textureClient =
new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TEXTURE_FLAGS_DEFAULT);
new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TextureFlags::DEFAULT);
textureClient->InitWith(mTexture, mShareHandle, mDesc);
mTextureClient = textureClient;
}

View File

@ -17,6 +17,7 @@
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nscore.h" // for nsACString
#include "mozilla/EnumeratedArray.h"
namespace mozilla {
namespace layers {
@ -80,7 +81,7 @@ struct EffectMask : public Effect
EffectMask(TextureSource *aMaskTexture,
gfx::IntSize aSize,
const gfx::Matrix4x4 &aMaskTransform)
: Effect(EFFECT_MASK)
: Effect(EffectTypes::MASK)
, mMaskTexture(aMaskTexture)
, mIs3D(false)
, mSize(aSize)
@ -99,7 +100,7 @@ struct EffectMask : public Effect
struct EffectRenderTarget : public TexturedEffect
{
EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
: TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
: TexturedEffect(EffectTypes::RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
, mRenderTarget(aRenderTarget)
{}
@ -115,7 +116,7 @@ struct EffectRGB : public TexturedEffect
bool aPremultiplied,
gfx::Filter aFilter,
bool aFlipped = false)
: TexturedEffect(EFFECT_RGB, aTexture, aPremultiplied, aFilter)
: TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aFilter)
{}
virtual const char* Name() { return "EffectRGB"; }
@ -124,7 +125,7 @@ struct EffectRGB : public TexturedEffect
struct EffectYCbCr : public TexturedEffect
{
EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
: TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
: TexturedEffect(EffectTypes::YCBCR, aSource, false, aFilter)
{}
virtual const char* Name() { return "EffectYCbCr"; }
@ -135,7 +136,7 @@ struct EffectComponentAlpha : public TexturedEffect
EffectComponentAlpha(TextureSource *aOnBlack,
TextureSource *aOnWhite,
gfx::Filter aFilter)
: TexturedEffect(EFFECT_COMPONENT_ALPHA, nullptr, false, aFilter)
: TexturedEffect(EffectTypes::COMPONENT_ALPHA, nullptr, false, aFilter)
, mOnBlack(aOnBlack)
, mOnWhite(aOnWhite)
{}
@ -149,7 +150,7 @@ struct EffectComponentAlpha : public TexturedEffect
struct EffectSolidColor : public Effect
{
EffectSolidColor(const gfx::Color &aColor)
: Effect(EFFECT_SOLID_COLOR)
: Effect(EffectTypes::SOLID_COLOR)
, mColor(aColor)
{}
@ -164,7 +165,8 @@ struct EffectChain
explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {}
RefPtr<Effect> mPrimaryEffect;
RefPtr<Effect> mSecondaryEffects[EFFECT_MAX_SECONDARY];
EnumeratedArray<EffectTypes, EffectTypes::MAX_SECONDARY, RefPtr<Effect>>
mSecondaryEffects;
void* mLayerRef; //!< For LayerScope logging
};

View File

@ -131,7 +131,7 @@ ImageContainer::ImageContainer(int flag)
if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
// the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
// of this class must be done on the ImageBridge thread.
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(BUFFER_IMAGE_SINGLE).drop();
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::BUFFER_IMAGE_SINGLE).drop();
MOZ_ASSERT(mImageClient);
}
}
@ -624,12 +624,12 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
// gfx::BackendType::NONE means default to content backend
textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
TEXTURE_FLAGS_DEFAULT,
TextureFlags::DEFAULT,
gfx::BackendType::NONE,
surface->GetSize());
MOZ_ASSERT(textureClient->CanExposeDrawTarget());
if (!textureClient->AllocateForSurface(surface->GetSize()) ||
!textureClient->Lock(OPEN_WRITE_ONLY)) {
!textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
return nullptr;
}

View File

@ -778,20 +778,20 @@ LayerScope::SendEffectChain(GLContext* aGLContext,
const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
switch (primaryEffect->mType) {
case EFFECT_RGB:
case EffectTypes::RGB:
{
const TexturedEffect* texturedEffect =
static_cast<const TexturedEffect*>(primaryEffect);
SendTexturedEffect(aGLContext, aEffectChain.mLayerRef, texturedEffect);
}
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
{
const EffectYCbCr* yCbCrEffect =
static_cast<const EffectYCbCr*>(primaryEffect);
SendYCbCrEffect(aGLContext, aEffectChain.mLayerRef, yCbCrEffect);
}
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
{
const EffectSolidColor* solidColorEffect =
static_cast<const EffectSolidColor*>(primaryEffect);
@ -802,13 +802,13 @@ LayerScope::SendEffectChain(GLContext* aGLContext,
SendColor(aEffectChain.mLayerRef, color, aWidth, aHeight);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EFFECT_RENDER_TARGET:
case EffectTypes::COMPONENT_ALPHA:
case EffectTypes::RENDER_TARGET:
default:
break;
}
//const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EFFECT_MASK];
//const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EffectTypes::MASK];
// TODO:
}

View File

@ -180,13 +180,13 @@ AppendToString(nsACString& s, TextureFlags flags,
const char* pfx, const char* sfx)
{
s += pfx;
if (!flags) {
if (flags == TextureFlags::NO_FLAGS) {
s += "NoFlags";
} else {
#define AppendFlag(test) \
{ \
if (flags & test) { \
if (!!(flags & test)) { \
if (previous) { \
s += "|"; \
} \
@ -195,11 +195,11 @@ AppendToString(nsACString& s, TextureFlags flags,
} \
}
bool previous = false;
AppendFlag(TEXTURE_USE_NEAREST_FILTER);
AppendFlag(TEXTURE_NEEDS_Y_FLIP);
AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
AppendFlag(TEXTURE_ALLOW_REPEAT);
AppendFlag(TEXTURE_NEW_TILE);
AppendFlag(TextureFlags::USE_NEAREST_FILTER);
AppendFlag(TextureFlags::NEEDS_Y_FLIP);
AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
AppendFlag(TextureFlags::ALLOW_REPEAT);
AppendFlag(TextureFlags::NEW_TILE);
#undef AppendFlag
}

View File

@ -11,6 +11,7 @@
#include "nsRegion.h"
#include "mozilla/TypedEnum.h"
#include "mozilla/TypedEnumBits.h"
#ifdef MOZ_WIDGET_GONK
#include <ui/GraphicBuffer.h>
@ -40,8 +41,6 @@ namespace layers {
class TextureHost;
typedef uint32_t TextureFlags;
#undef NONE
#undef OPAQUE
@ -77,42 +76,47 @@ MOZ_END_ENUM_CLASS(SurfaceMode)
// LayerRenderState for Composer2D
// We currently only support Composer2D using gralloc. If we want to be backed
// by other surfaces we will need a more generic LayerRenderState.
enum LayerRenderStateFlags {
LAYER_RENDER_STATE_Y_FLIPPED = 1 << 0,
LAYER_RENDER_STATE_BUFFER_ROTATION = 1 << 1,
MOZ_BEGIN_ENUM_CLASS(LayerRenderStateFlags, int8_t)
LAYER_RENDER_STATE_DEFAULT = 0,
Y_FLIPPED = 1 << 0,
BUFFER_ROTATION = 1 << 1,
// Notify Composer2D to swap the RB pixels of gralloc buffer
LAYER_RENDER_STATE_FORMAT_RB_SWAP = 1 << 2
};
FORMAT_RB_SWAP = 1 << 2
MOZ_END_ENUM_CLASS(LayerRenderStateFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
// The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
// android::sp unless we have to.
struct LayerRenderState {
LayerRenderState()
#ifdef MOZ_WIDGET_GONK
: mSurface(nullptr), mTexture(nullptr), mFlags(0), mHasOwnOffset(false)
: mFlags(LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT)
, mHasOwnOffset(false)
, mSurface(nullptr)
, mTexture(nullptr)
#endif
{}
#ifdef MOZ_WIDGET_GONK
LayerRenderState(android::GraphicBuffer* aSurface,
const nsIntSize& aSize,
uint32_t aFlags,
LayerRenderStateFlags aFlags,
TextureHost* aTexture)
: mSurface(aSurface)
: mFlags(aFlags)
, mHasOwnOffset(false)
, mSurface(aSurface)
, mSize(aSize)
, mTexture(aTexture)
, mFlags(aFlags)
, mHasOwnOffset(false)
{}
bool YFlipped() const
{ return mFlags & LAYER_RENDER_STATE_Y_FLIPPED; }
{ return bool(mFlags & LayerRenderStateFlags::Y_FLIPPED); }
bool BufferRotated() const
{ return mFlags & LAYER_RENDER_STATE_BUFFER_ROTATION; }
{ return bool(mFlags & LayerRenderStateFlags::BUFFER_ROTATION); }
bool FormatRBSwapped() const
{ return mFlags & LAYER_RENDER_STATE_FORMAT_RB_SWAP; }
{ return bool(mFlags & LayerRenderStateFlags::FORMAT_RB_SWAP); }
#endif
void SetOffset(const nsIntPoint& aOffset)
@ -121,6 +125,12 @@ struct LayerRenderState {
mHasOwnOffset = true;
}
// see LayerRenderStateFlags
LayerRenderStateFlags mFlags;
// true if mOffset is applicable
bool mHasOwnOffset;
// the location of the layer's origin on mSurface
nsIntPoint mOffset;
#ifdef MOZ_WIDGET_GONK
// surface to render
android::sp<android::GraphicBuffer> mSurface;
@ -128,12 +138,6 @@ struct LayerRenderState {
nsIntSize mSize;
TextureHost* mTexture;
#endif
// see LayerRenderStateFlags
uint32_t mFlags;
// the location of the layer's origin on mSurface
nsIntPoint mOffset;
// true if mOffset is applicable
bool mHasOwnOffset;
};
MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t)

View File

@ -14,7 +14,7 @@ MacIOSurfaceImage::GetTextureClient(CompositableClient* aClient)
{
if (!mTextureClient) {
RefPtr<MacIOSurfaceTextureClientOGL> buffer =
new MacIOSurfaceTextureClientOGL(TEXTURE_FLAGS_DEFAULT);
new MacIOSurfaceTextureClientOGL(TextureFlags::DEFAULT);
buffer->InitWith(mSurface);
mTextureClient = buffer;
}

View File

@ -1602,6 +1602,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
// smooth. If an animation frame is requested, it is the compositor's
// responsibility to schedule a composite.
bool requestAnimationFrame = false;
Vector<Task*> deferredTasks;
{
ReentrantMonitorAutoEnter lock(mMonitor);
@ -1616,12 +1617,19 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
ParentLayerSize(mFrameMetrics.mCompositionBounds.Size()) / mFrameMetrics.GetZoomToParent()));
mCurrentAsyncScrollOffset = mFrameMetrics.GetScrollOffset();
// Get any deferred tasks queued up by mAnimation's Sample() (called by
// UpdateAnimation()). This needs to be done here since mAnimation can
// be destroyed by another thread when we release the monitor, but
// the tasks need to be executed after we release the monitor since they
// are allowed to call APZCTreeManager methods which can grab the tree lock.
if (mAnimation) {
deferredTasks = mAnimation->TakeDeferredTasks();
}
}
// Execute tasks queued up by mAnimation's Sample() (called by
// UpdateAnimation()) for execution after mMonitor has been released.
if (mAnimation) {
mAnimation->ExecuteDeferredTasks();
for (uint32_t i = 0; i < deferredTasks.length(); ++i) {
deferredTasks[i]->Run();
}
// Cancel the mAsyncScrollTimeoutTask because we will fire a

View File

@ -948,14 +948,14 @@ public:
const TimeDuration& aDelta) = 0;
/**
* Execute the tasks in |mDeferredTasks| in order. See |mDeferredTasks|
* Get the deferred tasks in |mDeferredTasks|. See |mDeferredTasks|
* for more information.
* Clears |mDeferredTasks|.
*/
void ExecuteDeferredTasks() {
for (uint32_t i = 0; i < mDeferredTasks.length(); ++i) {
mDeferredTasks[i]->Run();
}
mDeferredTasks.clear();
Vector<Task*> TakeDeferredTasks() {
Vector<Task*> result;
mDeferredTasks.swap(result);
return result;
}
/**

View File

@ -126,7 +126,7 @@ BasicCompositor::CreateDataTextureSource(TextureFlags aFlags)
bool
BasicCompositor::SupportsEffect(EffectTypes aEffect)
{
return static_cast<EffectTypes>(aEffect) != EFFECT_YCBCR;
return static_cast<EffectTypes>(aEffect) != EffectTypes::YCBCR;
}
static void
@ -291,8 +291,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
RefPtr<SourceSurface> sourceMask;
Matrix maskTransform;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface();
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
MOZ_ASSERT(!effectMask->mIs3D);
@ -301,7 +301,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
}
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
EffectSolidColor* effectSolidColor =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
@ -309,7 +309,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
DrawOptions(aOpacity), sourceMask, &maskTransform);
break;
}
case EFFECT_RGB: {
case EffectTypes::RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSourceBasic* source = texturedEffect->mTexture->AsSourceBasic();
@ -321,11 +321,11 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
aOpacity, sourceMask, &maskTransform);
break;
}
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
break;
}
case EFFECT_RENDER_TARGET: {
case EffectTypes::RENDER_TARGET: {
EffectRenderTarget* effectRenderTarget =
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<BasicCompositingRenderTarget> surface
@ -339,7 +339,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
aOpacity, sourceMask, &maskTransform);
break;
}
case EFFECT_COMPONENT_ALPHA: {
case EffectTypes::COMPONENT_ALPHA: {
NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
break;
}

View File

@ -65,7 +65,7 @@ public:
const gfx::IntPoint &aSourcePoint) MOZ_OVERRIDE;
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
virtual bool SupportsEffect(EffectTypes aEffect) MOZ_OVERRIDE;

View File

@ -71,7 +71,7 @@ TextureClientX11::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
TextureClientData*
TextureClientX11::DropTextureData()
{
MOZ_ASSERT(!(mFlags & TEXTURE_DEALLOCATE_CLIENT));
MOZ_ASSERT(!(mFlags & TextureFlags::DEALLOCATE_CLIENT));
return nullptr;
}

View File

@ -19,7 +19,7 @@ namespace layers {
class TextureClientX11 : public TextureClient
{
public:
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
~TextureClientX11();

View File

@ -43,7 +43,7 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
#endif
if (aType == CanvasClientGLContext &&
aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
aFlags |= TEXTURE_DEALLOCATE_CLIENT;
aFlags |= TextureFlags::DEALLOCATE_CLIENT;
return new CanvasClientSurfaceStream(aForwarder, aFlags);
}
return new CanvasClient2D(aForwarder, aFlags);
@ -66,9 +66,9 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
: gfxContentType::COLOR_ALPHA;
gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
uint32_t flags = TEXTURE_FLAGS_DEFAULT;
if (mTextureFlags & TEXTURE_NEEDS_Y_FLIP) {
flags |= TEXTURE_NEEDS_Y_FLIP;
TextureFlags flags = TextureFlags::DEFAULT;
if (mTextureFlags & TextureFlags::NEEDS_Y_FLIP) {
flags |= TextureFlags::NEEDS_Y_FLIP;
}
mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
flags,
@ -79,7 +79,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
bufferCreated = true;
}
if (!mBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mBuffer = nullptr;
return;
}

View File

@ -79,7 +79,7 @@ public:
TextureInfo GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
virtual void Clear() MOZ_OVERRIDE
@ -113,7 +113,7 @@ public:
TextureInfo GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
virtual void Clear() MOZ_OVERRIDE

View File

@ -133,18 +133,18 @@ ClientCanvasLayer::RenderLayer()
}
if (!mCanvasClient) {
TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD;
TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD;
if (mNeedsYFlip) {
flags |= TEXTURE_NEEDS_Y_FLIP;
flags |= TextureFlags::NEEDS_Y_FLIP;
}
if (!mGLContext) {
// We don't support locking for buffer surfaces currently
flags |= TEXTURE_IMMEDIATE_UPLOAD;
flags |= TextureFlags::IMMEDIATE_UPLOAD;
} else {
// GLContext's SurfaceStream handles ownership itself,
// and doesn't require layers to do any deallocation.
flags |= TEXTURE_DEALLOCATE_CLIENT;
flags |= TextureFlags::DEALLOCATE_CLIENT;
}
mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
ClientManager()->AsShadowForwarder(), flags);

View File

@ -29,7 +29,7 @@ public:
ClientImageLayer(ClientLayerManager* aLayerManager)
: ImageLayer(aLayerManager,
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
, mImageClientTypeContainer(BUFFER_UNKNOWN)
, mImageClientTypeContainer(CompositableType::BUFFER_UNKNOWN)
{
MOZ_COUNT_CTOR(ClientImageLayer);
}
@ -42,7 +42,7 @@ public:
virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
{
ImageLayer::SetContainer(aContainer);
mImageClientTypeContainer = BUFFER_UNKNOWN;
mImageClientTypeContainer = CompositableType::BUFFER_UNKNOWN;
}
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
@ -94,12 +94,12 @@ protected:
CompositableType GetImageClientType()
{
if (mImageClientTypeContainer != BUFFER_UNKNOWN) {
if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
return mImageClientTypeContainer;
}
if (mContainer->IsAsync()) {
mImageClientTypeContainer = BUFFER_BRIDGE;
mImageClientTypeContainer = CompositableType::BUFFER_BRIDGE;
return mImageClientTypeContainer;
}
@ -107,13 +107,13 @@ protected:
AutoLockImage autoLock(mContainer, &surface);
#ifdef MOZ_WIDGET_GONK
// gralloc buffer needs BUFFER_IMAGE_BUFFERED to prevent
// gralloc buffer needs CompositableType::BUFFER_IMAGE_BUFFERED to prevent
// the buffer's usage conflict.
mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_BUFFERED : BUFFER_UNKNOWN;
CompositableType::BUFFER_IMAGE_BUFFERED : CompositableType::BUFFER_UNKNOWN;
#else
mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_SINGLE : BUFFER_UNKNOWN;
CompositableType::BUFFER_IMAGE_SINGLE : CompositableType::BUFFER_UNKNOWN;
#endif
return mImageClientTypeContainer;
}
@ -140,17 +140,17 @@ ClientImageLayer::RenderLayer()
if (!mImageClient ||
!mImageClient->UpdateImage(mContainer, GetContentFlags())) {
CompositableType type = GetImageClientType();
if (type == BUFFER_UNKNOWN) {
if (type == CompositableType::BUFFER_UNKNOWN) {
return;
}
TextureFlags flags = TEXTURE_FRONT;
TextureFlags flags = TextureFlags::FRONT;
if (mDisallowBigImage) {
flags |= TEXTURE_DISALLOW_BIGIMAGE;
flags |= TextureFlags::DISALLOW_BIGIMAGE;
}
mImageClient = ImageClient::CreateImageClient(type,
ClientManager()->AsShadowForwarder(),
flags);
if (type == BUFFER_BRIDGE) {
if (type == CompositableType::BUFFER_BRIDGE) {
static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
}

View File

@ -10,6 +10,7 @@
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
#include "mozilla/layers/TextureClientOGL.h"
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "mozilla/layers/PCompositableChild.h"
#ifdef XP_WIN
#include "gfxWindowsPlatform.h" // for gfxWindowsPlatform
#include "mozilla/layers/TextureD3D11.h"

View File

@ -14,7 +14,6 @@
#include "mozilla/gfx/Types.h" // for SurfaceFormat
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
#include "mozilla/layers/PCompositableChild.h" // for PCompositableChild
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
namespace mozilla {
@ -28,7 +27,7 @@ class CompositableForwarder;
class CompositableChild;
class SurfaceDescriptor;
class TextureClientData;
class PCompositableChild;
/**
* CompositableClient manages the texture-specific logic for composite layers,
* independently of the layer. It is the content side of a CompositableClient/
@ -75,7 +74,7 @@ protected:
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = TextureFlags::NO_FLAGS);
virtual TextureInfo GetTextureInfo() const = 0;
@ -83,7 +82,7 @@ public:
TemporaryRef<BufferTextureClient>
CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
TextureFlags aFlags = TextureFlags::DEFAULT,
gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
TemporaryRef<TextureClient>

View File

@ -40,20 +40,19 @@ namespace layers {
static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFlags)
{
TextureFlags result = 0;
TextureFlags result = TextureFlags::NO_FLAGS;
if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
result |= TEXTURE_COMPONENT_ALPHA;
result |= TextureFlags::COMPONENT_ALPHA;
}
if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
result |= TEXTURE_ALLOW_REPEAT;
result |= TextureFlags::ALLOW_REPEAT;
}
return result;
}
/* static */ TemporaryRef<ContentClient>
ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
{
@ -197,7 +196,7 @@ ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>&
if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
aClient = CreateTextureClientForDrawing(mSurfaceFormat,
mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags,
mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK | aFlags,
gfx::BackendType::NONE,
mSize);
if (!aClient) {
@ -236,19 +235,19 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
mSize = gfx::IntSize(aRect.width, aRect.height);
mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
if (!CreateAndAllocateTextureClient(mTextureClient, TextureFlags::ON_BLACK) ||
!AddTextureClient(mTextureClient)) {
AbortTextureClientCreation();
return;
}
if (aFlags & BUFFER_COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TextureFlags::ON_WHITE) ||
!AddTextureClient(mTextureClientOnWhite)) {
AbortTextureClientCreation();
return;
}
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
}
CreateFrontBuffer(aRect);
@ -268,12 +267,12 @@ ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
// We just created the textures and we are about to get their draw targets
// so we have to lock them here.
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked, "Could not lock the TextureClient");
*aBlackDT = mTextureClient->GetAsDrawTarget();
if (aFlags & BUFFER_COMPONENT_ALPHA) {
locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
*aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget();
@ -339,13 +338,13 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
void
ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
{
if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
if (!CreateAndAllocateTextureClient(mFrontClient, TextureFlags::ON_BLACK) ||
!AddTextureClient(mFrontClient)) {
AbortTextureClientCreation();
return;
}
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TextureFlags::ON_WHITE) ||
!AddTextureClient(mFrontClientOnWhite)) {
AbortTextureClientCreation();
return;
@ -427,11 +426,11 @@ void
ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{
if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
@ -465,11 +464,11 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
// We need to ensure that we lock these two buffers in the same
// order as the compositor to prevent deadlocks.
if (!mFrontClient->Lock(OPEN_READ_ONLY)) {
if (!mFrontClient->Lock(OpenMode::OPEN_READ_ONLY)) {
return;
}
if (mFrontClientOnWhite &&
!mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) {
!mFrontClientOnWhite->Lock(OpenMode::OPEN_READ_ONLY)) {
mFrontClient->Unlock();
return;
}
@ -540,11 +539,11 @@ void
ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{
if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
}
@ -572,11 +571,23 @@ FillSurface(DrawTarget* aDT, const nsIntRegion& aRegion,
}
}
void
ContentClientIncremental::NotifyBufferCreated(ContentType aType, TextureFlags aFlags)
{
mTextureInfo.mTextureFlags = aFlags;
mContentType = aType;
mForwarder->CreatedIncrementalBuffer(this,
mTextureInfo,
mBufferRect);
}
RotatedContentBuffer::PaintState
ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
uint32_t aFlags)
{
mTextureInfo.mDeprecatedTextureHostFlags = 0;
mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::DEFAULT;
PaintState result;
// We need to disable rotation if we're going to be resampled when
// drawing, because we might sample across the rotation boundary.
@ -601,7 +612,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
mHasBuffer &&
(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
!(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
!(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
if (canReuseBuffer) {
if (mBufferRect.Contains(neededRegion.GetBounds())) {
@ -685,9 +696,12 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
bool createdBuffer = false;
uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
TextureFlags bufferFlags = TextureFlags::NO_FLAGS;
if (canHaveRotation) {
bufferFlags |= TextureFlags::ALLOW_REPEAT;
}
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= TEXTURE_COMPONENT_ALPHA;
bufferFlags |= TextureFlags::COMPONENT_ALPHA;
}
if (canReuseBuffer) {
nsIntRect keepArea;
@ -740,7 +754,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
if (createdBuffer) {
if (mHasBuffer &&
(mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::COPY_PREVIOUS;
}
mHasBuffer = true;
@ -837,7 +851,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
{
if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
mForwarder->UpdateTextureIncremental(this,
TextureFront,
TextureIdentifier::Front,
mUpdateDescriptor,
aRegionToDraw,
mBufferRect,
@ -846,7 +860,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
}
if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
mForwarder->UpdateTextureIncremental(this,
TextureOnWhiteFront,
TextureIdentifier::OnWhiteFront,
mUpdateDescriptorOnWhite,
aRegionToDraw,
mBufferRect,

View File

@ -274,7 +274,7 @@ protected:
virtual void DestroyFrontBuffer() {}
bool CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
TextureFlags aFlags = 0);
TextureFlags aFlags = TextureFlags::NO_FLAGS);
virtual void AbortTextureClientCreation()
{
@ -314,7 +314,7 @@ public:
ContentClientDoubleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_DOUBLE;
mTextureInfo.mCompositableType = CompositableType::CONTENT_DOUBLE;
}
virtual ~ContentClientDoubleBuffered() {}
@ -368,7 +368,7 @@ public:
ContentClientSingleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_SINGLE;
mTextureInfo.mCompositableType = CompositableType::CONTENT_SINGLE;
}
virtual ~ContentClientSingleBuffered() {}
@ -394,7 +394,7 @@ public:
, mHasBuffer(false)
, mHasBufferOnWhite(false)
{
mTextureInfo.mCompositableType = BUFFER_CONTENT_INC;
mTextureInfo.mCompositableType = CompositableType::BUFFER_CONTENT_INC;
}
typedef RotatedContentBuffer::PaintState PaintState;
@ -443,16 +443,7 @@ private:
BUFFER_WHITE
};
void NotifyBufferCreated(ContentType aType, uint32_t aFlags)
{
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
mContentType = aType;
mForwarder->CreatedIncrementalBuffer(this,
mTextureInfo,
mBufferRect);
}
void NotifyBufferCreated(ContentType aType, TextureFlags aFlags);
TemporaryRef<gfx::DrawTarget> GetUpdateSurface(BufferType aType,
const nsIntRegion& aUpdateRegion);

View File

@ -48,17 +48,17 @@ ImageClient::CreateImageClient(CompositableType aCompositableHostType,
{
RefPtr<ImageClient> result = nullptr;
switch (aCompositableHostType) {
case COMPOSITABLE_IMAGE:
case BUFFER_IMAGE_SINGLE:
result = new ImageClientSingle(aForwarder, aFlags, COMPOSITABLE_IMAGE);
case CompositableType::IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
result = new ImageClientSingle(aForwarder, aFlags, CompositableType::IMAGE);
break;
case BUFFER_IMAGE_BUFFERED:
result = new ImageClientBuffered(aForwarder, aFlags, COMPOSITABLE_IMAGE);
case CompositableType::BUFFER_IMAGE_BUFFERED:
result = new ImageClientBuffered(aForwarder, aFlags, CompositableType::IMAGE);
break;
case BUFFER_BRIDGE:
case CompositableType::BUFFER_BRIDGE:
result = new ImageClientBridge(aForwarder, aFlags);
break;
case BUFFER_UNKNOWN:
case CompositableType::BUFFER_UNKNOWN:
result = nullptr;
break;
default:
@ -86,7 +86,7 @@ ImageClientBuffered::ImageClientBuffered(CompositableForwarder* aFwd,
TextureInfo ImageClientSingle::GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
void
@ -164,7 +164,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bool bufferCreated = false;
if (!mFrontBuffer) {
mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TEXTURE_FLAGS_DEFAULT);
mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TextureFlags::DEFAULT);
gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
if (!mFrontBuffer->AsTextureClientYCbCr()->AllocateForYCbCr(ySize, cbCrSize, data->mStereoMode)) {
@ -174,7 +174,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mFrontBuffer = nullptr;
return false;
}
@ -242,7 +242,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mFrontBuffer = nullptr;
return false;
}
@ -335,7 +335,7 @@ ImageClient::UpdatePictureRect(nsIntRect aRect)
ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
TextureFlags aFlags)
: ImageClient(aFwd, aFlags, BUFFER_BRIDGE)
: ImageClient(aFwd, aFlags, CompositableType::BUFFER_BRIDGE)
, mAsyncContainerID(0)
, mLayer(nullptr)
{

View File

@ -72,10 +72,10 @@ SimpleTextureClientPool::GetTextureClient(bool aAutoRecycle)
// No unused clients in the pool, create one
if (gfxPrefs::ForceShmemTiles()) {
textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD | TEXTURE_RECYCLE, gfx::BackendType::NONE);
mFormat, TextureFlags::IMMEDIATE_UPLOAD | TextureFlags::RECYCLE, gfx::BackendType::NONE);
} else {
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE, gfx::BackendType::NONE, mSize);
mFormat, TextureFlags::DEFAULT | TextureFlags::RECYCLE, gfx::BackendType::NONE, mSize);
}
if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
NS_WARNING("TextureClient::AllocateForSurface failed!");

View File

@ -90,7 +90,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
return SimpleTiledLayerTile();
}
if (!textureClient->Lock(OPEN_READ_WRITE)) {
if (!textureClient->Lock(OpenMode::OPEN_READ_WRITE)) {
NS_WARNING("TextureClient lock failed");
return SimpleTiledLayerTile();
}

View File

@ -144,7 +144,7 @@ public:
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(BUFFER_SIMPLE_TILED);
return TextureInfo(CompositableType::BUFFER_SIMPLE_TILED);
}
void UseTiledLayerBuffer();

View File

@ -25,6 +25,7 @@
#include "ImageContainer.h" // for PlanarYCbCrImage, etc
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/TextureClientOGL.h"
#include "mozilla/layers/PTextureChild.h"
#ifdef XP_WIN
#include "mozilla/layers/TextureD3D9.h"
@ -289,7 +290,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
aSizeHint.width <= maxTextureSize &&
aSizeHint.height <= maxTextureSize &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
result = new TextureClientD3D11(aFormat, aTextureFlags);
}
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
@ -297,7 +298,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
aAllocator->IsSameProcess() &&
aSizeHint.width <= maxTextureSize &&
aSizeHint.height <= maxTextureSize &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
} else {
@ -314,14 +315,14 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
if (parentBackend == LayersBackend::LAYERS_BASIC &&
aMoz2DBackend == gfx::BackendType::CAIRO &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK))
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK))
{
result = new TextureClientX11(aFormat, aTextureFlags);
}
#ifdef GL_PROVIDER_GLX
if (parentBackend == LayersBackend::LAYERS_OPENGL &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK) &&
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK) &&
aFormat != SurfaceFormat::A8 &&
gl::sGLXLibrary.UseTextureFromPixmap())
{
@ -458,7 +459,7 @@ TextureClient::~TextureClient()
void TextureClient::ForceRemove()
{
if (mValid && mActor) {
if (GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mActor->SetTextureData(DropTextureData());
if (mActor->IPCOpen()) {
mActor->SendRemoveTextureSync();
@ -646,7 +647,7 @@ BufferTextureClient::BufferTextureClient(ISurfaceAllocator* aAllocator,
, mAllocator(aAllocator)
, mFormat(aFormat)
, mBackend(aMoz2DBackend)
, mOpenMode(0)
, mOpenMode(OpenMode::OPEN_NONE)
, mUsingFallbackDrawTarget(false)
, mLocked(false)
{}
@ -713,7 +714,7 @@ BufferTextureClient::GetAsDrawTarget()
}
mUsingFallbackDrawTarget = true;
if (mOpenMode & OPEN_READ) {
if (mOpenMode & OpenMode::OPEN_READ) {
RefPtr<DataSourceSurface> surface = serializer.GetAsSurface();
IntRect rect(0, 0, surface->GetSize().width, surface->GetSize().height);
mDrawTarget->CopySurface(surface, rect, IntPoint(0,0));
@ -747,7 +748,7 @@ BufferTextureClient::Unlock()
MOZ_ASSERT(mDrawTarget->refCount() == 1);
mDrawTarget->Flush();
if (mUsingFallbackDrawTarget && (mOpenMode & OPEN_WRITE)) {
if (mUsingFallbackDrawTarget && (mOpenMode & OpenMode::OPEN_WRITE)) {
// When we are using a fallback DrawTarget, it means we could not create
// a DrawTarget wrapping the TextureClient's shared memory. In this scenario
// we need to put the content of the fallback draw target back into our shared

View File

@ -22,7 +22,6 @@
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags, etc
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/PTextureChild.h" // for PTextureChild
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
@ -130,7 +129,7 @@ class TextureClient
: public AtomicRefCountedWithFinalize<TextureClient>
{
public:
TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureClient(TextureFlags aFlags = TextureFlags::DEFAULT);
virtual ~TextureClient();
static TemporaryRef<BufferTextureClient>
@ -175,7 +174,7 @@ public:
*
* This is typically used as follows:
*
* if (!texture->Lock(OPEN_READ_WRITE)) {
* if (!texture->Lock(OpenMode::OPEN_READ_WRITE)) {
* return false;
* }
* {
@ -262,7 +261,7 @@ public:
TextureFlags GetFlags() const { return mFlags; }
/**
* valid only for TEXTURE_RECYCLE TextureClient.
* valid only for TextureFlags::RECYCLE TextureClient.
* When called this texture client will grab a strong reference and release
* it once the compositor notifies that it is done with the texture.
* NOTE: In this stage the texture client can no longer be used by the
@ -275,9 +274,9 @@ public:
* modified, it can only be read. It is safe to not Lock/Unlock immutable
* textures.
*/
bool IsImmutable() const { return mFlags & TEXTURE_IMMUTABLE; }
bool IsImmutable() const { return !!(mFlags & TextureFlags::IMMUTABLE); }
void MarkImmutable() { AddFlags(TEXTURE_IMMUTABLE); }
void MarkImmutable() { AddFlags(TextureFlags::IMMUTABLE); }
bool IsSharedWithCompositor() const { return mShared; }
@ -307,7 +306,7 @@ public:
/**
* Triggers the destruction of the shared data and the corresponding TextureHost.
*
* If the texture flags contain TEXTURE_DEALLOCATE_CLIENT, the destruction
* If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
* will be synchronously coordinated with the compositor side, otherwise it
* will be done asynchronously.
*/

View File

@ -57,10 +57,10 @@ TextureClientPool::GetTextureClient()
if (gfxPrefs::ForceShmemTiles()) {
// gfx::BackendType::NONE means use the content backend
textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
} else {
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
}
textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);

View File

@ -443,13 +443,13 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
return;
}
if (!mFrontBuffer->Lock(OPEN_READ)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_READ)) {
NS_WARNING("Failed to lock the tile's front buffer");
return;
}
TextureClientAutoUnlock autoFront(mFrontBuffer);
if (!mBackBuffer->Lock(OPEN_WRITE)) {
if (!mBackBuffer->Lock(OpenMode::OPEN_WRITE)) {
NS_WARNING("Failed to lock the tile's back buffer");
return;
}
@ -749,7 +749,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
mManager->GetTexturePool(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType())),
&createdTextureClient, !usingSinglePaintBuffer);
if (!backBuffer->Lock(OPEN_READ_WRITE)) {
if (!backBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
NS_WARNING("Failed to lock tile TextureClient for updating.");
aTile.DiscardFrontBuffer();
return aTile;

View File

@ -483,7 +483,7 @@ public:
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(BUFFER_TILED);
return TextureInfo(CompositableType::BUFFER_TILED);
}
virtual void ClearCachedResources() MOZ_OVERRIDE;

View File

@ -44,9 +44,9 @@ bool
CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_IMAGE_SINGLE:
case BUFFER_IMAGE_BUFFERED:
case COMPOSITABLE_IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
case CompositableType::BUFFER_IMAGE_BUFFERED:
case CompositableType::IMAGE:
mImageHost = aHost;
return true;
default:

View File

@ -11,7 +11,7 @@
#include "mozilla/gfx/Rect.h" // for Rect
#include "mozilla/gfx/Types.h" // for Color
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_COLOR
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsPoint.h" // for nsIntPoint
@ -43,7 +43,7 @@ ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
const gfx::Matrix4x4& transform = GetEffectiveTransform();
mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR,
rect, clipRect,
transform);
}

View File

@ -16,6 +16,7 @@
#include "nsDebug.h" // for NS_WARNING
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "gfxPlatform.h" // for gfxPlatform
#include "mozilla/layers/PCompositableParent.h"
namespace mozilla {
namespace layers {
@ -158,7 +159,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
source->GetSize(),
aTransform);
effect->mIs3D = aIs3D;
aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
return true;
}
@ -179,23 +180,23 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
{
RefPtr<CompositableHost> result;
switch (aTextureInfo.mCompositableType) {
case BUFFER_BRIDGE:
case CompositableType::BUFFER_BRIDGE:
NS_ERROR("Cannot create an image bridge compositable this way");
break;
case BUFFER_CONTENT_INC:
case CompositableType::BUFFER_CONTENT_INC:
result = new ContentHostIncremental(aTextureInfo);
break;
case BUFFER_TILED:
case BUFFER_SIMPLE_TILED:
case CompositableType::BUFFER_TILED:
case CompositableType::BUFFER_SIMPLE_TILED:
result = new TiledContentHost(aTextureInfo);
break;
case COMPOSITABLE_IMAGE:
case CompositableType::IMAGE:
result = new ImageHost(aTextureInfo);
break;
case COMPOSITABLE_CONTENT_SINGLE:
case CompositableType::CONTENT_SINGLE:
result = new ContentHostSingleBuffered(aTextureInfo);
break;
case COMPOSITABLE_CONTENT_DOUBLE:
case CompositableType::CONTENT_DOUBLE:
result = new ContentHostDoubleBuffered(aTextureInfo);
break;
default:
@ -203,7 +204,7 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
}
// We know that Tiled buffers don't use the compositable backend-specific
// data, so don't bother creating it.
if (result && aTextureInfo.mCompositableType != BUFFER_TILED) {
if (result && aTextureInfo.mCompositableType != CompositableType::BUFFER_TILED) {
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
result->SetCompositableBackendSpecificData(data);
}

View File

@ -18,7 +18,6 @@
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "mozilla/layers/PCompositableParent.h"
#include "mozilla/layers/TextureHost.h" // for TextureHost
#include "mozilla/mozalloc.h" // for operator delete
#include "nsCOMPtr.h" // for already_AddRefed
@ -52,6 +51,7 @@ class ISurfaceAllocator;
class ThebesBufferData;
class TiledLayerComposer;
class CompositableParentManager;
class PCompositableParent;
struct EffectChain;
/**

View File

@ -18,7 +18,7 @@
#include "mozilla/gfx/Point.h" // for Point, IntPoint
#include "mozilla/gfx/Rect.h" // for IntRect, Rect
#include "mozilla/layers/Compositor.h" // for Compositor, etc
#include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_CONTAINER
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::CONTAINER
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget
#include "mozilla/mozalloc.h" // for operator delete, etc
@ -413,7 +413,7 @@ ContainerRender(ContainerT* aContainer,
LayerRect layerBounds = ParentLayerRect(frame.mCompositionBounds) * ParentLayerToLayerScale(1.0);
gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
aManager->GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTAINER,
aManager->GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTAINER,
rect, clipRect,
aContainer->GetEffectiveTransform());
}

View File

@ -129,29 +129,29 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
regionRects.Or(regionRects, regionRect);
}
TileIterator* tileIter = source->AsTileIterator();
TileIterator* iterOnWhite = nullptr;
if (tileIter) {
tileIter->BeginTileIteration();
BigImageIterator* bigImgIter = source->AsBigImageIterator();
BigImageIterator* iterOnWhite = nullptr;
if (bigImgIter) {
bigImgIter->BeginBigImageIteration();
}
if (sourceOnWhite) {
iterOnWhite = sourceOnWhite->AsTileIterator();
MOZ_ASSERT(!tileIter || tileIter->GetTileCount() == iterOnWhite->GetTileCount(),
iterOnWhite = sourceOnWhite->AsBigImageIterator();
MOZ_ASSERT(!bigImgIter || bigImgIter->GetTileCount() == iterOnWhite->GetTileCount(),
"Tile count mismatch on component alpha texture");
if (iterOnWhite) {
iterOnWhite->BeginTileIteration();
iterOnWhite->BeginBigImageIteration();
}
}
bool usingTiles = (tileIter && tileIter->GetTileCount() > 1);
bool usingTiles = (bigImgIter && bigImgIter->GetTileCount() > 1);
do {
if (iterOnWhite) {
MOZ_ASSERT(iterOnWhite->GetTileRect() == tileIter->GetTileRect(),
MOZ_ASSERT(iterOnWhite->GetTileRect() == bigImgIter->GetTileRect(),
"component alpha textures should be the same size.");
}
nsIntRect texRect = tileIter ? tileIter->GetTileRect()
nsIntRect texRect = bigImgIter ? bigImgIter->GetTileRect()
: nsIntRect(0, 0,
texSize.width,
texSize.height);
@ -198,8 +198,10 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
Float(tileRegionRect.height) / texRect.height);
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
if (usingTiles) {
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
if (iterOnWhite) {
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
}
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
aTransform, mFlashCounter);
}
@ -210,17 +212,19 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
if (iterOnWhite) {
iterOnWhite->NextTile();
}
} while (usingTiles && tileIter->NextTile());
} while (usingTiles && bigImgIter->NextTile());
if (tileIter) {
tileIter->EndTileIteration();
if (bigImgIter) {
bigImgIter->EndBigImageIteration();
}
if (iterOnWhite) {
iterOnWhite->EndTileIteration();
iterOnWhite->EndBigImageIteration();
}
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT;
if (iterOnWhite) {
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
}
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect,
aTransform, mFlashCounter);
}
@ -488,7 +492,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
temp->AsSourceOGL()->AsTextureImageTextureSource();
RefPtr<TextureImageTextureSourceOGL> newSourceOnWhite;
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
temp =
compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
MOZ_ASSERT(temp->AsSourceOGL() &&
@ -496,7 +500,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
newSourceOnWhite = temp->AsSourceOGL()->AsTextureImageTextureSource();
}
if (mTextureInfo.mDeprecatedTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
if (mTextureInfo.mDeprecatedTextureHostFlags & DeprecatedTextureHostFlags::COPY_PREVIOUS) {
nsIntRect bufferRect = aHost->mBufferRect;
nsIntPoint bufferRotation = aHost->mBufferRotation;
nsIntRect overlap;
@ -646,7 +650,7 @@ ContentHostIncremental::TextureUpdateRequest::Execute(ContentHostIncremental* aH
RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(mDescriptor);
if (mTextureId == TextureFront) {
if (mTextureId == TextureIdentifier::Front) {
aHost->mSource->Update(surf, &mUpdated, &offset);
} else {
aHost->mSourceOnWhite->Update(surf, &mUpdated, &offset);
@ -685,7 +689,7 @@ ContentHostTexture::GetRenderState()
LayerRenderState result = mTextureHost->GetRenderState();
if (mBufferRotation != nsIntPoint()) {
result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
}
result.SetOffset(GetOriginOffset());
return result;

View File

@ -209,7 +209,7 @@ public:
virtual ~ContentHostDoubleBuffered() {}
virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_DOUBLE; }
virtual CompositableType GetType() { return CompositableType::CONTENT_DOUBLE; }
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
@ -232,7 +232,7 @@ public:
{}
virtual ~ContentHostSingleBuffered() {}
virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_SINGLE; }
virtual CompositableType GetType() { return CompositableType::CONTENT_SINGLE; }
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
@ -256,7 +256,7 @@ public:
ContentHostIncremental(const TextureInfo& aTextureInfo);
~ContentHostIncremental();
virtual CompositableType GetType() { return BUFFER_CONTENT_INC; }
virtual CompositableType GetType() { return CompositableType::BUFFER_CONTENT_INC; }
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }

View File

@ -109,9 +109,9 @@ ImageHost::Composite(EffectChain& aEffectChain,
//XXX: We might have multiple texture sources here (e.g. 3 YCbCr textures), and we're
// only iterating over the tiles of the first one. Are we assuming that the tiling
// will be identical? Can we ensure that somehow?
TileIterator* it = source->AsTileIterator();
BigImageIterator* it = source->AsBigImageIterator();
if (it) {
it->BeginTileIteration();
it->BeginBigImageIteration();
do {
nsIntRect tileRect = it->GetTileRect();
gfx::Rect rect(tileRect.x, tileRect.y, tileRect.width, tileRect.height);
@ -126,12 +126,12 @@ ImageHost::Composite(EffectChain& aEffectChain,
}
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
aOpacity, aTransform);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE|DIAGNOSTIC_BIGIMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE | DiagnosticFlags::BIGIMAGE,
rect, aClipRect, aTransform, mFlashCounter);
} while (it->NextTile());
it->EndTileIteration();
it->EndBigImageIteration();
// layer border
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
gfxPictureRect, aClipRect,
aTransform, mFlashCounter);
} else {
@ -148,14 +148,14 @@ ImageHost::Composite(EffectChain& aEffectChain,
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
}
if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
if (mFrontBuffer->GetFlags() & TextureFlags::NEEDS_Y_FLIP) {
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
effect->mTextureCoords.height = -effect->mTextureCoords.height;
}
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
aOpacity, aTransform);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
rect, aClipRect,
aTransform, mFlashCounter);
}

View File

@ -51,9 +51,9 @@ bool
ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_IMAGE_SINGLE:
case BUFFER_IMAGE_BUFFERED:
case COMPOSITABLE_IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
case CompositableType::BUFFER_IMAGE_BUFFERED:
case CompositableType::IMAGE:
mImageHost = aHost;
return true;
default:

View File

@ -233,7 +233,7 @@ TextureHost::~TextureHost()
void TextureHost::Finalize()
{
if (!(GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
DeallocateSharedData();
DeallocateDeviceData();
}
@ -292,7 +292,7 @@ BufferTextureHost::Updated(const nsIntRegion* aRegion)
} else {
mPartialUpdate = false;
}
if (GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
NS_WARN_IF_FALSE(result, "Failed to upload a texture");
}
@ -355,7 +355,7 @@ BufferTextureHost::GetFormat() const
// instead (see BufferTextureHost::Upload)
if (mFormat == gfx::SurfaceFormat::YUV &&
mCompositor &&
!mCompositor->SupportsEffect(EFFECT_YCBCR)) {
!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
return gfx::SurfaceFormat::R8G8B8X8;
}
return mFormat;
@ -397,7 +397,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
MOZ_ASSERT(yuvDeserializer.IsValid());
if (!mCompositor->SupportsEffect(EFFECT_YCBCR)) {
if (!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
RefPtr<gfx::DataSourceSurface> surf = yuvDeserializer.ToDataSourceSurface();
if (!mFirstSource) {
mFirstSource = mCompositor->CreateDataTextureSource(mFlags);
@ -411,9 +411,9 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
RefPtr<DataTextureSource> srcV;
if (!mFirstSource) {
// We don't support BigImages for YCbCr compositing.
srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
srcU = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
srcV = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
mFirstSource = srcY;
srcY->SetNextSibling(srcU);
srcU->SetNextSibling(srcV);
@ -569,7 +569,7 @@ MemoryTextureHost::MemoryTextureHost(uint8_t* aBuffer,
MemoryTextureHost::~MemoryTextureHost()
{
DeallocateDeviceData();
NS_ASSERTION(!mBuffer || (mFlags & TEXTURE_DEALLOCATE_CLIENT),
NS_ASSERTION(!mBuffer || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
"Leaking our buffer");
MOZ_COUNT_DTOR(MemoryTextureHost);
}
@ -644,7 +644,7 @@ TextureParent::CompositorRecycle()
// Don't forget to prepare for the next reycle
// if TextureClient request it.
if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
mWaitForClientRecycle = mTextureHost;
}
}
@ -671,7 +671,7 @@ TextureParent::Init(const SurfaceDescriptor& aSharedData,
aFlags);
if (mTextureHost) {
mTextureHost->mActor = this;
if (aFlags & TEXTURE_RECYCLE) {
if (aFlags & TextureFlags::RECYCLE) {
mWaitForClientRecycle = mTextureHost;
RECYCLE_LOG("Setup recycling for tile %p\n", this);
}
@ -711,11 +711,11 @@ TextureParent::ActorDestroy(ActorDestroyReason why)
NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
}
if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
RECYCLE_LOG("clear recycling for tile %p\n", this);
mTextureHost->ClearRecycleCallback();
}
if (mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTextureHost->ForgetSharedData();
}

View File

@ -60,11 +60,11 @@ class TextureParent;
* device texture, which forces us to split it in smaller parts.
* Tiled Compositable is a different thing.
*/
class TileIterator
class BigImageIterator
{
public:
virtual void BeginTileIteration() = 0;
virtual void EndTileIteration() {};
virtual void BeginBigImageIteration() = 0;
virtual void EndBigImageIteration() {};
virtual nsIntRect GetTileRect() = 0;
virtual size_t GetTileCount() = 0;
virtual bool NextTile() = 0;
@ -123,7 +123,7 @@ public:
* Overload this if the TextureSource supports big textures that don't fit in
* one device texture and must be tiled internally.
*/
virtual TileIterator* AsTileIterator() { return nullptr; }
virtual BigImageIterator* AsBigImageIterator() { return nullptr; }
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);

View File

@ -54,10 +54,10 @@ bool
ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_CONTENT_INC:
case BUFFER_TILED:
case COMPOSITABLE_CONTENT_SINGLE:
case COMPOSITABLE_CONTENT_DOUBLE:
case CompositableType::BUFFER_CONTENT_INC:
case CompositableType::BUFFER_TILED:
case CompositableType::CONTENT_SINGLE:
case CompositableType::CONTENT_DOUBLE:
mBuffer = static_cast<ContentHost*>(aHost);
return true;
default:

View File

@ -124,7 +124,7 @@ TiledLayerBufferComposite::Upload()
if(!IsValid()) {
return;
}
// The TextureClients were created with the TEXTURE_IMMEDIATE_UPLOAD flag,
// The TextureClients were created with the TextureFlags::IMMEDIATE_UPLOAD flag,
// so calling Update on all the texture hosts will perform the texture upload.
Update(mValidRegion, mPaintedRegion);
ClearPaintedRegion();
@ -145,7 +145,7 @@ TiledLayerBufferComposite::ValidateTile(TileHost aTile,
long start = PR_IntervalNow();
#endif
MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD);
MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD);
// We possibly upload the entire texture contents here. This is a purposeful
// decision, as sub-image upload can often be slow and/or unreliable, but
// we may want to reevaluate this in the future.
@ -380,7 +380,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
textureRect.height / aTextureBounds.height);
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
}
mCompositor->DrawDiagnostics(DIAGNOSTIC_CONTENT|DIAGNOSTIC_TILE,
mCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | DiagnosticFlags::TILE,
aScreenRegion, aClipRect, aTransform, mFlashCounter);
}
@ -471,7 +471,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
}
gfx::Rect rect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTENT,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT,
rect, aClipRect, aTransform, mFlashCounter);
}

View File

@ -219,7 +219,7 @@ public:
const nsIntRegion* aVisibleRegion = nullptr,
TiledLayerProperties* aLayerProperties = nullptr);
virtual CompositableType GetType() { return BUFFER_TILED; }
virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; }
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }

View File

@ -25,7 +25,7 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
mSurface = surface.get();
// The host always frees the pixmap.
MOZ_ASSERT(!(aFlags & TEXTURE_DEALLOCATE_CLIENT));
MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT));
mSurface->TakePixmap();
}

View File

@ -16,6 +16,8 @@
#include "nsWindowsHelpers.h"
#include "gfxPrefs.h"
#include "mozilla/EnumeratedArray.h"
#ifdef MOZ_METRO
#include <DXGI1_2.h>
#endif
@ -42,14 +44,20 @@ const FLOAT sBlendFactor[] = { 0, 0, 0, 0 };
struct DeviceAttachmentsD3D11
{
typedef EnumeratedArray<MaskType, MaskType::NumMaskTypes, RefPtr<ID3D11VertexShader>>
VertexShaderArray;
typedef EnumeratedArray<MaskType, MaskType::NumMaskTypes, RefPtr<ID3D11PixelShader>>
PixelShaderArray;
RefPtr<ID3D11InputLayout> mInputLayout;
RefPtr<ID3D11Buffer> mVertexBuffer;
RefPtr<ID3D11VertexShader> mVSQuadShader[3];
RefPtr<ID3D11PixelShader> mSolidColorShader[2];
RefPtr<ID3D11PixelShader> mRGBAShader[3];
RefPtr<ID3D11PixelShader> mRGBShader[2];
RefPtr<ID3D11PixelShader> mYCbCrShader[2];
RefPtr<ID3D11PixelShader> mComponentAlphaShader[2];
VertexShaderArray mVSQuadShader;
PixelShaderArray mSolidColorShader;
PixelShaderArray mRGBAShader;
PixelShaderArray mRGBShader;
PixelShaderArray mYCbCrShader;
PixelShaderArray mComponentAlphaShader;
RefPtr<ID3D11Buffer> mPSConstantBuffer;
RefPtr<ID3D11Buffer> mVSConstantBuffer;
RefPtr<ID3D11RasterizerState> mRasterizerState;
@ -478,21 +486,21 @@ void
CompositorD3D11::SetPSForEffect(Effect* aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat)
{
switch (aEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
mContext->PSSetShader(mAttachments->mSolidColorShader[aMaskType], nullptr, 0);
return;
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
mContext->PSSetShader(mAttachments->mRGBAShader[aMaskType], nullptr, 0);
return;
case EFFECT_RGB:
case EffectTypes::RGB:
mContext->PSSetShader((aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
? mAttachments->mRGBAShader[aMaskType]
: mAttachments->mRGBShader[aMaskType], nullptr, 0);
return;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
mContext->PSSetShader(mAttachments->mYCbCrShader[aMaskType], nullptr, 0);
return;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
mContext->PSSetShader(mAttachments->mComponentAlphaShader[aMaskType], nullptr, 0);
return;
default:
@ -521,9 +529,9 @@ CompositorD3D11::ClearRect(const gfx::Rect& aRect)
scissor.bottom = aRect.YMost();
mContext->RSSetScissorRects(1, &scissor);
mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
mContext->VSSetShader(mAttachments->mVSQuadShader[MaskNone], nullptr, 0);
mContext->VSSetShader(mAttachments->mVSQuadShader[MaskType::MaskNone], nullptr, 0);
mContext->PSSetShader(mAttachments->mSolidColorShader[MaskNone], nullptr, 0);
mContext->PSSetShader(mAttachments->mSolidColorShader[MaskType::MaskNone], nullptr, 0);
mPSConstants.layerColor[0] = 0;
mPSConstants.layerColor[1] = 0;
mPSConstants.layerColor[2] = 0;
@ -554,18 +562,18 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
bool restoreBlendMode = false;
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
if (aTransform.Is2D()) {
maskType = Mask2d;
maskType = MaskType::Mask2d;
} else {
MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_RGB);
maskType = Mask3d;
MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EffectTypes::RGB);
maskType = MaskType::Mask3d;
}
EffectMask* maskEffect =
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
TextureSourceD3D11* source = maskEffect->mMaskTexture->AsSourceD3D11();
if (!source) {
@ -598,7 +606,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, SurfaceFormat::UNKNOWN);
Color color =
@ -609,8 +617,8 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
mPSConstants.layerColor[3] = color.a * aOpacity;
}
break;
case EFFECT_RGB:
case EFFECT_RENDER_TARGET:
case EffectTypes::RGB:
case EffectTypes::RENDER_TARGET:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
@ -640,7 +648,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
SetSamplerForFilter(texturedEffect->mFilter);
}
break;
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
@ -680,7 +688,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
mContext->PSSetShaderResources(0, 3, srViews);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
MOZ_ASSERT(mAttachments->mComponentBlendState);
@ -900,7 +908,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadVS,
sizeof(LayerQuadVS),
nullptr,
byRef(mAttachments->mVSQuadShader[MaskNone]));
byRef(mAttachments->mVSQuadShader[MaskType::MaskNone]));
if (FAILED(hr)) {
return false;
}
@ -908,7 +916,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadMaskVS,
sizeof(LayerQuadMaskVS),
nullptr,
byRef(mAttachments->mVSQuadShader[Mask2d]));
byRef(mAttachments->mVSQuadShader[MaskType::Mask2d]));
if (FAILED(hr)) {
return false;
}
@ -916,16 +924,16 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadMask3DVS,
sizeof(LayerQuadMask3DVS),
nullptr,
byRef(mAttachments->mVSQuadShader[Mask3d]));
byRef(mAttachments->mVSQuadShader[MaskType::Mask3d]));
if (FAILED(hr)) {
return false;
}
#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskNone])); \
#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskType::MaskNone])); \
if (FAILED(hr)) { \
return false; \
} \
hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[Mask2d])); \
hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[MaskType::Mask2d])); \
if (FAILED(hr)) { \
return false; \
}
@ -943,7 +951,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreatePixelShader(RGBAShaderMask3D,
sizeof(RGBAShaderMask3D),
nullptr,
byRef(mAttachments->mRGBAShader[Mask3d]));
byRef(mAttachments->mRGBAShader[MaskType::Mask3d]));
if (FAILED(hr)) {
return false;
}

View File

@ -50,7 +50,7 @@ public:
GetTextureFactoryIdentifier() MOZ_OVERRIDE;
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) MOZ_OVERRIDE;
virtual int32_t GetMaxTextureSize() const MOZ_FINAL;

View File

@ -77,7 +77,7 @@ DataTextureSourceD3D11::DataTextureSourceD3D11(SurfaceFormat aFormat,
ID3D11Texture2D* aTexture)
: mCompositor(aCompositor)
, mFormat(aFormat)
, mFlags(0)
, mFlags(TextureFlags::NO_FLAGS)
, mCurrentTile(0)
, mIsTiled(false)
, mIterating(false)
@ -361,7 +361,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface,
int32_t maxSize = mCompositor->GetMaxTextureSize();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = aSurface->GetData();
initData.SysMemPitch = aSurface->Stride();

View File

@ -96,7 +96,7 @@ protected:
*/
class DataTextureSourceD3D11 : public DataTextureSource
, public TextureSourceD3D11
, public TileIterator
, public BigImageIterator
{
public:
DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor,
@ -130,9 +130,9 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
// TileIterator
// BigImageIterator
virtual TileIterator* AsTileIterator() MOZ_OVERRIDE { return mIsTiled ? this : nullptr; }
virtual BigImageIterator* AsBigImageIterator() MOZ_OVERRIDE { return mIsTiled ? this : nullptr; }
virtual size_t GetTileCount() MOZ_OVERRIDE { return mTileTextures.size(); }
@ -140,9 +140,9 @@ public:
virtual nsIntRect GetTileRect() MOZ_OVERRIDE;
virtual void EndTileIteration() MOZ_OVERRIDE { mIterating = false; }
virtual void EndBigImageIteration() MOZ_OVERRIDE { mIterating = false; }
virtual void BeginTileIteration() MOZ_OVERRIDE
virtual void BeginBigImageIteration() MOZ_OVERRIDE
{
mIterating = true;
mCurrentTile = 0;

View File

@ -195,15 +195,15 @@ static DeviceManagerD3D9::ShaderMode
ShaderModeForEffectType(EffectTypes aEffectType, gfx::SurfaceFormat aFormat)
{
switch (aEffectType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
return DeviceManagerD3D9::SOLIDCOLORLAYER;
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
return DeviceManagerD3D9::RGBALAYER;
case EFFECT_RGB:
case EffectTypes::RGB:
if (aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
return DeviceManagerD3D9::RGBALAYER;
return DeviceManagerD3D9::RGBLAYER;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
return DeviceManagerD3D9::YCBCRLAYER;
}
@ -253,7 +253,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
1);
bool target = false;
if (aEffectChain.mPrimaryEffect->mType != EFFECT_SOLID_COLOR) {
if (aEffectChain.mPrimaryEffect->mType != EffectTypes::SOLID_COLOR) {
float opacity[4];
/*
* We always upload a 4 component float, but the shader will use only the
@ -265,13 +265,13 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
bool isPremultiplied = true;
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
if (aTransform.Is2D()) {
maskType = Mask2d;
maskType = MaskType::Mask2d;
} else {
maskType = Mask3d;
maskType = MaskType::Mask3d;
}
}
@ -284,7 +284,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
uint32_t maskTexture = 0;
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
{
// output color is premultiplied, so we need to adjust all channels.
Color layerColor =
@ -301,8 +301,8 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER, maskType);
}
break;
case EFFECT_RENDER_TARGET:
case EFFECT_RGB:
case EffectTypes::RENDER_TARGET:
case EffectTypes::RGB:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
@ -329,7 +329,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
isPremultiplied = texturedEffect->mPremultiplied;
}
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
{
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
@ -415,7 +415,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
maskTexture = mDeviceManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER, maskType);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
EffectComponentAlpha* effectComponentAlpha =
@ -476,7 +476,7 @@ void
CompositorD3D9::SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture)
{
EffectMask *maskEffect =
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
if (!maskEffect) {
return;
}

View File

@ -123,7 +123,7 @@ public:
}
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
private:
// ensure mSize is up to date with respect to mWidget
void EnsureSize();

View File

@ -569,7 +569,7 @@ LoadMaskTexture(Layer* aMask, IDirect3DDevice9* aDevice,
uint32_t
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
{
if (aMaskType == MaskNone) {
if (aMaskType == MaskType::MaskNone) {
switch (aMode) {
case RGBLAYER:
mDevice->SetVertexShader(mLayerVS);
@ -607,7 +607,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
maskTexRegister = 1;
break;
case RGBALAYER:
if (aMaskType == Mask2d) {
if (aMaskType == MaskType::Mask2d) {
mDevice->SetVertexShader(mLayerVSMask);
mDevice->SetPixelShader(mRGBAPSMask);
} else {
@ -643,9 +643,9 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
void
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
{
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aMask) {
maskType = aIs2D ? Mask2d : Mask3d;
maskType = aIs2D ? MaskType::Mask2d : MaskType::Mask3d;
}
uint32_t maskTexRegister = SetShaderMode(aMode, maskType);
if (aMask) {
@ -654,7 +654,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
if (!LoadMaskTexture(aMask, mDevice, maskTexRegister)) {
// if we can't load the mask, fall back to unmasked rendering
NS_WARNING("Could not load texture for mask layer.");
SetShaderMode(aMode, MaskNone);
SetShaderMode(aMode, MaskType::MaskNone);
}
}
}

View File

@ -412,7 +412,7 @@ DataTextureSourceD3D9::Update(gfx::DataSourceSurface* aSurface,
int32_t maxSize = mCompositor->GetMaxTextureSize();
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
mTexture = DataToTexture(deviceManager,
aSurface->GetData(), aSurface->Stride(),
IntSize(mSize), format, bpp);
@ -487,7 +487,7 @@ DataTextureSourceD3D9::Update(gfxWindowsSurface* aSurface)
int32_t maxSize = mCompositor->GetMaxTextureSize();
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
mTexture = SurfaceToTexture(deviceManager, aSurface, mSize, format);
if (!mTexture) {

View File

@ -101,19 +101,19 @@ protected:
*/
class DataTextureSourceD3D9 : public DataTextureSource
, public TextureSourceD3D9
, public TileIterator
, public BigImageIterator
{
public:
DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
CompositorD3D9* aCompositor,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
TextureFlags aFlags = TextureFlags::DEFAULT,
StereoMode aStereoMode = StereoMode::MONO);
DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
CompositorD3D9* aCompositor,
IDirect3DTexture9* aTexture,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
virtual ~DataTextureSourceD3D9();
@ -139,9 +139,9 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
// TileIterator
// BigImageIterator
virtual TileIterator* AsTileIterator() MOZ_OVERRIDE { return mIsTiled ? this : nullptr; }
virtual BigImageIterator* AsBigImageIterator() MOZ_OVERRIDE { return mIsTiled ? this : nullptr; }
virtual size_t GetTileCount() MOZ_OVERRIDE { return mTileTextures.size(); }
@ -149,9 +149,9 @@ public:
virtual nsIntRect GetTileRect() MOZ_OVERRIDE;
virtual void EndTileIteration() MOZ_OVERRIDE { mIterating = false; }
virtual void EndBigImageIteration() MOZ_OVERRIDE { mIterating = false; }
virtual void BeginTileIteration() MOZ_OVERRIDE
virtual void BeginBigImageIteration() MOZ_OVERRIDE
{
mIterating = true;
mCurrentTile = 0;

View File

@ -679,7 +679,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget)
// 0 -> Full-tilt composite
if (gfxPrefs::LayersCompositionFrameRate() == 0
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DIAGNOSTIC_FLASH_BORDERS) {
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DiagnosticTypes::FLASH_BORDERS) {
// Special full-tilt composite mode for performance testing
ScheduleComposition();
}

View File

@ -173,7 +173,6 @@ static void StopImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread.");
if (sImageBridgeChildSingleton) {
sImageBridgeChildSingleton->SendStop();
}
*aDone = true;
@ -571,15 +570,14 @@ bool ImageBridgeChild::StartUpOnThread(Thread* aThread)
void ImageBridgeChild::DestroyBridge()
{
if (!IsCreated()) {
return;
}
NS_ABORT_IF_FALSE(!InImageBridgeChildThread(),
"This method must not be called in this thread.");
// ...because we are about to dispatch synchronous messages to the
// ImageBridgeChild thread.
if (!IsCreated()) {
return;
}
ReentrantMonitor barrier("ImageBridgeDestroyTask lock");
ReentrantMonitorAutoEnter autoMon(barrier);
@ -601,7 +599,8 @@ void ImageBridgeChild::DestroyBridge()
bool InImageBridgeChildThread()
{
return sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
return ImageBridgeChild::IsCreated() &&
sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
}
MessageLoop * ImageBridgeChild::GetMessageLoop() const
@ -648,7 +647,7 @@ TemporaryRef<ImageClient>
ImageBridgeChild::CreateImageClientNow(CompositableType aType)
{
RefPtr<ImageClient> client
= ImageClient::CreateImageClient(aType, this, 0);
= ImageClient::CreateImageClient(aType, this, TextureFlags::NO_FLAGS);
MOZ_ASSERT(client, "failed to create ImageClient");
if (client) {
client->Connect();
@ -918,7 +917,7 @@ void
ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture)
{
if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
} else {

View File

@ -41,6 +41,7 @@ using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
using mozilla::layers::TextureIdentifier from "mozilla/layers/CompositorTypes.h";
namespace mozilla {
namespace layers {
@ -311,7 +312,7 @@ struct OpPaintTextureRegion {
struct OpPaintTextureIncremental {
PCompositable compositable;
uint32_t textureId;
TextureIdentifier textureId;
SurfaceDescriptor image;
nsIntRegion updatedRegion;
nsIntRect bufferRect;
@ -409,7 +410,7 @@ struct OpContentBufferSwap {
struct OpTextureSwap {
PCompositable compositable;
uint32_t textureId;
TextureIdentifier textureId;
SurfaceDescriptor image;
};

View File

@ -13,6 +13,7 @@ include ProtocolTypes;
include "mozilla/GfxMessageUtils.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
namespace mozilla {
namespace layers {
@ -51,7 +52,7 @@ parent:
sync Stop();
sync PCompositable(TextureInfo aInfo) returns (uint64_t id);
async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags);
async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
};

View File

@ -18,6 +18,7 @@ include "mozilla/GfxMessageUtils.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
/**
* The layers protocol is spoken between thread contexts that manage
@ -74,7 +75,7 @@ parent:
returns (MaybeMagicGrallocBufferHandle handle);
async PLayer();
async PCompositable(TextureInfo aTextureInfo);
async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags);
async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
// The isFirstPaint flag can be used to indicate that this is the first update
// for a particular document.

View File

@ -166,7 +166,7 @@ CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIden
}
ShadowLayerForwarder::ShadowLayerForwarder()
: mDiagnosticTypes(DIAGNOSTIC_NONE)
: mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
, mIsFirstPaint(false)
, mWindowOverlayChanged(false)
{
@ -367,7 +367,7 @@ ShadowLayerForwarder::UpdatedTexture(CompositableClient* aCompositable,
MOZ_ASSERT(aTexture->GetIPDLActor());
MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
: MaybeRegion(null_t());
if (aTexture->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor(),
region));
@ -417,7 +417,7 @@ ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aComposi
MOZ_ASSERT(aTexture->GetIPDLActor());
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->MarkSyncTransaction();
}
// Hold texture until transaction complete.

View File

@ -91,7 +91,7 @@ SharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData)
}
MOZ_ASSERT(mTextureClient->AsTextureClientYCbCr());
if (!mTextureClient->Lock(OPEN_WRITE_ONLY)) {
if (!mTextureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
MOZ_ASSERT(false, "Failed to lock the texture.");
return;
}

View File

@ -803,13 +803,13 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
ShaderConfigOGL config;
switch(aEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
config.SetRenderColor(true);
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
config.SetYCbCr(true);
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
config.SetComponentAlpha(true);
EffectComponentAlpha* effectComponentAlpha =
@ -819,12 +819,12 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
format == gfx::SurfaceFormat::B8G8R8X8);
break;
}
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
config.SetTextureTarget(mFBOTextureTarget);
break;
default:
{
MOZ_ASSERT(aEffect->mType == EFFECT_RGB);
MOZ_ASSERT(aEffect->mType == EffectTypes::RGB);
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffect);
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
@ -839,8 +839,8 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
break;
}
}
config.SetMask2D(aMask == Mask2d);
config.SetMask3D(aMask == Mask3d);
config.SetMask2D(aMask == MaskType::Mask2d);
config.SetMask3D(aMask == MaskType::Mask3d);
return config;
}
@ -909,8 +909,8 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
EffectMask* effectMask;
TextureSourceOGL* sourceMask = nullptr;
gfx::Matrix4x4 maskQuadTransform;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceOGL();
// NS_ASSERTION(textureMask->IsAlpha(),
@ -932,10 +932,10 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
maskQuadTransform._42 = float(-bounds.y)/bounds.height;
maskType = effectMask->mIs3D
? Mask3d
: Mask2d;
? MaskType::Mask3d
: MaskType::Mask2d;
} else {
maskType = MaskNone;
maskType = MaskType::MaskNone;
}
mPixelsFilled += aRect.width * aRect.height;
@ -943,7 +943,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
// Determine the color if this is a color shader and fold the opacity into
// the color since color shaders don't have an opacity uniform.
Color color;
if (aEffectChain.mPrimaryEffect->mType == EFFECT_SOLID_COLOR) {
if (aEffectChain.mPrimaryEffect->mType == EffectTypes::SOLID_COLOR) {
EffectSolidColor* effectSolidColor =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
color = effectSolidColor->mColor;
@ -978,10 +978,10 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
program->SetRenderColor(color);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE0, maskQuadTransform);
}
@ -989,7 +989,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
break;
case EFFECT_RGB: {
case EffectTypes::RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSource *source = texturedEffect->mTexture;
@ -1019,7 +1019,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetTextureUnit(0);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
}
@ -1032,7 +1032,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
}
break;
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
EffectYCbCr* effectYCbCr =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
TextureSource* sourceYCbCr = effectYCbCr->mTexture;
@ -1052,7 +1052,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetYCbCrTextureUnits(Y, Cb, Cr);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program,
@ -1061,7 +1061,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
sourceYCbCr->GetSubSource(Y));
}
break;
case EFFECT_RENDER_TARGET: {
case EffectTypes::RENDER_TARGET: {
EffectRenderTarget* effectRenderTarget =
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<CompositingRenderTargetOGL> surface
@ -1077,7 +1077,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetTextureTransform(Matrix4x4::From2D(transform));
program->SetTextureUnit(0);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
sourceMask->BindTexture(LOCAL_GL_TEXTURE1, gfx::Filter::LINEAR);
program->SetMaskTextureUnit(1);
program->SetMaskLayerTransform(maskQuadTransform);
@ -1094,7 +1094,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
BindAndDrawQuad(program);
}
break;
case EFFECT_COMPONENT_ALPHA: {
case EffectTypes::COMPONENT_ALPHA: {
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
EffectComponentAlpha* effectComponentAlpha =
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
@ -1114,7 +1114,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetWhiteTextureUnit(1);
program->SetTextureTransform(gfx::Matrix4x4());
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
}
// Pass 1.

View File

@ -20,7 +20,7 @@
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
#include "mozilla/gfx/Types.h" // for Float, SurfaceFormat, etc
#include "mozilla/layers/Compositor.h" // for SurfaceInitMode, Compositor, etc
#include "mozilla/layers/CompositorTypes.h" // for MaskType::NumMaskTypes, etc
#include "mozilla/layers/CompositorTypes.h" // for MaskType::MaskType::NumMaskTypes, etc
#include "mozilla/layers/LayersTypes.h"
#include "nsAutoPtr.h" // for nsRefPtr, nsAutoPtr
#include "nsCOMPtr.h" // for already_AddRefed
@ -154,7 +154,9 @@ protected:
nsTArray<GLuint> mUnusedTextures;
};
class CompositorOGL : public Compositor
// If you want to make this class not MOZ_FINAL, first remove calls to virtual
// methods (Destroy) that are made in the destructor.
class CompositorOGL MOZ_FINAL : public Compositor
{
typedef mozilla::gl::GLContext GLContext;
@ -168,7 +170,7 @@ public:
virtual ~CompositorOGL();
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
virtual bool Initialize() MOZ_OVERRIDE;
@ -358,7 +360,7 @@ private:
gfx::Rect *aClipRectOut = nullptr,
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskNone) const;
ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskType::MaskNone) const;
ShaderProgramOGL* GetShaderProgramFor(const ShaderConfigOGL &aConfig);
/**

View File

@ -145,10 +145,10 @@ GrallocTextureClientOGL::Lock(OpenMode aMode)
WaitReleaseFence();
uint32_t usage = 0;
if (aMode & OPEN_READ) {
if (aMode & OpenMode::OPEN_READ) {
usage |= GRALLOC_USAGE_SW_READ_OFTEN;
}
if (aMode & OPEN_WRITE) {
if (aMode & OpenMode::OPEN_WRITE) {
usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
}
int32_t rv = mGraphicBuffer->lock(usage, reinterpret_cast<void**>(&mMappedBuffer));
@ -234,14 +234,14 @@ GrallocTextureClientOGL::AllocateForSurface(gfx::IntSize aSize,
break;
case gfx::SurfaceFormat::B8G8R8A8:
format = android::PIXEL_FORMAT_RGBA_8888;
mFlags |= TEXTURE_RB_SWAPPED;
mFlags |= TextureFlags::RB_SWAPPED;
break;
case gfx::SurfaceFormat::R8G8B8X8:
format = android::PIXEL_FORMAT_RGBX_8888;
break;
case gfx::SurfaceFormat::B8G8R8X8:
format = android::PIXEL_FORMAT_RGBX_8888;
mFlags |= TEXTURE_RB_SWAPPED;
mFlags |= TextureFlags::RB_SWAPPED;
break;
case gfx::SurfaceFormat::R5G6B5:
format = android::PIXEL_FORMAT_RGB_565;

View File

@ -40,11 +40,11 @@ public:
GrallocTextureClientOGL(GrallocBufferActor* aActor,
gfx::IntSize aSize,
gfx::BackendType aMoz2dBackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2dBackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
~GrallocTextureClientOGL();

View File

@ -19,8 +19,9 @@ using namespace android;
static gfx::SurfaceFormat
SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
bool swapRB = false)
TextureFlags aFlags)
{
bool swapRB = bool(aFlags & TextureFlags::RB_SWAPPED);
switch (aFormat) {
case android::PIXEL_FORMAT_BGRA_8888:
return swapRB ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8A8;
@ -290,7 +291,7 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
if (graphicBuffer) {
format =
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
aFlags & TEXTURE_RB_SWAPPED);
aFlags);
}
mTextureSource = new GrallocTextureSourceOGL(nullptr,
graphicBuffer,
@ -369,12 +370,12 @@ LayerRenderState
GrallocTextureHostOGL::GetRenderState()
{
if (IsValid()) {
uint32_t flags = 0;
if (mFlags & TEXTURE_NEEDS_Y_FLIP) {
flags |= LAYER_RENDER_STATE_Y_FLIPPED;
LayerRenderStateFlags flags = LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT;
if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
flags |= LayerRenderStateFlags::Y_FLIPPED;
}
if (mFlags & TEXTURE_RB_SWAPPED) {
flags |= LAYER_RENDER_STATE_FORMAT_RB_SWAP;
if (mFlags & TextureFlags::RB_SWAPPED) {
flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
}
return LayerRenderState(mTextureSource->mGraphicBuffer.get(),
gfx::ThebesIntSize(mSize),

View File

@ -23,7 +23,7 @@ SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
, mInverted(false)
{
// SharedTextureClient is always owned externally.
mFlags |= TEXTURE_DEALLOCATE_CLIENT;
mFlags |= TextureFlags::DEALLOCATE_CLIENT;
}
SharedTextureClientOGL::~SharedTextureClientOGL()
@ -56,7 +56,7 @@ SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
mShareType = aShareType;
mInverted = aInverted;
if (mInverted) {
AddFlags(TEXTURE_NEEDS_Y_FLIP);
AddFlags(TextureFlags::NEEDS_Y_FLIP);
}
}

View File

@ -106,20 +106,20 @@ FlagsToGLFlags(TextureFlags aFlags)
{
uint32_t result = TextureImage::NoFlags;
if (aFlags & TEXTURE_USE_NEAREST_FILTER)
if (aFlags & TextureFlags::USE_NEAREST_FILTER)
result |= TextureImage::UseNearestFilter;
if (aFlags & TEXTURE_NEEDS_Y_FLIP)
if (aFlags & TextureFlags::NEEDS_Y_FLIP)
result |= TextureImage::NeedsYFlip;
if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
if (aFlags & TextureFlags::DISALLOW_BIGIMAGE)
result |= TextureImage::DisallowBigImage;
return static_cast<gl::TextureImage::Flags>(result);
}
GLenum
WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
static GLenum
WrapMode(gl::GLContext *aGl, TextureFlags aFlags)
{
if (aAllowRepeat &&
if ((aFlags & TextureFlags::ALLOW_REPEAT) &&
(aGl->IsExtensionSupported(GLContext::ARB_texture_non_power_of_two) ||
aGl->IsExtensionSupported(GLContext::OES_texture_npot))) {
return LOCAL_GL_REPEAT;
@ -229,10 +229,10 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
if (!mTexImage ||
(mTexImage->GetSize() != size && !aSrcOffset) ||
mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
if (mFlags & TEXTURE_DISALLOW_BIGIMAGE) {
if (mFlags & TextureFlags::DISALLOW_BIGIMAGE) {
mTexImage = CreateBasicTextureImage(mGL, size,
gfx::ContentForFormat(aSurface->GetFormat()),
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags),
FlagsToGLFlags(mFlags),
SurfaceFormatToImageFormat(aSurface->GetFormat()));
} else {
@ -243,7 +243,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
mTexImage = CreateTextureImage(mGL,
size,
gfx::ContentForFormat(aSurface->GetFormat()),
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags),
FlagsToGLFlags(mFlags),
SurfaceFormatToImageFormat(aSurface->GetFormat()));
}
@ -268,7 +268,7 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize,
mTexImage = CreateTextureImage(mGL,
aSize.ToIntSize(),
aContentType,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags),
FlagsToGLFlags(mFlags));
}
mTexImage->Resize(aSize.ToIntSize());

View File

@ -185,18 +185,18 @@ protected:
* A TextureSource backed by a TextureImage.
*
* Depending on the underlying TextureImage, may support texture tiling, so
* make sure to check AsTileIterator() and use the texture accordingly.
* make sure to check AsBigImageIterator() and use the texture accordingly.
*
* This TextureSource can be used without a TextureHost and manage it's own
* GL texture(s).
*/
class TextureImageTextureSourceOGL : public DataTextureSource
, public TextureSourceOGL
, public TileIterator
, public BigImageIterator
{
public:
TextureImageTextureSourceOGL(gl::GLContext* aGL,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT)
TextureFlags aFlags = TextureFlags::DEFAULT)
: mGL(aGL)
, mFlags(aFlags)
, mIterating(false)
@ -242,17 +242,17 @@ public:
return mTexImage->GetWrapMode();
}
// TileIterator
// BigImageIterator
virtual TileIterator* AsTileIterator() MOZ_OVERRIDE { return this; }
virtual BigImageIterator* AsBigImageIterator() MOZ_OVERRIDE { return this; }
virtual void BeginTileIteration() MOZ_OVERRIDE
virtual void BeginBigImageIteration() MOZ_OVERRIDE
{
mTexImage->BeginTileIteration();
mTexImage->BeginBigImageIteration();
mIterating = true;
}
virtual void EndTileIteration() MOZ_OVERRIDE
virtual void EndBigImageIteration() MOZ_OVERRIDE
{
mIterating = false;
}

Some files were not shown because too many files have changed in this diff Show More