This file is indexed.

/usr/src/castle-game-engine-4.1.1/images/images_dds.inc is in castle-game-engine-src 4.1.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function LoadDDS(Stream: TStream;
  const AllowedImageClasses: array of TCastleImageClass): TCastleImage;
var
  DDS: TDDSImage;
begin
  DDS := TDDSImage.Create;
  try
    DDS.LoadFromStream(Stream);

    { After successfully loading, DDS should always contain at least one image }
    Assert(DDS.Images.Count >= 1);

    if DDS.Images[0] is TCastleImage then
    begin
      { This way I don't have to make a copy of DDS.Images[0] for Result,
        which would be a waste of time. }
      DDS.OwnsFirstImage := false;

      { TODO: make sure to honor AllowedImageClasses.
        For now, I just return whatever DDS set... }
      Result := TCastleImage(DDS.Images[0]);
    end else
      raise EImageLoadError.CreateFmt('Cannot load this way image class %s', [DDS.Images[0].ClassName]);
  finally FreeAndNil(DDS) end;
end;

procedure SaveDDS(Img: TCastleImage; Stream: TStream);
var
  DDS: TDDSImage;
begin
  DDS := TDDSImage.Create;
  try
    DDS.Width := Img.Width;
    DDS.Height := Img.Height;
    DDS.DDSType := dtTexture;
    DDS.Mipmaps := false;
    DDS.MipmapsCount := 1;
    DDS.Images.Count := 1;
    DDS.Images[0] := Img;

    DDS.OwnsFirstImage := false;

    DDS.SaveToStream(Stream);
  finally FreeAndNil(DDS) end;
end;