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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp

Issue 2157953002: Change filter quality when scaling-down in drawImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/PaintGeneratedImage.h" 5 #include "platform/graphics/PaintGeneratedImage.h"
6 6
7 #include "platform/geometry/FloatRect.h" 7 #include "platform/geometry/FloatRect.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "third_party/skia/include/core/SkPicture.h" 9 #include "third_party/skia/include/core/SkPicture.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 void PaintGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const Flo atRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageCl ampingMode) 13 void PaintGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const Flo atRect& destRect, const FloatRect& srcRect, bool imageSmoothingEnabled, RespectI mageOrientationEnum, ImageClampingMode)
14 { 14 {
15 SkAutoCanvasRestore ar(canvas, true); 15 SkAutoCanvasRestore ar(canvas, true);
16 canvas->clipRect(destRect); 16 canvas->clipRect(destRect);
17 canvas->translate(destRect.x(), destRect.y()); 17 canvas->translate(destRect.x(), destRect.y());
18 if (destRect.size() != srcRect.size()) 18 if (destRect.size() != srcRect.size())
19 canvas->scale(destRect.width() / srcRect.width(), destRect.height() / sr cRect.height()); 19 canvas->scale(destRect.width() / srcRect.width(), destRect.height() / sr cRect.height());
20 canvas->translate(-srcRect.x(), -srcRect.y()); 20 canvas->translate(-srcRect.x(), -srcRect.y());
21 canvas->drawPicture(m_picture.get(), nullptr, &paint); 21
22 SkPaint adjustedPaint = paint;
23 if (!imageSmoothingEnabled && Image::isDrawScalingDown(srcRect, destRect))
24 adjustedPaint.setFilterQuality(kLow_SkFilterQuality);
25
26 canvas->drawPicture(m_picture.get(), nullptr, &adjustedPaint);
22 } 27 }
23 28
24 void PaintGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& sr cRect) 29 void PaintGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& sr cRect)
25 { 30 {
26 context.drawPicture(m_picture.get()); 31 context.drawPicture(m_picture.get());
27 } 32 }
28 33
29 } // namespace blink 34 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698