Changeset 84523 in webkit


Ignore:
Timestamp:
Apr 21, 2011 10:57:36 AM (13 years ago)
Author:
weinig@apple.com
Message:

2011-04-21 Sam Weinig <sam@webkit.org>

Reviewed by Simon Fraser.

Deploy GraphicsContextStateSaver in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59116

  • UIProcess/FindIndicator.cpp: (WebKit::FindIndicator::draw):
  • WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::paint):
  • WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect):
  • WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::drawRect):
  • WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawRect): (WebKit::WebPage::drawPageOverlay):
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r84519 r84523  
     12011-04-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Deploy GraphicsContextStateSaver in WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59116
     7
     8        * UIProcess/FindIndicator.cpp:
     9        (WebKit::FindIndicator::draw):
     10        * WebProcess/Plugins/PluginView.cpp:
     11        (WebKit::PluginView::paint):
     12        * WebProcess/WebPage/FindController.cpp:
     13        (WebKit::FindController::drawRect):
     14        * WebProcess/WebPage/PageOverlay.cpp:
     15        (WebKit::PageOverlay::drawRect):
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::drawRect):
     18        (WebKit::WebPage::drawPageOverlay):
     19
    1202011-04-21  Jessie Berlin  <jberlin@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/FindIndicator.cpp

    r82441 r84523  
    149149        textRect.move(leftBorderThickness, topBorderThickness);
    150150
    151         graphicsContext.save();
    152151        FloatRect outerPathRect = inflateRect(textRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder);
    153         graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB);
    154         graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB);
    155         graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius));
    156         graphicsContext.restore();
     152        FloatRect innerPathRect = inflateRect(textRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder);
    157153
    158         graphicsContext.save();
    159         FloatRect innerPathRect = inflateRect(textRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder);
    160         graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius));
    161         RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.maxY()));
    162         gradient->addColorStop(0, gradientLightColor());
    163         gradient->addColorStop(1, gradientDarkColor());
    164         graphicsContext.setFillGradient(gradient);
    165         graphicsContext.fillRect(outerPathRect);
    166         graphicsContext.restore();
     154        {
     155            GraphicsContextStateSaver stateSaver(graphicsContext);
     156            graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB);
     157            graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB);
     158            graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius));
     159        }
    167160
    168         graphicsContext.save();
    169         graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness)));
    170         m_contentImage->paint(graphicsContext, IntPoint(0, 0), m_contentImage->bounds());
    171         graphicsContext.restore();
     161        {
     162            GraphicsContextStateSaver stateSaver(graphicsContext);
     163            graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius));
     164            RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.maxY()));
     165            gradient->addColorStop(0, gradientLightColor());
     166            gradient->addColorStop(1, gradientDarkColor());
     167            graphicsContext.setFillGradient(gradient);
     168            graphicsContext.fillRect(outerPathRect);
     169        }
     170
     171        {
     172            GraphicsContextStateSaver stateSaver(graphicsContext);
     173            graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness)));
     174            m_contentImage->paint(graphicsContext, IntPoint(0, 0), m_contentImage->bounds());
     175        }
    172176    }
    173177}
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r82467 r84523  
    532532        // the document's window coordinates.
    533533        IntPoint documentOriginInWindowCoordinates = parent()->contentsToWindow(IntPoint());
    534         context->save();
     534       
     535        GraphicsContextStateSaver stateSaver(*context);
    535536        context->translate(-documentOriginInWindowCoordinates.x(), -documentOriginInWindowCoordinates.y());
    536537        m_plugin->paint(context, paintRectInWindowCoordinates);
    537         context->restore();
    538538    }
    539539}
  • trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp

    r84042 r84523  
    300300    graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(fractionFadedIn), ColorSpaceSRGB);
    301301
    302     graphicsContext.save();
    303     graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, holeShadowColor(fractionFadedIn), ColorSpaceSRGB);
    304 
    305     graphicsContext.setFillColor(holeFillColor(fractionFadedIn), ColorSpaceSRGB);
    306 
    307     // Draw white frames around the holes.
    308     for (size_t i = 0; i < rects.size(); ++i) {
    309         IntRect whiteFrameRect = rects[i];
    310         whiteFrameRect.inflate(1);
    311 
    312         graphicsContext.fillRect(whiteFrameRect);
    313     }
    314 
    315     graphicsContext.restore();
     302    {
     303        GraphicsContextStateSaver stateSaver(graphicsContext);
     304
     305        graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, holeShadowColor(fractionFadedIn), ColorSpaceSRGB);
     306        graphicsContext.setFillColor(holeFillColor(fractionFadedIn), ColorSpaceSRGB);
     307
     308        // Draw white frames around the holes.
     309        for (size_t i = 0; i < rects.size(); ++i) {
     310            IntRect whiteFrameRect = rects[i];
     311            whiteFrameRect.inflate(1);
     312
     313            graphicsContext.fillRect(whiteFrameRect);
     314        }
     315    }
    316316
    317317    graphicsContext.setFillColor(Color::transparent, ColorSpaceSRGB);
  • trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp

    r84153 r84523  
    105105        return;
    106106
    107     graphicsContext.save();
     107    GraphicsContextStateSaver stateSaver(graphicsContext);
    108108    graphicsContext.beginTransparencyLayer(1);
    109109    graphicsContext.setCompositeOperation(CompositeCopy);
     
    112112
    113113    graphicsContext.endTransparencyLayer();
    114     graphicsContext.restore();
    115114}
    116115   
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r84519 r84523  
    642642void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
    643643{
    644     graphicsContext.save();
     644    GraphicsContextStateSaver stateSaver(graphicsContext);
    645645    graphicsContext.clip(rect);
    646646    m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect);
    647     graphicsContext.restore();
    648647}
    649648
     
    652651    ASSERT(m_pageOverlay);
    653652
    654     graphicsContext.save();
     653    GraphicsContextStateSaver stateSaver(graphicsContext);
    655654    graphicsContext.clip(rect);
    656655    m_pageOverlay->drawRect(graphicsContext, rect);
    657     graphicsContext.restore();
    658656}
    659657
Note: See TracChangeset for help on using the changeset viewer.