Changeset 222603 in webkit
- Timestamp:
- Sep 27, 2017 11:16:52 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r222602 r222603 1 2017-09-27 Zan Dobersek <zdobersek@igalia.com> 2 3 [Cairo] Drop cairo_matrix_t conversion operators for AffineTransform, TransformationMatrix 4 https://bugs.webkit.org/show_bug.cgi?id=177539 5 6 Reviewed by Carlos Garcia Campos. 7 8 Remove the cairo_matrix_t conversion operators from the AffineTransform 9 and TransformationMatrix classes. These are rarely used, but enforce 10 including the cairo.h header in both headers, which leads to the Cairo 11 headers being included in around 800 build targets. 12 13 Instead, the toCairoMatrix() function is added to CairoUtilities.h that 14 creates a cairo_matrix_t object for the given AffineTransform. No 15 toCairoMatrix() is needed for TransformationMatrix since objects of 16 that type aren't converted to cairo_matrix_t anywhere in the codebase. 17 18 This patch excludes unnecessary Cairo headers from about 550 build 19 targets (with those headers being included in the other affected 250 20 targets by some other header inclusion chain). CairoUtilities.h header 21 is now included where necessary to make toCairoMatrix() available, and 22 duplicated cairo.h inclusions are removed. 23 24 No new tests -- no change in behavior. 25 26 * editing/gtk/EditorGtk.cpp: Explicitly include <cairo.h> since it's 27 necessary for Cairo operations used there. 28 * platform/Cairo.cmake: 29 * platform/graphics/cairo/CairoUtilities.cpp: 30 (WebCore::drawPatternToCairoContext): 31 (WebCore::toCairoMatrix): 32 * platform/graphics/cairo/CairoUtilities.h: 33 * platform/graphics/cairo/GradientCairo.cpp: 34 (WebCore::Gradient::platformGradient): 35 (WebCore::Gradient::setPlatformGradientSpaceTransform): 36 * platform/graphics/cairo/GraphicsContextCairo.cpp: 37 (WebCore::GraphicsContext::concatCTM): 38 (WebCore::GraphicsContext::setCTM): 39 * platform/graphics/cairo/PathCairo.cpp: No need to include AffineTransform.h. 40 (WebCore::Path::addPath): 41 (WebCore::Path::transform): 42 * platform/graphics/cairo/PatternCairo.cpp: Ditto. 43 (WebCore::Pattern::createPlatformPattern const): 44 * platform/graphics/cairo/TransformationMatrixCairo.cpp: Removed. 45 * platform/graphics/transforms/AffineTransform.h: 46 * platform/graphics/transforms/TransformationMatrix.h: 47 1 48 2017-09-27 Alex Christensen <achristensen@webkit.org> 2 49 -
trunk/Source/WebCore/editing/gtk/EditorGtk.cpp
r221960 r222603 46 46 #include "XLinkNames.h" 47 47 #include "markup.h" 48 #include <cairo.h> 48 49 49 50 namespace WebCore { -
trunk/Source/WebCore/platform/Cairo.cmake
r217404 r222603 21 21 platform/graphics/cairo/PlatformPathCairo.cpp 22 22 platform/graphics/cairo/RefPtrCairo.cpp 23 platform/graphics/cairo/TransformationMatrixCairo.cpp24 23 ) 25 24 -
trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
r219819 r222603 255 255 // than sampling it at (x mod w, y mod h), so we transform the translation component of the pattern matrix in that way. 256 256 257 cairo_matrix_t patternMatrix = cairo_matrix_t(patternTransform);257 cairo_matrix_t patternMatrix = toCairoMatrix(patternTransform); 258 258 // dx and dy are added here as well to compensate the previous translation of the destination rectangle. 259 259 double phaseOffsetX = phase.x() + tileRect.x() * patternTransform.a() + dx; … … 386 386 } 387 387 388 cairo_matrix_t toCairoMatrix(const AffineTransform& transform) 389 { 390 return cairo_matrix_t { transform.a(), transform.b(), transform.c(), transform.d(), transform.e(), transform.f() }; 391 } 392 388 393 } // namespace WebCore 389 394 -
trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h
r214283 r222603 96 96 RefPtr<cairo_region_t> toCairoRegion(const Region&); 97 97 98 cairo_matrix_t toCairoMatrix(const AffineTransform&); 99 98 100 } // namespace WebCore 99 101 -
trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp
r216121 r222603 30 30 #if USE(CAIRO) 31 31 32 #include "CairoUtilities.h" 32 33 #include "GraphicsContext.h" 33 34 #include "PlatformContextCairo.h" 34 #include <cairo.h>35 35 36 36 namespace WebCore { … … 85 85 } 86 86 87 cairo_matrix_t matrix = m_gradientSpaceTransformation;87 cairo_matrix_t matrix = toCairoMatrix(m_gradientSpaceTransformation); 88 88 cairo_matrix_invert(&matrix); 89 89 cairo_pattern_set_matrix(m_gradient, &matrix); … … 95 95 { 96 96 if (m_gradient) { 97 cairo_matrix_t matrix = gradientSpaceTransformation;97 cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransformation); 98 98 cairo_matrix_invert(&matrix); 99 99 cairo_pattern_set_matrix(m_gradient, &matrix); -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r214100 r222603 823 823 824 824 cairo_t* cr = platformContext()->cr(); 825 const cairo_matrix_t matrix = cairo_matrix_t(transform);825 const cairo_matrix_t matrix = toCairoMatrix(transform); 826 826 cairo_transform(cr, &matrix); 827 827 m_data->concatCTM(transform); … … 839 839 840 840 cairo_t* cr = platformContext()->cr(); 841 const cairo_matrix_t matrix = cairo_matrix_t(transform);841 const cairo_matrix_t matrix = toCairoMatrix(transform); 842 842 cairo_set_matrix(cr, &matrix); 843 843 m_data->setCTM(transform); -
trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp
r187621 r222603 29 29 #if USE(CAIRO) 30 30 31 #include " AffineTransform.h"31 #include "CairoUtilities.h" 32 32 #include "FloatRect.h" 33 33 #include "GraphicsContext.h" 34 34 #include "PlatformPathCairo.h" 35 35 #include "StrokeStyleApplier.h" 36 #include <cairo.h>37 36 #include <math.h> 38 37 #include <wtf/MathExtras.h> … … 318 317 return; 319 318 320 cairo_matrix_t matrix (transform);319 cairo_matrix_t matrix = toCairoMatrix(transform); 321 320 if (cairo_matrix_invert(&matrix) != CAIRO_STATUS_SUCCESS) 322 321 return; … … 432 431 } 433 432 434 void Path::transform(const AffineTransform& trans )435 { 436 cairo_t* cr = ensurePlatformPath()->context(); 437 cairo_matrix_t c_matrix = cairo_matrix_t(trans);438 cairo_matrix_invert(& c_matrix);439 cairo_transform(cr, & c_matrix);433 void Path::transform(const AffineTransform& transform) 434 { 435 cairo_t* cr = ensurePlatformPath()->context(); 436 cairo_matrix_t matrix = toCairoMatrix(transform); 437 cairo_matrix_invert(&matrix); 438 cairo_transform(cr, &matrix); 440 439 } 441 440 -
trunk/Source/WebCore/platform/graphics/cairo/PatternCairo.cpp
r216702 r222603 29 29 #if USE(CAIRO) 30 30 31 #include " AffineTransform.h"31 #include "CairoUtilities.h" 32 32 #include "GraphicsContext.h" 33 #include <cairo.h>34 33 35 34 namespace WebCore { … … 44 43 45 44 // cairo merges patter space and user space itself 46 cairo_matrix_t matrix = m_patternSpaceTransformation;45 cairo_matrix_t matrix = toCairoMatrix(m_patternSpaceTransformation); 47 46 cairo_matrix_invert(&matrix); 48 47 cairo_pattern_set_matrix(pattern, &matrix); -
trunk/Source/WebCore/platform/graphics/transforms/AffineTransform.h
r222253 r222603 35 35 #if USE(CG) 36 36 typedef struct CGAffineTransform CGAffineTransform; 37 #elif USE(CAIRO)38 #include <cairo.h>39 37 #endif 40 38 … … 182 180 #if USE(CG) 183 181 WEBCORE_EXPORT operator CGAffineTransform() const; 184 #elif USE(CAIRO)185 operator cairo_matrix_t() const;186 182 #endif 187 183 -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
r220503 r222603 38 38 #if USE(CG) 39 39 typedef struct CGAffineTransform CGAffineTransform; 40 #elif USE(CAIRO)41 #include <cairo.h>42 40 #endif 43 41 … … 361 359 WEBCORE_EXPORT TransformationMatrix(const CGAffineTransform&); 362 360 WEBCORE_EXPORT operator CGAffineTransform() const; 363 #elif USE(CAIRO)364 operator cairo_matrix_t() const;365 361 #endif 366 362
Note: See TracChangeset
for help on using the changeset viewer.