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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return alpha > 255 ? 255 : alpha; | 171 return alpha > 255 ? 255 : alpha; |
172 } | 172 } |
173 | 173 |
174 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } | 174 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } |
175 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } | 175 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } |
176 | 176 |
177 void setCompositeOperation(CompositeOperator, WebBlendMode = WebBlendModeNor
mal); | 177 void setCompositeOperation(CompositeOperator, WebBlendMode = WebBlendModeNor
mal); |
178 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } | 178 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } |
179 WebBlendMode blendModeOperation() const { return immutableState()->blendMode
(); } | 179 WebBlendMode blendModeOperation() const { return immutableState()->blendMode
(); } |
180 | 180 |
181 // Speicy the device scale factor which may change the way document markers | 181 // Specify the device scale factor which may change the way document markers |
182 // and fonts are rendered. | 182 // and fonts are rendered. |
183 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } | 183 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } |
184 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 184 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
185 | 185 |
186 // If true we are (most likely) rendering to a web page and the | 186 // If true we are (most likely) rendering to a web page and the |
187 // canvas has been prepared with an opaque background. If false, | 187 // canvas has been prepared with an opaque background. If false, |
188 // the canvas may have transparency (as is the case when rendering | 188 // the canvas may have transparency (as is the case when rendering |
189 // to a canvas object). | 189 // to a canvas object). |
190 void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; } | 190 void setCertainlyOpaque(bool isOpaque) { m_isCertainlyOpaque = isOpaque; } |
191 bool isCertainlyOpaque() const { return m_isCertainlyOpaque; } | 191 bool isCertainlyOpaque() const { return m_isCertainlyOpaque; } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // which is not the final transform used to place content on screen. It cann
ot be relied upon | 368 // which is not the final transform used to place content on screen. It cann
ot be relied upon |
369 // for testing where a point will appear on screen or how large it will be. | 369 // for testing where a point will appear on screen or how large it will be. |
370 AffineTransform getCTM() const; | 370 AffineTransform getCTM() const; |
371 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } | 371 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa
trix(affine)); } |
372 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } | 372 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa
trix(affine)); } |
373 void setMatrix(const SkMatrix&); | 373 void setMatrix(const SkMatrix&); |
374 | 374 |
375 void scale(float x, float y); | 375 void scale(float x, float y); |
376 void rotate(float angleInRadians); | 376 void rotate(float angleInRadians); |
377 void translate(float x, float y); | 377 void translate(float x, float y); |
378 | |
379 // This function applies the device scale factor to the context, making the
context capable of | |
380 // acting as a base-level context for a HiDPI environment. | |
381 void applyDeviceScaleFactor(float deviceScaleFactor) { scale(deviceScaleFact
or, deviceScaleFactor); } | |
382 // ---------- End transformation methods ----------------- | 378 // ---------- End transformation methods ----------------- |
383 | 379 |
384 // URL drawing | 380 // URL drawing |
385 void setURLForRect(const KURL&, const IntRect&); | 381 void setURLForRect(const KURL&, const IntRect&); |
386 void setURLFragmentForRect(const String& name, const IntRect&); | 382 void setURLFragmentForRect(const String& name, const IntRect&); |
387 void addURLTargetAtPoint(const String& name, const IntPoint&); | 383 void addURLTargetAtPoint(const String& name, const IntPoint&); |
388 | 384 |
389 // Create an image buffer compatible with this context, with suitable resolu
tion | 385 // Create an image buffer compatible with this context, with suitable resolu
tion |
390 // for drawing into the buffer and then into this context. | 386 // for drawing into the buffer and then into this context. |
391 PassOwnPtr<ImageBuffer> createRasterBuffer(const IntSize&, OpacityMode = Non
Opaque) const; | 387 PassOwnPtr<ImageBuffer> createRasterBuffer(const IntSize&, OpacityMode = Non
Opaque) const; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 unsigned m_accelerated : 1; | 516 unsigned m_accelerated : 1; |
521 unsigned m_isCertainlyOpaque : 1; | 517 unsigned m_isCertainlyOpaque : 1; |
522 unsigned m_printing : 1; | 518 unsigned m_printing : 1; |
523 unsigned m_antialiasHairlineImages : 1; | 519 unsigned m_antialiasHairlineImages : 1; |
524 unsigned m_shouldSmoothFonts : 1; | 520 unsigned m_shouldSmoothFonts : 1; |
525 }; | 521 }; |
526 | 522 |
527 } // namespace blink | 523 } // namespace blink |
528 | 524 |
529 #endif // GraphicsContext_h | 525 #endif // GraphicsContext_h |
OLD | NEW |