| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 drawLooper.addShadow(offset, blur, color, shadowTransformMode, shadowAlphaMo
de); | 286 drawLooper.addShadow(offset, blur, color, shadowTransformMode, shadowAlphaMo
de); |
| 287 drawLooper.addUnmodifiedContent(); | 287 drawLooper.addUnmodifiedContent(); |
| 288 setDrawLooper(drawLooper); | 288 setDrawLooper(drawLooper); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void GraphicsContext::setDrawLooper(const DrawLooper& drawLooper) | 291 void GraphicsContext::setDrawLooper(const DrawLooper& drawLooper) |
| 292 { | 292 { |
| 293 if (paintingDisabled()) | 293 if (paintingDisabled()) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 setDrawLooper(drawLooper.skDrawLooper()); | 296 m_state->m_looper = drawLooper.skDrawLooper(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void GraphicsContext::clearDrawLooper() | 299 void GraphicsContext::clearDrawLooper() |
| 300 { | 300 { |
| 301 if (paintingDisabled()) | 301 if (paintingDisabled()) |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 setDrawLooper(0); | 304 m_state->m_looper.clear(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 bool GraphicsContext::hasShadow() const | 307 bool GraphicsContext::hasShadow() const |
| 308 { | 308 { |
| 309 return !!m_state->m_looper; | 309 return !!m_state->m_looper; |
| 310 } | 310 } |
| 311 | 311 |
| 312 int GraphicsContext::getNormalizedAlpha() const | 312 int GraphicsContext::getNormalizedAlpha() const |
| 313 { | 313 { |
| 314 int alpha = roundf(m_state->m_alpha * 256); | 314 int alpha = roundf(m_state->m_alpha * 256); |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 { | 1717 { |
| 1718 #if defined(SK_DEBUG) | 1718 #if defined(SK_DEBUG) |
| 1719 { | 1719 { |
| 1720 SkPaint defaultPaint; | 1720 SkPaint defaultPaint; |
| 1721 SkASSERT(*paint == defaultPaint); | 1721 SkASSERT(*paint == defaultPaint); |
| 1722 } | 1722 } |
| 1723 #endif | 1723 #endif |
| 1724 | 1724 |
| 1725 paint->setAntiAlias(m_state->m_shouldAntialias); | 1725 paint->setAntiAlias(m_state->m_shouldAntialias); |
| 1726 paint->setXfermodeMode(m_state->m_xferMode); | 1726 paint->setXfermodeMode(m_state->m_xferMode); |
| 1727 paint->setLooper(m_state->m_looper); | 1727 paint->setLooper(m_state->m_looper.get()); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 void GraphicsContext::drawOuterPath(const SkPath& path, SkPaint& paint, int widt
h) | 1730 void GraphicsContext::drawOuterPath(const SkPath& path, SkPaint& paint, int widt
h) |
| 1731 { | 1731 { |
| 1732 #if OS(DARWIN) | 1732 #if OS(DARWIN) |
| 1733 paint.setAlpha(64); | 1733 paint.setAlpha(64); |
| 1734 paint.setStrokeWidth(width); | 1734 paint.setStrokeWidth(width); |
| 1735 paint.setPathEffect(new SkCornerPathEffect((width - 1) * 0.5f))->unref(); | 1735 paint.setPathEffect(new SkCornerPathEffect((width - 1) * 0.5f))->unref(); |
| 1736 #else | 1736 #else |
| 1737 paint.setStrokeWidth(1); | 1737 paint.setStrokeWidth(1); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 | 1895 |
| 1896 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1896 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
| 1897 { | 1897 { |
| 1898 if (m_trackTextRegion) { | 1898 if (m_trackTextRegion) { |
| 1899 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); | 1899 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); |
| 1900 m_textRegion.join(textRect); | 1900 m_textRegion.join(textRect); |
| 1901 } | 1901 } |
| 1902 } | 1902 } |
| 1903 | 1903 |
| 1904 } | 1904 } |
| OLD | NEW |