Guest User

Untitled

a guest
Aug 21st, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
  2. index 9601161..e3ecc4e 100644
  3. --- a/WebCore/ChangeLog
  4. +++ b/WebCore/ChangeLog
  5. @@ -1,3 +1,22 @@
  6. +2010-12-05 Alejandro G. Castro <alex@igalia.com>
  7. +
  8. + Reviewed by NOBODY (OOPS!).
  9. +
  10. + [GTK] Remove setColor functions it was replicated in
  11. + CairoUtilities: setSourceRGBAFromColor.
  12. +
  13. + * platform/graphics/cairo/GraphicsContextCairo.cpp:
  14. + (WebCore::setPlatformFill):
  15. + (WebCore::setPlatformStroke):
  16. + (WebCore::fillRectSourceOver):
  17. + (WebCore::GraphicsContext::drawRect):
  18. + (WebCore::GraphicsContext::drawLine):
  19. + (WebCore::GraphicsContext::drawEllipse):
  20. + (WebCore::GraphicsContext::strokeArc):
  21. + (WebCore::GraphicsContext::drawConvexPolygon):
  22. + (WebCore::GraphicsContext::drawFocusRing):
  23. + (WebCore::GraphicsContext::fillRoundedRect):
  24. +
  25. 2010-12-05 Robert Hogan <robert@webkit.org>
  26.  
  27. Reviewed by Andreas Kling.
  28. diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
  29. index a718f27..6bb7633 100644
  30. --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
  31. +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
  32. @@ -68,13 +68,6 @@ using namespace std;
  33.  
  34. namespace WebCore {
  35.  
  36. -static inline void setColor(cairo_t* cr, const Color& col)
  37. -{
  38. - float red, green, blue, alpha;
  39. - col.getRGBA(red, green, blue, alpha);
  40. - cairo_set_source_rgba(cr, red, green, blue, alpha);
  41. -}
  42. -
  43. static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
  44. {
  45. cairo_pattern_t* pattern = 0;
  46. @@ -86,7 +79,7 @@ static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, Graphi
  47. } else if (gcp->state.fillGradient)
  48. cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
  49. else
  50. - setColor(cr, context->fillColor());
  51. + setSourceRGBAFromColor(cr, context->fillColor());
  52. cairo_clip_preserve(cr);
  53. cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
  54. cairo_restore(cr);
  55. @@ -106,7 +99,7 @@ static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, Grap
  56. cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
  57. else {
  58. Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
  59. - setColor(cr, strokeColor);
  60. + setSourceRGBAFromColor(cr, strokeColor);
  61. }
  62. if (gcp->state.globalAlpha < 1.0f && (gcp->state.strokePattern || gcp->state.strokeGradient)) {
  63. cairo_push_group(cr);
  64. @@ -122,7 +115,7 @@ static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, Grap
  65. // A fillRect helper
  66. static inline void fillRectSourceOver(cairo_t* cr, const FloatRect& rect, const Color& col)
  67. {
  68. - setColor(cr, col);
  69. + setSourceRGBAFromColor(cr, col);
  70. cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
  71. cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
  72. cairo_fill(cr);
  73. @@ -262,7 +255,7 @@ void GraphicsContext::drawRect(const IntRect& rect)
  74. fillRectSourceOver(cr, rect, fillColor());
  75.  
  76. if (strokeStyle() != NoStroke) {
  77. - setColor(cr, strokeColor());
  78. + setSourceRGBAFromColor(cr, strokeColor());
  79. FloatRect r(rect);
  80. r.inflate(-.5f);
  81. cairo_rectangle(cr, r.x(), r.y(), r.width(), r.height());
  82. @@ -310,7 +303,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
  83. break;
  84. }
  85.  
  86. - setColor(cr, strokeColor());
  87. + setSourceRGBAFromColor(cr, strokeColor());
  88.  
  89. cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
  90.  
  91. @@ -380,12 +373,12 @@ void GraphicsContext::drawEllipse(const IntRect& rect)
  92. cairo_restore(cr);
  93.  
  94. if (fillColor().alpha()) {
  95. - setColor(cr, fillColor());
  96. + setSourceRGBAFromColor(cr, fillColor());
  97. cairo_fill_preserve(cr);
  98. }
  99.  
  100. if (strokeStyle() != NoStroke) {
  101. - setColor(cr, strokeColor());
  102. + setSourceRGBAFromColor(cr, strokeColor());
  103. cairo_set_line_width(cr, strokeThickness());
  104. cairo_stroke(cr);
  105. } else
  106. @@ -434,7 +427,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
  107. break;
  108. }
  109.  
  110. - setColor(cr, strokeColor());
  111. + setSourceRGBAFromColor(cr, strokeColor());
  112.  
  113. if (patWidth) {
  114. // Example: 80 pixels with a width of 30 pixels.
  115. @@ -493,13 +486,13 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
  116. addConvexPolygonToContext(cr, npoints, points);
  117.  
  118. if (fillColor().alpha()) {
  119. - setColor(cr, fillColor());
  120. + setSourceRGBAFromColor(cr, fillColor());
  121. cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
  122. cairo_fill_preserve(cr);
  123. }
  124.  
  125. if (strokeStyle() != NoStroke) {
  126. - setColor(cr, strokeColor());
  127. + setSourceRGBAFromColor(cr, strokeColor());
  128. cairo_set_line_width(cr, strokeThickness());
  129. cairo_stroke(cr);
  130. } else
  131. @@ -640,7 +633,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
  132. cairo_region_destroy(reg);
  133. #endif
  134.  
  135. - setColor(cr, color);
  136. + setSourceRGBAFromColor(cr, color);
  137. cairo_set_line_width(cr, 2.0f);
  138. setPlatformStrokeStyle(DottedStroke);
  139. #else
  140. @@ -655,7 +648,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
  141.  
  142. // Force the alpha to 50%. This matches what the Mac does with outline rings.
  143. Color ringColor(color.red(), color.green(), color.blue(), 127);
  144. - setColor(cr, ringColor);
  145. + setSourceRGBAFromColor(cr, ringColor);
  146. cairo_set_line_width(cr, width);
  147. setPlatformStrokeStyle(SolidStroke);
  148. #endif
  149. @@ -1069,7 +1062,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft,
  150. Path path;
  151. path.addRoundedRect(r, topLeft, topRight, bottomLeft, bottomRight);
  152. appendWebCorePathToCairoContext(cr, path);
  153. - setColor(cr, color);
  154. + setSourceRGBAFromColor(cr, color);
  155. cairo_fill(cr);
  156. cairo_restore(cr);
  157. }
Add Comment
Please, Sign In to add comment