Title: [160177] trunk/Source/WebCore
Revision
160177
Author
[email protected]
Date
2013-12-05 09:18:18 -0800 (Thu, 05 Dec 2013)

Log Message

[Cairo] Avoid extra copy when drawing images
https://bugs.webkit.org/show_bug.cgi?id=124209

Patch by Aloisio Almeida Jr <[email protected]> on 2013-12-05
Reviewed by Carlos Garcia Campos.

This commit applies some changes proposed after the original patch has
been landed. It fixes the logic to create the subsurface (as it was
inverted). It also remove an unnecessary RefPtr variable to hold the
subsurface.

No new tests. It's an enhancement. Already covered by existing tests.

* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::drawSurfaceToContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160176 => 160177)


--- trunk/Source/WebCore/ChangeLog	2013-12-05 16:48:06 UTC (rev 160176)
+++ trunk/Source/WebCore/ChangeLog	2013-12-05 17:18:18 UTC (rev 160177)
@@ -1,3 +1,20 @@
+2013-12-05  Aloisio Almeida Jr  <[email protected]>
+
+        [Cairo] Avoid extra copy when drawing images
+        https://bugs.webkit.org/show_bug.cgi?id=124209
+
+        Reviewed by Carlos Garcia Campos.
+
+        This commit applies some changes proposed after the original patch has
+        been landed. It fixes the logic to create the subsurface (as it was
+        inverted). It also remove an unnecessary RefPtr variable to hold the
+        subsurface.
+
+        No new tests. It's an enhancement. Already covered by existing tests.
+
+        * platform/graphics/cairo/PlatformContextCairo.cpp:
+        (WebCore::PlatformContextCairo::drawSurfaceToContext):
+
 2013-12-05  Zoltan Horvath  <[email protected]>
 
         [CSS Shapes] Fix inset when only a subset of the arguments are defined

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (160176 => 160177)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2013-12-05 16:48:06 UTC (rev 160176)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2013-12-05 17:18:18 UTC (rev 160177)
@@ -172,25 +172,23 @@
         srcRect.setHeight(std::fabs(originalSrcRect.height()));
     }
 
-    cairo_surface_t* patternSurface = surface;
-    RefPtr<cairo_surface_t> subsurface;
+    RefPtr<cairo_surface_t> patternSurface = surface;
     float leftPadding = 0;
     float topPadding = 0;
-    if (srcRect.x() || srcRect.y() || srcRect.size() == cairoSurfaceSize(surface)) {
+    if (srcRect.x() || srcRect.y() || srcRect.size() != cairoSurfaceSize(surface)) {
         // Cairo subsurfaces don't support floating point boundaries well, so we expand the rectangle.
         IntRect expandedSrcRect(enclosingIntRect(srcRect));
 
         // We use a subsurface here so that we don't end up sampling outside the originalSrcRect rectangle.
         // See https://bugs.webkit.org/show_bug.cgi?id=58309
-        subsurface = adoptRef(cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(),
+        patternSurface = adoptRef(cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(),
             expandedSrcRect.y(), expandedSrcRect.width(), expandedSrcRect.height()));
-        patternSurface = subsurface.get();
 
         leftPadding = static_cast<float>(expandedSrcRect.x()) - floorf(srcRect.x());
         topPadding = static_cast<float>(expandedSrcRect.y()) - floorf(srcRect.y());
     }
 
-    RefPtr<cairo_pattern_t> pattern = adoptRef(cairo_pattern_create_for_surface(patternSurface));
+    RefPtr<cairo_pattern_t> pattern = adoptRef(cairo_pattern_create_for_surface(patternSurface.get()));
 
     ASSERT(m_state);
     switch (m_state->m_imageInterpolationQuality) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to