| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 24 * THE POSSIBILITY OF SUCH DAMAGE. | 24 * THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/platform/graphics/GraphicsContext.h" | 28 #include "platform/graphics/GraphicsContext.h" |
| 29 | 29 |
| 30 #include "core/platform/graphics/BitmapImage.h" | |
| 31 #include "core/platform/graphics/Gradient.h" | |
| 32 #include "platform/geometry/IntRect.h" | 30 #include "platform/geometry/IntRect.h" |
| 33 #include "platform/geometry/RoundedRect.h" | 31 #include "platform/geometry/RoundedRect.h" |
| 32 #include "platform/graphics/BitmapImage.h" |
| 34 #include "platform/graphics/DisplayList.h" | 33 #include "platform/graphics/DisplayList.h" |
| 34 #include "platform/graphics/Gradient.h" |
| 35 #include "platform/graphics/TextRunIterator.h" | 35 #include "platform/graphics/TextRunIterator.h" |
| 36 #include "platform/text/BidiResolver.h" | 36 #include "platform/text/BidiResolver.h" |
| 37 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
| 38 #include "third_party/skia/include/core/SkAnnotation.h" | 38 #include "third_party/skia/include/core/SkAnnotation.h" |
| 39 #include "third_party/skia/include/core/SkColorFilter.h" | 39 #include "third_party/skia/include/core/SkColorFilter.h" |
| 40 #include "third_party/skia/include/core/SkData.h" | 40 #include "third_party/skia/include/core/SkData.h" |
| 41 #include "third_party/skia/include/core/SkPicture.h" | 41 #include "third_party/skia/include/core/SkPicture.h" |
| 42 #include "third_party/skia/include/core/SkRRect.h" | 42 #include "third_party/skia/include/core/SkRRect.h" |
| 43 #include "third_party/skia/include/core/SkRefCnt.h" | 43 #include "third_party/skia/include/core/SkRefCnt.h" |
| 44 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" | 44 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 void GraphicsContext::restoreLayer() | 171 void GraphicsContext::restoreLayer() |
| 172 { | 172 { |
| 173 if (paintingDisabled()) | 173 if (paintingDisabled()) |
| 174 return; | 174 return; |
| 175 | 175 |
| 176 m_canvas->restore(); | 176 m_canvas->restore(); |
| 177 if (m_trackOpaqueRegion) | 177 if (m_trackOpaqueRegion) |
| 178 m_opaqueRegion.popCanvasLayer(this); | 178 m_opaqueRegion.popCanvasLayer(this); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void GraphicsContext::beginAnnotation(const GraphicsContextAnnotation& annotatio
n) | 181 void GraphicsContext::beginAnnotation(const char* rendererName, const char* pain
tPhase, |
| 182 const String& elementId, const String& elementClass, const String& elementTa
g) |
| 182 { | 183 { |
| 183 if (paintingDisabled()) | 184 if (paintingDisabled()) |
| 184 return; | 185 return; |
| 185 | 186 |
| 186 canvas()->beginCommentGroup("GraphicsContextAnnotation"); | 187 canvas()->beginCommentGroup("GraphicsContextAnnotation"); |
| 187 | 188 |
| 189 GraphicsContextAnnotation annotation(rendererName, paintPhase, elementId, el
ementClass, elementTag); |
| 188 AnnotationList annotations; | 190 AnnotationList annotations; |
| 189 annotation.asAnnotationList(annotations); | 191 annotation.asAnnotationList(annotations); |
| 190 | 192 |
| 191 AnnotationList::const_iterator end = annotations.end(); | 193 AnnotationList::const_iterator end = annotations.end(); |
| 192 for (AnnotationList::const_iterator it = annotations.begin(); it != end; ++i
t) | 194 for (AnnotationList::const_iterator it = annotations.begin(); it != end; ++i
t) |
| 193 canvas()->addComment(it->first, it->second.ascii().data()); | 195 canvas()->addComment(it->first, it->second.ascii().data()); |
| 194 | 196 |
| 195 #if !ASSERT_DISABLED | 197 #if !ASSERT_DISABLED |
| 196 ++m_annotationCount; | 198 ++m_annotationCount; |
| 197 #endif | 199 #endif |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 case ColorFilterNone: | 1838 case ColorFilterNone: |
| 1837 break; | 1839 break; |
| 1838 default: | 1840 default: |
| 1839 ASSERT_NOT_REACHED(); | 1841 ASSERT_NOT_REACHED(); |
| 1840 break; | 1842 break; |
| 1841 } | 1843 } |
| 1842 | 1844 |
| 1843 return 0; | 1845 return 0; |
| 1844 } | 1846 } |
| 1845 | 1847 |
| 1846 | |
| 1847 #if OS(MACOSX) | 1848 #if OS(MACOSX) |
| 1848 CGColorSpaceRef deviceRGBColorSpaceRef() | 1849 CGColorSpaceRef PLATFORM_EXPORT deviceRGBColorSpaceRef() |
| 1849 { | 1850 { |
| 1850 static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB(); | 1851 static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB(); |
| 1851 return deviceSpace; | 1852 return deviceSpace; |
| 1852 } | 1853 } |
| 1853 #else | 1854 #else |
| 1854 void GraphicsContext::draw2xMarker(SkBitmap* bitmap, int index) | 1855 void GraphicsContext::draw2xMarker(SkBitmap* bitmap, int index) |
| 1855 { | 1856 { |
| 1856 const SkPMColor lineColor = lineColors(index); | 1857 const SkPMColor lineColor = lineColors(index); |
| 1857 const SkPMColor antiColor1 = antiColors1(index); | 1858 const SkPMColor antiColor1 = antiColors1(index); |
| 1858 const SkPMColor antiColor2 = antiColors2(index); | 1859 const SkPMColor antiColor2 = antiColors2(index); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 | 1966 |
| 1966 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1967 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
| 1967 { | 1968 { |
| 1968 if (m_trackTextRegion) { | 1969 if (m_trackTextRegion) { |
| 1969 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); | 1970 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); |
| 1970 m_textRegion.join(textRect); | 1971 m_textRegion.join(textRect); |
| 1971 } | 1972 } |
| 1972 } | 1973 } |
| 1973 | 1974 |
| 1974 } | 1975 } |
| OLD | NEW |