| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void setAlphaAsFloat(float alpha) { mutableState()->setAlphaAsFloat(alpha);} | 174 void setAlphaAsFloat(float alpha) { mutableState()->setAlphaAsFloat(alpha);} |
| 175 int getNormalizedAlpha() const | 175 int getNormalizedAlpha() const |
| 176 { | 176 { |
| 177 int alpha = immutableState()->alpha(); | 177 int alpha = immutableState()->alpha(); |
| 178 return alpha > 255 ? 255 : alpha; | 178 return alpha > 255 ? 255 : alpha; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } | 181 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta
te()->setInterpolationQuality(quality); } |
| 182 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } | 182 InterpolationQuality imageInterpolationQuality() const { return immutableSta
te()->interpolationQuality(); } |
| 183 | 183 |
| 184 void setCompositeOperation(CompositeOperator, blink::WebBlendMode = blink::W
ebBlendModeNormal); | 184 void setCompositeOperation(CompositeOperator, WebBlendMode = WebBlendModeNor
mal); |
| 185 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } | 185 CompositeOperator compositeOperation() const { return immutableState()->comp
ositeOperator(); } |
| 186 blink::WebBlendMode blendModeOperation() const { return immutableState()->bl
endMode(); } | 186 WebBlendMode blendModeOperation() const { return immutableState()->blendMode
(); } |
| 187 | 187 |
| 188 // Speicy the device scale factor which may change the way document markers | 188 // Speicy the device scale factor which may change the way document markers |
| 189 // and fonts are rendered. | 189 // and fonts are rendered. |
| 190 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } | 190 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } |
| 191 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 191 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
| 192 | 192 |
| 193 // If true we are (most likely) rendering to a web page and the | 193 // If true we are (most likely) rendering to a web page and the |
| 194 // canvas has been prepared with an opaque background. If false, | 194 // canvas has been prepared with an opaque background. If false, |
| 195 // the canvas may have transparency (as is the case when rendering | 195 // the canvas may have transparency (as is the case when rendering |
| 196 // to a canvas object). | 196 // to a canvas object). |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void fillBetweenRoundedRects(const IntRect&, const IntSize& outerTopLeft, co
nst IntSize& outerTopRight, const IntSize& outerBottomLeft, const IntSize& outer
BottomRight, | 266 void fillBetweenRoundedRects(const IntRect&, const IntSize& outerTopLeft, co
nst IntSize& outerTopRight, const IntSize& outerBottomLeft, const IntSize& outer
BottomRight, |
| 267 const IntRect&, const IntSize& innerTopLeft, const IntSize& innerTopRigh
t, const IntSize& innerBottomLeft, const IntSize& innerBottomRight, const Color&
); | 267 const IntRect&, const IntSize& innerTopLeft, const IntSize& innerTopRigh
t, const IntSize& innerBottomLeft, const IntSize& innerBottomRight, const Color&
); |
| 268 void fillBetweenRoundedRects(const RoundedRect&, const RoundedRect&, const C
olor&); | 268 void fillBetweenRoundedRects(const RoundedRect&, const RoundedRect&, const C
olor&); |
| 269 | 269 |
| 270 void drawDisplayList(DisplayList*); | 270 void drawDisplayList(DisplayList*); |
| 271 | 271 |
| 272 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 272 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO
ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 273 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 273 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv
er, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 274 void drawImage(Image*, const FloatRect& destRect); | 274 void drawImage(Image*, const FloatRect& destRect); |
| 275 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation); | 275 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp
ectImageOrientation); |
| 276 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum = DoNotRespe
ctImageOrientation); | 276 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator, WebBlendMode, RespectImageOrientationEnum = DoNotRespectImage
Orientation); |
| 277 | 277 |
| 278 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin
t, const IntSize& tileSize, | 278 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin
t, const IntSize& tileSize, |
| 279 CompositeOperator = CompositeSourceOver, blink::WebBlendMode = blink::We
bBlendModeNormal, const IntSize& repeatSpacing = IntSize()); | 279 CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlendModeNorm
al, const IntSize& repeatSpacing = IntSize()); |
| 280 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, | 280 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, |
| 281 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch
Tile, Image::TileRule vRule = Image::StretchTile, | 281 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch
Tile, Image::TileRule vRule = Image::StretchTile, |
| 282 CompositeOperator = CompositeSourceOver); | 282 CompositeOperator = CompositeSourceOver); |
| 283 | 283 |
| 284 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec
t* srcRect = 0, CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlend
ModeNormal); | 284 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec
t* srcRect = 0, CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlend
ModeNormal); |
| 285 | 285 |
| 286 void drawPicture(PassRefPtr<SkPicture>, const FloatRect& dest, const FloatRe
ct& src, CompositeOperator, blink::WebBlendMode); | 286 void drawPicture(PassRefPtr<SkPicture>, const FloatRect& dest, const FloatRe
ct& src, CompositeOperator, WebBlendMode); |
| 287 | 287 |
| 288 // These methods write to the canvas and modify the opaque region, if tracke
d. | 288 // These methods write to the canvas and modify the opaque region, if tracke
d. |
| 289 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou
ndedRect | 289 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou
ndedRect |
| 290 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); | 290 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); |
| 291 void writePixels(const SkBitmap&, int x, int y); | 291 void writePixels(const SkBitmap&, int x, int y); |
| 292 void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0); | 292 void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0); |
| 293 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP
aint* = 0); | 293 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP
aint* = 0); |
| 294 void drawOval(const SkRect&, const SkPaint&); | 294 void drawOval(const SkRect&, const SkPaint&); |
| 295 void drawPath(const SkPath&, const SkPaint&); | 295 void drawPath(const SkPath&, const SkPaint&); |
| 296 // After drawing directly to the context's canvas, use this function to noti
fy the context so | 296 // After drawing directly to the context's canvas, use this function to noti
fy the context so |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); | 397 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); |
| 398 | 398 |
| 399 void beginAnnotation(const AnnotationList&); | 399 void beginAnnotation(const AnnotationList&); |
| 400 void endAnnotation(); | 400 void endAnnotation(); |
| 401 | 401 |
| 402 void preparePaintForDrawRectToRect( | 402 void preparePaintForDrawRectToRect( |
| 403 SkPaint*, | 403 SkPaint*, |
| 404 const SkRect& srcRect, | 404 const SkRect& srcRect, |
| 405 const SkRect& destRect, | 405 const SkRect& destRect, |
| 406 CompositeOperator, | 406 CompositeOperator, |
| 407 blink::WebBlendMode, | 407 WebBlendMode, |
| 408 bool isLazyDecoded = false, | 408 bool isLazyDecoded = false, |
| 409 bool isDataComplete = true) const; | 409 bool isDataComplete = true) const; |
| 410 | 410 |
| 411 static int focusRingOutsetExtent(int offset, int width) | 411 static int focusRingOutsetExtent(int offset, int width) |
| 412 { | 412 { |
| 413 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; | 413 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; |
| 414 } | 414 } |
| 415 | 415 |
| 416 private: | 416 private: |
| 417 const GraphicsContextState* immutableState() const { return m_paintState; } | 417 const GraphicsContextState* immutableState() const { return m_paintState; } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 bool m_accelerated : 1; | 534 bool m_accelerated : 1; |
| 535 bool m_isCertainlyOpaque : 1; | 535 bool m_isCertainlyOpaque : 1; |
| 536 bool m_printing : 1; | 536 bool m_printing : 1; |
| 537 bool m_antialiasHairlineImages : 1; | 537 bool m_antialiasHairlineImages : 1; |
| 538 }; | 538 }; |
| 539 | 539 |
| 540 } // namespace blink | 540 } // namespace blink |
| 541 | 541 |
| 542 #endif // GraphicsContext_h | 542 #endif // GraphicsContext_h |
| OLD | NEW |