Closed Bug 718985 Opened 12 years ago Closed 12 years ago

gfxImageSurface not available with Shared XPCOM C++ Component - Gecko 12.0a1

Categories

(Firefox Build System :: General, defect)

x86
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: joffrey.romero, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0a1) Gecko/20120117 Firefox/12.0a1
Build ID: 20120117031056

Steps to reproduce:

I am c++ XPCOM developer, and i work with the last mozilla-central
repository on msWindows MSVC10. When I use nsIDOMWindowUtils for image rendering (RenderDocument).

[code]
oid events_manager::paintDrivers::onEventHandler(nsIDOMEvent* aEvent, const std::string & id)
{
   
   nsCOMPtr<nsIDOMNotifyPaintEvent> evt = do_QueryInterface(aEvent);
   nsCOMPtr<nsIDOMClientRectList> rectList;
   evt->GetClientRects( getter_AddRefs(rectList) );
   
   PRUint32 Length;
   rectList->GetLength(&Length);
   
   
   nsCOMPtr<nsIDOMEventTarget> currentTarget;
   aEvent->GetCurrentTarget(getter_AddRefs(currentTarget));
   
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(currentTarget);
   nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(window));
   
   PRInt32 innerWidth;  domWindow->GetInnerWidth(&innerWidth);
   PRInt32 innerHeight; domWindow->GetInnerHeight(&innerHeight);

   nsCOMPtr<nsIDOMWindowUtils> utils(do_GetInterface(domWindow));


   for ( PRUint32 i = 0 ; i < Length ; i++ )
   {
      nsCOMPtr<nsIDOMClientRect> rect;
      rectList->Item( i, getter_AddRefs(rect) );
      float x, y;
      float width, height;
      rect->GetLeft(&x);
      rect->GetTop(&y);
      rect->GetWidth(&width);
      rect->GetHeight(&height);
      

      PRInt32 i32_left = static_cast<PRInt32>(x);
      PRInt32 i32_top = static_cast<PRInt32>(y);
      PRInt32 i32_width = static_cast<PRInt32>(width);
      PRInt32 i32_height = static_cast<PRInt32>(height);
      
      if ( i32_width+i32_left > innerWidth ) i32_width = innerWidth-i32_left; 
      if ( i32_height+i32_top > innerHeight ) i32_height = innerHeight-i32_top; 
         
      nscoord aX = NSIntPixelsToAppUnits(i32_left,(nsDeviceContext::AppUnitsPerCSSPixel()));
      nscoord aY = NSIntPixelsToAppUnits(i32_top,(nsDeviceContext::AppUnitsPerCSSPixel()));
      nscoord aWidth = NSIntPixelsToAppUnits(i32_width,(nsDeviceContext::AppUnitsPerCSSPixel()));
      nscoord aHeight = NSIntPixelsToAppUnits(i32_height,(nsDeviceContext::AppUnitsPerCSSPixel()));
      
      nsRect r( aX, aY, aWidth, aHeight ); 
      
      nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(
         gfxIntSize(i32_width,i32_height), gfxImageSurface::ImageFormatARGB32);
      nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
      
      
      nscolor bgcolor = NS_RGBA(0,0,0,0);
      
      utils->RenderDocument(r,
         nsIPresShell::RENDER_CARET,
         
         bgcolor, ctx);

      
      threadObject->waiting_for();
      threadObject->increase();
      
      workers->create_thread(
         boost::bind( &ipc::paintEvent_sender::paintDriversWorker, threadObject,
            targetSurface.forget().get(), ipc::paint_defs::event_infos(
               static_cast<unsigned int>(x), static_cast<unsigned int>(y), id) ) );
   }
}
[/code]


Actual results:

i get an error at link operation : gfxImageSurface not available with Shared component.

[log]
paintDrivers.obj : error LNK2019: unresolved external symbol "public: __thiscall gfxContext::gfxContext(class gfxASurface *)" (??0gfxContext@@QAE@PAVgfxASurface@@@Z) referenced in f
unction "public: void __thiscall events_manager::paintDrivers::onEventHandler(class nsIDOMEvent *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<cha
r> > const &)" (?onEventHandler@paintDrivers@events_manager@@QAEXPAVnsIDOMEvent@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
paintDrivers.obj : error LNK2019: unresolved external symbol "public: __thiscall gfxImageSurface::gfxImageSurface(struct nsIntSize const &,enum gfxASurface::gfxImageFormat)" (??0gfx
ImageSurface@@QAE@ABUnsIntSize@@W4gfxImageFormat@gfxASurface@@@Z) referenced in function "public: void __thiscall events_manager::paintDrivers::onEventHandler(class nsIDOMEvent *,cl
ass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?onEventHandler@paintDrivers@events_manager@@QAEXPAVnsIDOMEvent@@ABV?$basic_string@D
U?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
paintDrivers.obj : error LNK2019: unresolved external symbol "public: __thiscall gfxContext::~gfxContext(void)" (??1gfxContext@@QAE@XZ) referenced in function "public: void * __this
call gfxContext::`scalar deleting destructor'(unsigned int)" (??_GgfxContext@@QAEPAXI@Z)
nsddraw.dll : fatal error LNK1120: 3 unresolved externals
[/log]



Expected results:


In the past (with previous trunk repositories), this c++ component worked well.

I didn't find the right way for solve this problem.
This was changed intentionally in bug 683891.
Blocks: 683891
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Component: XPCOM → Build Config
QA Contact: xpcom → build-config
Resolution: --- → WONTFIX
Attached file Complete Makefile
Simple makefile of current component
What exactly are you trying to do here?
I use XULRUNNER as a gui for a video game.

Thanks for your answer.

So, now, there is no way to call RenderDocument since XPCOM ?
I would suggest using the canvas element and nsIDOMCanvasRenderingContext2D::DrawWindow to handle rendering of your document now.
i have chosen to disable patch ID 683891.
Thanks.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: