Changeset 104568 in webkit


Ignore:
Timestamp:
Jan 10, 2012, 7:17:50 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Added smart pointers to Ewk_View_Paint_Context class and done minor refactoring.
https://bugs.webkit.org/show_bug.cgi?id=75837

Patch by Tomasz Morawski <t.morawski@samsung.com> on 2012-01-10
Reviewed by Ryosuke Niwa.

Changed graphicContext raw pointer to OwnPtr smart pointer.
Renamed cr to cairo and made it a RefPtr.

  • ewk/ewk_view.cpp:

(ewk_view_paint_context_new): Adjust to auto pointers use.
(ewk_view_paint_context_free): Removed explicit raw pointers delete.
Adjust to auto pointers use:
(ewk_view_paint_context_save):
(ewk_view_paint_context_restore):
(ewk_view_paint_context_clip):
(ewk_view_paint_context_paint):
(ewk_view_paint_context_paint_contents):

Location:
trunk/Source/WebKit/efl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/ChangeLog

    r104562 r104568  
     12012-01-10  Tomasz Morawski  <t.morawski@samsung.com>
     2
     3        [EFL] Added smart pointers to Ewk_View_Paint_Context class and done minor refactoring.
     4        https://bugs.webkit.org/show_bug.cgi?id=75837
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Changed graphicContext raw pointer to OwnPtr smart pointer.
     9        Renamed cr to cairo and made it a RefPtr.
     10
     11        * ewk/ewk_view.cpp:
     12        (ewk_view_paint_context_new): Adjust to auto pointers use.
     13        (ewk_view_paint_context_free): Removed explicit raw pointers delete.
     14        Adjust to auto pointers use:
     15        (ewk_view_paint_context_save):
     16        (ewk_view_paint_context_restore):
     17        (ewk_view_paint_context_clip):
     18        (ewk_view_paint_context_paint):
     19        (ewk_view_paint_context_paint_contents):
     20
    1212012-01-09  Raphael Kubo da Costa  <kubo@profusion.mobi>
    222
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r104282 r104568  
    25632563 */
    25642564struct _Ewk_View_Paint_Context {
    2565     WebCore::GraphicsContext* graphicContext;
    25662565    WebCore::FrameView* view;
    2567     cairo_t* cr;
     2566    OwnPtr<WebCore::GraphicsContext> graphicContext;
     2567    RefPtr<cairo_t> cairo;
    25682568};
    25692569
    2570 Ewk_View_Paint_Context* ewk_view_paint_context_new(Ewk_View_Private_Data* priv, cairo_t* cr)
     2570Ewk_View_Paint_Context* ewk_view_paint_context_new(Ewk_View_Private_Data* priv, cairo_t* cairo)
    25712571{
    25722572    EINA_SAFETY_ON_NULL_RETURN_VAL(priv, 0);
    2573     EINA_SAFETY_ON_NULL_RETURN_VAL(cr, 0);
     2573    EINA_SAFETY_ON_NULL_RETURN_VAL(cairo, 0);
    25742574    EINA_SAFETY_ON_NULL_RETURN_VAL(priv->mainFrame, 0);
    2575     WebCore::FrameView* view = priv->mainFrame->view();
    2576     EINA_SAFETY_ON_NULL_RETURN_VAL(view, 0);
    2577     Ewk_View_Paint_Context* context = static_cast<Ewk_View_Paint_Context*>(malloc(sizeof(*context)));
    2578     EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
    2579 
    2580     context->graphicContext = new WebCore::GraphicsContext(cr);
    2581     if (!context->graphicContext) {
    2582         free(context);
    2583         return 0;
    2584     }
    2585     context->view = view;
    2586     context->cr = cairo_reference(cr);
     2575    EINA_SAFETY_ON_NULL_RETURN_VAL(priv->mainFrame->view(), 0);
     2576
     2577    Ewk_View_Paint_Context* context = new Ewk_View_Paint_Context;
     2578    context->view = priv->mainFrame->view();
     2579    context->graphicContext = adoptPtr(new WebCore::GraphicsContext(cairo));
     2580    context->cairo = adoptRef(cairo_reference(cairo));
     2581
    25872582    return context;
    25882583}
     
    25912586{
    25922587    EINA_SAFETY_ON_NULL_RETURN(context);
    2593     delete context->graphicContext;
    2594     cairo_destroy(context->cr);
    2595     free(context);
     2588
     2589    delete context;
    25962590}
    25972591
     
    25992593{
    26002594    EINA_SAFETY_ON_NULL_RETURN(context);
    2601     cairo_save(context->cr);
     2595
     2596    cairo_save(context->cairo.get());
    26022597    context->graphicContext->save();
    26032598}
     
    26062601{
    26072602    EINA_SAFETY_ON_NULL_RETURN(context);
     2603
    26082604    context->graphicContext->restore();
    2609     cairo_restore(context->cr);
     2605    cairo_restore(context->cairo.get());
    26102606}
    26112607
     
    26142610    EINA_SAFETY_ON_NULL_RETURN(context);
    26152611    EINA_SAFETY_ON_NULL_RETURN(area);
     2612
    26162613    context->graphicContext->clip(WebCore::IntRect(area->x, area->y, area->w, area->h));
    26172614}
     
    26262623    if (context->view->isTransparent())
    26272624        context->graphicContext->clearRect(rect);
    2628     context->view->paint(context->graphicContext, rect);
     2625    context->view->paint(context->graphicContext.get(), rect);
    26292626}
    26302627
     
    26392636        context->graphicContext->clearRect(rect);
    26402637
    2641     context->view->paintContents(context->graphicContext, rect);
     2638    context->view->paintContents(context->graphicContext.get(), rect);
    26422639}
    26432640
Note: See TracChangeset for help on using the changeset viewer.