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

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 1187473011: SP: Use a high-quality image filter regardless of CTM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 949 }
950 950
951 SkFilterQuality GraphicsContext::computeFilterQuality(Image* image, const FloatR ect& dest, const FloatRect& src) const 951 SkFilterQuality GraphicsContext::computeFilterQuality(Image* image, const FloatR ect& dest, const FloatRect& src) const
952 { 952 {
953 InterpolationQuality resampling; 953 InterpolationQuality resampling;
954 if (printing()) { 954 if (printing()) {
955 resampling = InterpolationNone; 955 resampling = InterpolationNone;
956 } else if (image->isLazyDecodedBitmap()) { 956 } else if (image->isLazyDecodedBitmap()) {
957 resampling = InterpolationHigh; 957 resampling = InterpolationHigh;
958 } else { 958 } else {
959 // Take into account scale applied to the canvas when computing sampling mode (e.g. CSS scale or page scale).
960 // FIXME: In slimming paint, we create GCs on the fly when entering a ne w DisplayItemList
961 // scope, so relying on getTotalMatrix here is not sound.
962 SkRect destRectTarget = dest; 959 SkRect destRectTarget = dest;
963 SkMatrix totalMatrix = getTotalMatrix(); 960 resampling = computeInterpolationQuality(
964 if (!(totalMatrix.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPersp ective_Mask)))
965 totalMatrix.mapRect(&destRectTarget, dest);
966
967 resampling = computeInterpolationQuality(totalMatrix,
968 SkScalarToFloat(src.width()), SkScalarToFloat(src.height()), 961 SkScalarToFloat(src.width()), SkScalarToFloat(src.height()),
969 SkScalarToFloat(destRectTarget.width()), SkScalarToFloat(destRectTar get.height()), 962 SkScalarToFloat(destRectTarget.width()), SkScalarToFloat(destRectTar get.height()),
970 image->isImmutableBitmap()); 963 image->isImmutableBitmap());
971 } 964 }
972 965
973 if (resampling == InterpolationNone) { 966 if (resampling == InterpolationNone) {
974 // FIXME: This is to not break tests (it results in the filter bitmap fl ag 967 // FIXME: This is to not break tests (it results in the filter bitmap fl ag
975 // being set to true). We need to decide if we respect InterpolationNone 968 // being set to true). We need to decide if we respect InterpolationNone
976 // being returned from computeInterpolationQuality. 969 // being returned from computeInterpolationQuality.
977 resampling = InterpolationLow; 970 resampling = InterpolationLow;
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 static const SkPMColor colors[] = { 1562 static const SkPMColor colors[] = {
1570 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red 1563 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red
1571 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray 1564 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray
1572 }; 1565 };
1573 1566
1574 return colors[index]; 1567 return colors[index];
1575 } 1568 }
1576 #endif 1569 #endif
1577 1570
1578 } // namespace blink 1571 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698