Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Unified Diff: third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp

Issue 1949253004: Rounded background image fast path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
index b4dff46a969ed0abb8b4b54df99ff6bffeec0ba8..6424659af0708a77c8695d49fddb540982ef4735 100644
--- a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
@@ -26,6 +26,7 @@
#include "platform/graphics/GradientGeneratedImage.h"
#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntSize.h"
#include "platform/graphics/GraphicsContext.h"
namespace blink {
@@ -52,4 +53,25 @@ void GradientGeneratedImage::drawTile(GraphicsContext& context, const FloatRect&
context.fillRect(srcRect);
}
+bool GradientGeneratedImage::applyShader(SkPaint& paint, const SkMatrix* localMatrix)
+{
+ AffineTransform transform;
+ if (localMatrix) {
+ transform.setMatrix(
+ localMatrix->getScaleX(), localMatrix->getSkewY(),
+ localMatrix->getSkewX(), localMatrix->getScaleY(),
+ localMatrix->getTranslateX(), localMatrix->getTranslateY());
+ }
+
+ DCHECK(m_gradient);
+ // TODO(fmalita): remove the transform from gradient/pattern state, and pass the matrix to
+ // applyToPaint if needed.
+ const AffineTransform previousTransform = m_gradient->gradientSpaceTransform();
+ m_gradient->setGradientSpaceTransform(transform);
+ m_gradient->applyToPaint(paint);
+ m_gradient->setGradientSpaceTransform(previousTransform);
+
+ return true;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698