~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/fcl-image/src/fphelper.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{%MainUnit fpcanvas.pp}
 
2
{
 
3
    This file is part of the Free Pascal run time library.
 
4
    Copyright (c) 2003 by the Free Pascal development team
 
5
 
 
6
    Implementation of TFPCanvasHelper
 
7
 
 
8
    See the file COPYING.FPC, included in this distribution,
 
9
    for details about the copyright.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 
 
15
 **********************************************************************}
 
16
{ TFPCanvasHelper }
 
17
 
 
18
constructor TFPCanvasHelper.Create;
 
19
begin
 
20
  inherited create;
 
21
  FCanvas := nil;
 
22
  FFixedCanvas := false;
 
23
  FAllocated := false;
 
24
end;
 
25
 
 
26
destructor TFPCanvasHelper.destroy;
 
27
begin
 
28
  if Allocated then
 
29
    DeAllocateResources;
 
30
  inherited;
 
31
end;
 
32
 
 
33
procedure TFPCanvasHelper.SetFixedCanvas (AValue : boolean);
 
34
begin
 
35
  FFixedCanvas := AValue;
 
36
end;
 
37
 
 
38
procedure TFPCanvasHelper.NotifyCanvas;
 
39
// called to unbind from canvas
 
40
begin
 
41
  if FCanvas<>nil then
 
42
    FCanvas.CheckHelper (self);
 
43
end;
 
44
 
 
45
procedure TFPCanvasHelper.CheckAllocated (ValueNeeded:boolean);
 
46
 
 
47
  procedure RaiseErrAllocation;
 
48
  begin
 
49
    Raise TFPFontException.CreateFmt (ErrAllocation,
 
50
                                      [EFont, ErrAlloc[ValueNeeded]]);
 
51
  end;
 
52
 
 
53
begin
 
54
  if (Allocated <> ValueNeeded) then
 
55
    RaiseErrAllocation;
 
56
end;
 
57
 
 
58
procedure TFPCanvasHelper.SetFPColor(const AValue:TFPColor);
 
59
begin
 
60
  FFPColor := AValue;
 
61
end;
 
62
 
 
63
procedure TFPCanvasHelper.Changing;
 
64
begin
 
65
  if Assigned(FOnChanging) then FOnChanging(Self);
 
66
end;
 
67
 
 
68
procedure TFPCanvasHelper.Changed;
 
69
begin
 
70
  if Assigned(FOnChange) then FOnChange(Self);
 
71
end;
 
72
 
 
73
procedure TFPCanvasHelper.Lock;
 
74
begin
 
75
 
 
76
end;
 
77
 
 
78
procedure TFPCanvasHelper.UnLock;
 
79
begin
 
80
 
 
81
end;
 
82
 
 
83
procedure TFPCanvasHelper.SetFlags (index:integer; AValue:boolean);
 
84
begin
 
85
  if AValue then
 
86
    FFlags := FFlags or (1 shl index)
 
87
  else
 
88
    FFlags := FFlags and not (1 shl index);
 
89
end;
 
90
 
 
91
function TFPCanvasHelper.GetFlags (index:integer) : boolean;
 
92
begin
 
93
  result := (FFlags and (1 shl index)) <> 0;
 
94
end;
 
95
 
 
96
function TFPCanvasHelper.GetAllocated : boolean;
 
97
begin
 
98
  if FFixedCanvas then
 
99
    result := assigned(FCanvas)
 
100
  else
 
101
    result := FAllocated;
 
102
end;
 
103
 
 
104
procedure TFPCanvasHelper.AllocateResources (ACanvas : TFPCustomCanvas;
 
105
  CanDelay: boolean);
 
106
begin
 
107
  if FFixedCanvas and FAllocated then
 
108
    DeallocateResources;
 
109
  FCanvas := ACanvas;
 
110
  if DelayAllocate and CanDelay then exit;
 
111
  try
 
112
    DoAllocateResources;
 
113
    FAllocated := True;
 
114
  except
 
115
    FCanvas := nil;
 
116
    FAllocated := False;
 
117
  end;
 
118
end;
 
119
 
 
120
procedure TFPCanvasHelper.DeallocateResources;
 
121
begin
 
122
  if FAllocated then
 
123
    try
 
124
      DoDeallocateResources;
 
125
    finally
 
126
      FAllocated := false;
 
127
      NotifyCanvas;
 
128
      FCanvas := nil;
 
129
    end;
 
130
end;
 
131
 
 
132
procedure TFPCanvasHelper.DoCopyProps (From:TFPCanvasHelper);
 
133
begin
 
134
  FPColor := from.FPColor;
 
135
end;
 
136
 
 
137
procedure TFPCanvasHelper.DoAllocateResources;
 
138
begin
 
139
end;
 
140
 
 
141
procedure TFPCanvasHelper.DoDeallocateResources;
 
142
begin
 
143
end;
 
144
 
 
145