Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "RecordedEventImpl.h"
7 :
8 : #include "PathRecording.h"
9 : #include "RecordingTypes.h"
10 : #include "Tools.h"
11 : #include "Filters.h"
12 : #include "Logging.h"
13 : #include "ScaledFontBase.h"
14 : #include "SFNTData.h"
15 :
16 : namespace mozilla {
17 : namespace gfx {
18 :
19 : using namespace std;
20 :
21 : RecordedEvent *
22 0 : RecordedEvent::LoadEventFromStream(std::istream &aStream, EventType aType) {
23 0 : return LoadEvent(aStream, aType);
24 : }
25 :
26 : string
27 0 : RecordedEvent::GetEventName(EventType aType)
28 : {
29 0 : switch (aType) {
30 : case DRAWTARGETCREATION:
31 0 : return "DrawTarget Creation";
32 : case DRAWTARGETDESTRUCTION:
33 0 : return "DrawTarget Destruction";
34 : case FILLRECT:
35 0 : return "FillRect";
36 : case STROKERECT:
37 0 : return "StrokeRect";
38 : case STROKELINE:
39 0 : return "StrokeLine";
40 : case CLEARRECT:
41 0 : return "ClearRect";
42 : case COPYSURFACE:
43 0 : return "CopySurface";
44 : case SETTRANSFORM:
45 0 : return "SetTransform";
46 : case PUSHCLIP:
47 0 : return "PushClip";
48 : case PUSHCLIPRECT:
49 0 : return "PushClipRect";
50 : case POPCLIP:
51 0 : return "PopClip";
52 : case FILL:
53 0 : return "Fill";
54 : case FILLGLYPHS:
55 0 : return "FillGlyphs";
56 : case MASK:
57 0 : return "Mask";
58 : case STROKE:
59 0 : return "Stroke";
60 : case DRAWSURFACE:
61 0 : return "DrawSurface";
62 : case DRAWSURFACEWITHSHADOW:
63 0 : return "DrawSurfaceWithShadow";
64 : case DRAWFILTER:
65 0 : return "DrawFilter";
66 : case PATHCREATION:
67 0 : return "PathCreation";
68 : case PATHDESTRUCTION:
69 0 : return "PathDestruction";
70 : case SOURCESURFACECREATION:
71 0 : return "SourceSurfaceCreation";
72 : case SOURCESURFACEDESTRUCTION:
73 0 : return "SourceSurfaceDestruction";
74 : case FILTERNODECREATION:
75 0 : return "FilterNodeCreation";
76 : case FILTERNODEDESTRUCTION:
77 0 : return "FilterNodeDestruction";
78 : case GRADIENTSTOPSCREATION:
79 0 : return "GradientStopsCreation";
80 : case GRADIENTSTOPSDESTRUCTION:
81 0 : return "GradientStopsDestruction";
82 : case SNAPSHOT:
83 0 : return "Snapshot";
84 : case SCALEDFONTCREATION:
85 0 : return "ScaledFontCreation";
86 : case SCALEDFONTDESTRUCTION:
87 0 : return "ScaledFontDestruction";
88 : case MASKSURFACE:
89 0 : return "MaskSurface";
90 : case FILTERNODESETATTRIBUTE:
91 0 : return "SetAttribute";
92 : case FILTERNODESETINPUT:
93 0 : return "SetInput";
94 : case CREATESIMILARDRAWTARGET:
95 0 : return "CreateSimilarDrawTarget";
96 : case FONTDATA:
97 0 : return "FontData";
98 : case FONTDESC:
99 0 : return "FontDescriptor";
100 : case PUSHLAYER:
101 0 : return "PushLayer";
102 : case POPLAYER:
103 0 : return "PopLayer";
104 : case UNSCALEDFONTCREATION:
105 0 : return "UnscaledFontCreation";
106 : case UNSCALEDFONTDESTRUCTION:
107 0 : return "UnscaledFontDestruction";
108 : default:
109 0 : return "Unknown";
110 : }
111 : }
112 :
113 : already_AddRefed<DrawTarget>
114 0 : Translator::CreateDrawTarget(ReferencePtr aRefPtr, const IntSize &aSize,
115 : SurfaceFormat aFormat)
116 : {
117 : RefPtr<DrawTarget> newDT =
118 0 : GetReferenceDrawTarget()->CreateSimilarDrawTarget(aSize, aFormat);
119 0 : AddDrawTarget(aRefPtr, newDT);
120 0 : return newDT.forget();
121 : }
122 :
123 : }
124 : }
|