OLD | NEW |
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 { | 378 { |
379 if (contextDisabled()) | 379 if (contextDisabled()) |
380 return; | 380 return; |
381 | 381 |
382 if (!paint->isLCDRenderText()) | 382 if (!paint->isLCDRenderText()) |
383 return; | 383 return; |
384 | 384 |
385 paint->setLCDRenderText(couldUseLCDRenderedText()); | 385 paint->setLCDRenderText(couldUseLCDRenderedText()); |
386 } | 386 } |
387 | 387 |
388 bool GraphicsContext::couldUseLCDRenderedText() | |
389 { | |
390 // Our layers only have a single alpha channel. This means that subpixel | |
391 // rendered text cannot be composited correctly when the layer is | |
392 // collapsed. Therefore, subpixel text is contextDisabled when we are drawin
g | |
393 // onto a layer. | |
394 if (contextDisabled() || m_canvas->isDrawingToLayer() || !isCertainlyOpaque(
)) | |
395 return false; | |
396 | |
397 return shouldSmoothFonts(); | |
398 } | |
399 | |
400 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation
, WebBlendMode blendMode) | 388 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation
, WebBlendMode blendMode) |
401 { | 389 { |
402 if (contextDisabled()) | 390 if (contextDisabled()) |
403 return; | 391 return; |
404 mutableState()->setCompositeOperation(compositeOperation, blendMode); | 392 mutableState()->setCompositeOperation(compositeOperation, blendMode); |
405 } | 393 } |
406 | 394 |
407 SkColorFilter* GraphicsContext::colorFilter() const | 395 SkColorFilter* GraphicsContext::colorFilter() const |
408 { | 396 { |
409 return immutableState()->colorFilter(); | 397 return immutableState()->colorFilter(); |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1835 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1848 // being set to true). We need to decide if we respect InterpolationNone | 1836 // being set to true). We need to decide if we respect InterpolationNone |
1849 // being returned from computeInterpolationQuality. | 1837 // being returned from computeInterpolationQuality. |
1850 resampling = InterpolationLow; | 1838 resampling = InterpolationLow; |
1851 } | 1839 } |
1852 resampling = limitInterpolationQuality(this, resampling); | 1840 resampling = limitInterpolationQuality(this, resampling); |
1853 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); | 1841 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); |
1854 } | 1842 } |
1855 | 1843 |
1856 } // namespace blink | 1844 } // namespace blink |
OLD | NEW |