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

Unified Diff: Source/platform/graphics/skia/SkiaUtils.cpp

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: apllied senorblanco feedback Created 5 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: Source/platform/graphics/skia/SkiaUtils.cpp
diff --git a/Source/platform/graphics/skia/SkiaUtils.cpp b/Source/platform/graphics/skia/SkiaUtils.cpp
index 0abeb31c85df163d69304e29a81d8b3e93bd60a4..964257aa6afdc1330fba813662a3dc61a5967a81 100644
--- a/Source/platform/graphics/skia/SkiaUtils.cpp
+++ b/Source/platform/graphics/skia/SkiaUtils.cpp
@@ -330,36 +330,6 @@ InterpolationQuality computeInterpolationQuality(
return InterpolationLow;
}
-
-bool shouldDrawAntiAliased(const GraphicsContext* context, const SkRect& destRect)
-{
- if (!context->shouldAntialias())
- return false;
- const SkMatrix totalMatrix = context->getTotalMatrix();
- // Don't disable anti-aliasing if we're rotated or skewed.
- if (!totalMatrix.rectStaysRect())
- return true;
- // Disable anti-aliasing for scales or n*90 degree rotations.
- // Allow to opt out of the optimization though for "hairline" geometry
- // images - using the shouldAntialiasHairlineImages() GraphicsContext flag.
- if (!context->shouldAntialiasHairlineImages())
- return false;
- // Check if the dimensions of the destination are "small" (less than one
- // device pixel). To prevent sudden drop-outs. Since we know that
- // kRectStaysRect_Mask is set, the matrix either has scale and no skew or
- // vice versa. We can query the kAffine_Mask flag to determine which case
- // it is.
- // FIXME: This queries the CTM while drawing, which is generally
- // discouraged. Always drawing with AA can negatively impact performance
- // though - that's why it's not always on.
- SkScalar widthExpansion, heightExpansion;
- if (totalMatrix.getType() & SkMatrix::kAffine_Mask)
- widthExpansion = totalMatrix[SkMatrix::kMSkewY], heightExpansion = totalMatrix[SkMatrix::kMSkewX];
- else
- widthExpansion = totalMatrix[SkMatrix::kMScaleX], heightExpansion = totalMatrix[SkMatrix::kMScaleY];
- return destRect.width() * fabs(widthExpansion) < 1 || destRect.height() * fabs(heightExpansion) < 1;
-}
-
int clampedAlphaForBlending(float alpha)
{
if (alpha < 0)

Powered by Google App Engine
This is Rietveld 408576698