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

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

Issue 724063004: Simplify GraphicsContext::couldUseLCDRenderedText() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: let's cut deeper Created 6 years, 1 month 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 | « Source/platform/graphics/GraphicsContext.h ('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 /* 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 { 412 {
413 if (contextDisabled()) 413 if (contextDisabled())
414 return; 414 return;
415 415
416 if (!paint->isLCDRenderText()) 416 if (!paint->isLCDRenderText())
417 return; 417 return;
418 418
419 paint->setLCDRenderText(couldUseLCDRenderedText()); 419 paint->setLCDRenderText(couldUseLCDRenderedText());
420 } 420 }
421 421
422 bool GraphicsContext::couldUseLCDRenderedText() const
423 {
424 ASSERT(m_canvas);
425 // Our layers only have a single alpha channel. This means that subpixel
426 // rendered text cannot be composited correctly when the layer is
427 // collapsed. Therefore, subpixel text is contextDisabled when we are drawin g
428 // onto a layer.
429 if (contextDisabled() || m_canvas->isDrawingToLayer() || !isCertainlyOpaque( ))
430 return false;
431
432 return shouldSmoothFonts();
433 }
434
435 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation , WebBlendMode blendMode) 422 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation , WebBlendMode blendMode)
436 { 423 {
437 if (contextDisabled()) 424 if (contextDisabled())
438 return; 425 return;
439 mutableState()->setCompositeOperation(compositeOperation, blendMode); 426 mutableState()->setCompositeOperation(compositeOperation, blendMode);
440 } 427 }
441 428
442 SkColorFilter* GraphicsContext::colorFilter() const 429 SkColorFilter* GraphicsContext::colorFilter() const
443 { 430 {
444 return immutableState()->colorFilter(); 431 return immutableState()->colorFilter();
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 // FIXME: This is to not break tests (it results in the filter bitmap fl ag 2047 // FIXME: This is to not break tests (it results in the filter bitmap fl ag
2061 // being set to true). We need to decide if we respect InterpolationNone 2048 // being set to true). We need to decide if we respect InterpolationNone
2062 // being returned from computeInterpolationQuality. 2049 // being returned from computeInterpolationQuality.
2063 resampling = InterpolationLow; 2050 resampling = InterpolationLow;
2064 } 2051 }
2065 resampling = limitInterpolationQuality(this, resampling); 2052 resampling = limitInterpolationQuality(this, resampling);
2066 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); 2053 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling));
2067 } 2054 }
2068 2055
2069 } // namespace blink 2056 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698