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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 , m_paintStateStack() | 116 , m_paintStateStack() |
117 , m_paintStateIndex(0) | 117 , m_paintStateIndex(0) |
118 , m_pendingCanvasSave(false) | 118 , m_pendingCanvasSave(false) |
119 , m_annotationMode(0) | 119 , m_annotationMode(0) |
120 #if ENABLE(ASSERT) | 120 #if ENABLE(ASSERT) |
121 , m_annotationCount(0) | 121 , m_annotationCount(0) |
122 , m_layerCount(0) | 122 , m_layerCount(0) |
123 , m_disableDestructionChecks(false) | 123 , m_disableDestructionChecks(false) |
124 #endif | 124 #endif |
125 , m_disabledState(disableContextOrPainting) | 125 , m_disabledState(disableContextOrPainting) |
| 126 , m_deviceScaleFactor(1.0f) |
126 , m_trackOpaqueRegion(false) | 127 , m_trackOpaqueRegion(false) |
127 , m_trackTextRegion(false) | 128 , m_trackTextRegion(false) |
128 , m_useHighResMarker(false) | |
129 , m_updatingControlTints(false) | 129 , m_updatingControlTints(false) |
130 , m_accelerated(false) | 130 , m_accelerated(false) |
131 , m_isCertainlyOpaque(true) | 131 , m_isCertainlyOpaque(true) |
132 , m_printing(false) | 132 , m_printing(false) |
133 , m_antialiasHairlineImages(false) | 133 , m_antialiasHairlineImages(false) |
134 { | 134 { |
135 if (!canvas) | 135 if (!canvas) |
136 m_disabledState |= PaintingDisabled; | 136 m_disabledState |= PaintingDisabled; |
137 | 137 |
138 // FIXME: Do some tests to determine how many states are typically used, and
allocate | 138 // FIXME: Do some tests to determine how many states are typically used, and
allocate |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 if (m_trackOpaqueRegion) | 719 if (m_trackOpaqueRegion) |
720 m_opaqueRegion.didDrawPoints(this, SkCanvas::kLines_PointMode, 2, pts, p
aint); | 720 m_opaqueRegion.didDrawPoints(this, SkCanvas::kLines_PointMode, 2, pts, p
aint); |
721 } | 721 } |
722 | 722 |
723 void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& pt, float widt
h, DocumentMarkerLineStyle style) | 723 void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& pt, float widt
h, DocumentMarkerLineStyle style) |
724 { | 724 { |
725 if (contextDisabled()) | 725 if (contextDisabled()) |
726 return; | 726 return; |
727 | 727 |
728 int deviceScaleFactor = m_useHighResMarker ? 2 : 1; | 728 // Use 2x resources for a device scale factor of 1.5 or above. |
| 729 int deviceScaleFactor = m_deviceScaleFactor > 1.5f ? 2 : 1; |
729 | 730 |
730 // Create the pattern we'll use to draw the underline. | 731 // Create the pattern we'll use to draw the underline. |
731 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0; | 732 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0; |
732 static SkBitmap* misspellBitmap1x[2] = { 0, 0 }; | 733 static SkBitmap* misspellBitmap1x[2] = { 0, 0 }; |
733 static SkBitmap* misspellBitmap2x[2] = { 0, 0 }; | 734 static SkBitmap* misspellBitmap2x[2] = { 0, 0 }; |
734 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss
pellBitmap1x; | 735 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss
pellBitmap1x; |
735 if (!misspellBitmap[index]) { | 736 if (!misspellBitmap[index]) { |
736 #if OS(MACOSX) | 737 #if OS(MACOSX) |
737 // Match the artwork used by the Mac. | 738 // Match the artwork used by the Mac. |
738 const int rowPixels = 4 * deviceScaleFactor; | 739 const int rowPixels = 4 * deviceScaleFactor; |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 | 1827 |
1827 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1828 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
1828 { | 1829 { |
1829 if (m_trackTextRegion) { | 1830 if (m_trackTextRegion) { |
1830 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect"); | 1831 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect"); |
1831 m_textRegion.join(textRect); | 1832 m_textRegion.join(textRect); |
1832 } | 1833 } |
1833 } | 1834 } |
1834 | 1835 |
1835 } | 1836 } |
OLD | NEW |