Results 1 to 2 of 2

Thread: About TCustomLockableTexture.Lock

  1. #1

    About TCustomLockableTexture.Lock

    function Lock(out Surface: TPixelSurface): Boolean; overload; inline;
    ---------------------------------------------------------------------------------------------------------------------
    Code:
    procedure TForm1.CacheTexture(const ATexture: TCustomLockableTexture);
    var
      LSurface: TPixelSurface;
    begin
      if not ATexture.Lock(LSurface) then       //The code is optimized off the mobile platform   TPixelSurface is a TObject?
      begin
        ShowMessage('lock failed');
        Exit;
      end else
        ShowMessage('lock success');
      //
      try
         if LSurface = nil then
            ShowMessage('surface is null');
      finally
         ATexture.Unlock;
      end;
    end;
    ----------print----------
    --surface is null
    --lock success
    Last edited by devchenxip; 06-12-2018 at 11:40 AM. Reason: format

  2. #2
    Code:
    procedure TForm1.CacheTexture(const ATexture: TCustomLockableTexture);
    var
      LPixels: TLockedPixels;
    begin
      if not ATexture.Lock(LPixels) then 
      begin
        ShowMessage('lock failed');
        Exit;
      end else
        ShowMessage('lock success');
      //
      try
         if not LPixels.valid then
            ShowMessage('invalid pixels');
      finally
         ATexture.Unlock;
      end;
    end;
    ----------print----------
    --lock success

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL