OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // fixed (e.g. when drawing to context backed by an ImageBuffer). | 158 // fixed (e.g. when drawing to context backed by an ImageBuffer). |
159 void disableAntialiasingOptimizationForHairlineImages() { ASSERT(!isRecordin
g()); m_antialiasHairlineImages = true; } | 159 void disableAntialiasingOptimizationForHairlineImages() { ASSERT(!isRecordin
g()); m_antialiasHairlineImages = true; } |
160 bool shouldAntialiasHairlineImages() const { return m_antialiasHairlineImage
s; } | 160 bool shouldAntialiasHairlineImages() const { return m_antialiasHairlineImage
s; } |
161 | 161 |
162 void setShouldClampToSourceRect(bool clampToSourceRect) { mutableState()->se
tShouldClampToSourceRect(clampToSourceRect); } | 162 void setShouldClampToSourceRect(bool clampToSourceRect) { mutableState()->se
tShouldClampToSourceRect(clampToSourceRect); } |
163 bool shouldClampToSourceRect() const { return immutableState()->shouldClampT
oSourceRect(); } | 163 bool shouldClampToSourceRect() const { return immutableState()->shouldClampT
oSourceRect(); } |
164 | 164 |
165 // FIXME: the setter is only used once, at construction time; convert to a c
onstructor param, | 165 // FIXME: the setter is only used once, at construction time; convert to a c
onstructor param, |
166 // and possibly consolidate with other flags (paintDisabled, isPrinting, ...
) | 166 // and possibly consolidate with other flags (paintDisabled, isPrinting, ...
) |
167 void setShouldSmoothFonts(bool smoothFonts) { m_shouldSmoothFonts = smoothFo
nts; } | 167 void setShouldSmoothFonts(bool smoothFonts) { m_shouldSmoothFonts = smoothFo
nts; } |
168 bool shouldSmoothFonts() const { return m_shouldSmoothFonts; } | |
169 | 168 |
170 // Turn off LCD text for the paint if not supported on this context. | 169 // Turn off LCD text for the paint if not supported on this context. |
171 void adjustTextRenderMode(SkPaint*); | 170 void adjustTextRenderMode(SkPaint*); |
172 bool couldUseLCDRenderedText(); | 171 bool couldUseLCDRenderedText() const { return m_isCertainlyOpaque && m_shoul
dSmoothFonts; } |
173 | 172 |
174 void setTextDrawingMode(TextDrawingModeFlags mode) { mutableState()->setText
DrawingMode(mode); } | 173 void setTextDrawingMode(TextDrawingModeFlags mode) { mutableState()->setText
DrawingMode(mode); } |
175 TextDrawingModeFlags textDrawingMode() const { return immutableState()->text
DrawingMode(); } | 174 TextDrawingModeFlags textDrawingMode() const { return immutableState()->text
DrawingMode(); } |
176 | 175 |
177 void setAlphaAsFloat(float alpha) { mutableState()->setAlphaAsFloat(alpha);} | 176 void setAlphaAsFloat(float alpha) { mutableState()->setAlphaAsFloat(alpha);} |
178 int getNormalizedAlpha() const | 177 int getNormalizedAlpha() const |
179 { | 178 { |
180 int alpha = immutableState()->alpha(); | 179 int alpha = immutableState()->alpha(); |
181 return alpha > 255 ? 255 : alpha; | 180 return alpha > 255 ? 255 : alpha; |
182 } | 181 } |
183 | 182 |
184 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } | 183 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } |
185 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } | 184 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } |
186 | 185 |
187 void setCompositeOperation(CompositeOperator, WebBlendMode = WebBlendModeNor
mal); | 186 void setCompositeOperation(CompositeOperator, WebBlendMode = WebBlendModeNor
mal); |
188 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } | 187 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } |
189 WebBlendMode blendModeOperation() const { return immutableState()->blendMode
(); } | 188 WebBlendMode blendModeOperation() const { return immutableState()->blendMode
(); } |
190 | 189 |
191 // Speicy the device scale factor which may change the way document markers | 190 // Speicy the device scale factor which may change the way document markers |
192 // and fonts are rendered. | 191 // and fonts are rendered. |
193 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } | 192 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } |
194 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 193 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
195 | 194 |
196 // If true we are (most likely) rendering to a web page and the | 195 // If true we are (most likely) rendering to a web page and the |
197 // canvas has been prepared with an opaque background. If false, | 196 // canvas has been prepared with an opaque background. If false, |
198 // the canvas may have transparency (as is the case when rendering | 197 // the canvas may have transparency (as is the case when rendering |
199 // to a canvas object). | 198 // to a canvas object). |
200 void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; } | 199 void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; } |
201 bool isCertainlyOpaque() const { return m_isCertainlyOpaque; } | |
202 | 200 |
203 bool isAccelerated() const { return m_accelerated; } | 201 bool isAccelerated() const { return m_accelerated; } |
204 void setAccelerated(bool accelerated) { m_accelerated = accelerated; } | 202 void setAccelerated(bool accelerated) { m_accelerated = accelerated; } |
205 | 203 |
206 // The opaque region is empty until tracking is turned on. | 204 // The opaque region is empty until tracking is turned on. |
207 // It is never clerared by the context. | 205 // It is never clerared by the context. |
208 enum RegionTrackingMode { | 206 enum RegionTrackingMode { |
209 RegionTrackingDisabled = 0, | 207 RegionTrackingDisabled = 0, |
210 RegionTrackingOpaque, | 208 RegionTrackingOpaque, |
211 RegionTrackingOverwrite | 209 RegionTrackingOverwrite |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 520 |
523 bool m_accelerated : 1; | 521 bool m_accelerated : 1; |
524 bool m_isCertainlyOpaque : 1; | 522 bool m_isCertainlyOpaque : 1; |
525 bool m_antialiasHairlineImages : 1; | 523 bool m_antialiasHairlineImages : 1; |
526 bool m_shouldSmoothFonts : 1; | 524 bool m_shouldSmoothFonts : 1; |
527 }; | 525 }; |
528 | 526 |
529 } // namespace blink | 527 } // namespace blink |
530 | 528 |
531 #endif // SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ | 529 #endif // SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ |
OLD | NEW |