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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2DState.cpp

Issue 1176073003: Improve filtering quality of images downsampled in 2d canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: re-add test 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 | « LayoutTests/fast/canvas/downsample-quality.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 6
7 #include "core/html/canvas/CanvasRenderingContext2DState.h" 7 #include "core/html/canvas/CanvasRenderingContext2DState.h"
8 8
9 #include "core/css/CSSFontSelector.h" 9 #include "core/css/CSSFontSelector.h"
10 #include "core/html/canvas/CanvasGradient.h" 10 #include "core/html/canvas/CanvasGradient.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 { 397 {
398 SkXfermode* xferMode = m_strokePaint.getXfermode(); 398 SkXfermode* xferMode = m_strokePaint.getXfermode();
399 SkXfermode::Mode mode; 399 SkXfermode::Mode mode;
400 if (!xferMode || !xferMode->asMode(&mode)) 400 if (!xferMode || !xferMode->asMode(&mode))
401 return SkXfermode::kSrcOver_Mode; 401 return SkXfermode::kSrcOver_Mode;
402 return mode; 402 return mode;
403 } 403 }
404 404
405 void CanvasRenderingContext2DState::setImageSmoothingEnabled(bool enabled) 405 void CanvasRenderingContext2DState::setImageSmoothingEnabled(bool enabled)
406 { 406 {
407 SkFilterQuality filterQuality = enabled ? kLow_SkFilterQuality : kNone_SkFil terQuality; 407 SkFilterQuality filterQuality = enabled ? kMedium_SkFilterQuality : kNone_Sk FilterQuality;
408 m_strokePaint.setFilterQuality(filterQuality); 408 m_strokePaint.setFilterQuality(filterQuality);
409 m_fillPaint.setFilterQuality(filterQuality); 409 m_fillPaint.setFilterQuality(filterQuality);
410 m_imagePaint.setFilterQuality(filterQuality); 410 m_imagePaint.setFilterQuality(filterQuality);
411 } 411 }
412 412
413 bool CanvasRenderingContext2DState::imageSmoothingEnabled() const 413 bool CanvasRenderingContext2DState::imageSmoothingEnabled() const
414 { 414 {
415 return m_imagePaint.getFilterQuality() == kLow_SkFilterQuality; 415 return m_imagePaint.getFilterQuality() == kMedium_SkFilterQuality;
416 } 416 }
417 417
418 bool CanvasRenderingContext2DState::shouldDrawShadows() const 418 bool CanvasRenderingContext2DState::shouldDrawShadows() const
419 { 419 {
420 return alphaChannel(m_shadowColor) && (m_shadowBlur || !m_shadowOffset.isZer o()); 420 return alphaChannel(m_shadowColor) && (m_shadowBlur || !m_shadowOffset.isZer o());
421 } 421 }
422 422
423 const SkPaint* CanvasRenderingContext2DState::getPaint(PaintType paintType, Shad owMode shadowMode, ImageType imageType) const 423 const SkPaint* CanvasRenderingContext2DState::getPaint(PaintType paintType, Shad owMode shadowMode, ImageType imageType) const
424 { 424 {
425 SkPaint* paint; 425 SkPaint* paint;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 paint->setLooper(0); 469 paint->setLooper(0);
470 paint->setImageFilter(shadowAndForegroundImageFilter()); 470 paint->setImageFilter(shadowAndForegroundImageFilter());
471 return paint; 471 return paint;
472 } 472 }
473 paint->setLooper(shadowAndForegroundDrawLooper()); 473 paint->setLooper(shadowAndForegroundDrawLooper());
474 paint->setImageFilter(0); 474 paint->setImageFilter(0);
475 return paint; 475 return paint;
476 } 476 }
477 477
478 } // blink 478 } // blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/downsample-quality.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698