Chromium Code Reviews| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 | 189 |
| 190 // These draw methods will do both stroking and filling. | 190 // These draw methods will do both stroking and filling. |
| 191 // FIXME: ...except drawRect(), which fills properly but always strokes | 191 // FIXME: ...except drawRect(), which fills properly but always strokes |
| 192 // using a 1-pixel stroke inset from the rect borders (of the correct | 192 // using a 1-pixel stroke inset from the rect borders (of the correct |
| 193 // stroke color). | 193 // stroke color). |
| 194 void drawRect(const IntRect&); | 194 void drawRect(const IntRect&); |
| 195 void drawLine(const IntPoint&, const IntPoint&); | 195 void drawLine(const IntPoint&, const IntPoint&); |
| 196 | 196 |
| 197 void fillPolygon(size_t numPoints, const FloatPoint*, const Color&, bool sho uldAntialias); | 197 void fillPolygon(size_t numPoints, const FloatPoint*, const Color&, bool sho uldAntialias); |
| 198 | 198 |
| 199 void fillPath(const Path&); | 199 void fillPath(const Path&, const SkPaint* = nullptr); |
|
fs
2015/04/02 15:01:47
This is a bit ugly, and only really to avoid addin
f(malita)
2015/04/02 15:23:00
Since the stroke/fill trait is specified on the Sk
fs
2015/04/07 12:03:56
Using the suggestion below.
| |
| 200 void strokePath(const Path&); | 200 void strokePath(const Path&, const SkPaint* = nullptr); |
| 201 | 201 |
| 202 void fillEllipse(const FloatRect&); | 202 void fillEllipse(const FloatRect&, const SkPaint* = nullptr); |
| 203 void strokeEllipse(const FloatRect&); | 203 void strokeEllipse(const FloatRect&, const SkPaint* = nullptr); |
| 204 | 204 |
| 205 void fillRect(const FloatRect&); | 205 void fillRect(const FloatRect&, const SkPaint* = nullptr); |
| 206 void fillRect(const FloatRect&, const Color&, SkXfermode::Mode = SkXfermode: :kSrcOver_Mode); | 206 void fillRect(const FloatRect&, const Color&, SkXfermode::Mode = SkXfermode: :kSrcOver_Mode); |
| 207 void fillRoundedRect(const FloatRect&, const FloatSize& topLeft, const Float Size& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color&); | 207 void fillRoundedRect(const FloatRect&, const FloatSize& topLeft, const Float Size& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color&); |
| 208 void fillRoundedRect(const FloatRoundedRect&, const Color&); | 208 void fillRoundedRect(const FloatRoundedRect&, const Color&); |
| 209 | 209 |
| 210 void clearRect(const FloatRect&); | 210 void clearRect(const FloatRect&); |
| 211 | 211 |
| 212 void strokeRect(const FloatRect&); | 212 void strokeRect(const FloatRect&); |
| 213 void strokeRect(const FloatRect&, float lineWidth); | 213 void strokeRect(const FloatRect&, float lineWidth); |
| 214 void strokeRect(const FloatRect&, const SkPaint&); | |
|
f(malita)
2015/04/02 15:31:57
Same comment for
fill/strokeRect -> drawRect
fill
| |
| 214 | 215 |
| 215 void fillBetweenRoundedRects(const FloatRect&, const FloatSize& outerTopLeft , const FloatSize& outerTopRight, const FloatSize& outerBottomLeft, const FloatS ize& outerBottomRight, | 216 void fillBetweenRoundedRects(const FloatRect&, const FloatSize& outerTopLeft , const FloatSize& outerTopRight, const FloatSize& outerBottomLeft, const FloatS ize& outerBottomRight, |
| 216 const FloatRect&, const FloatSize& innerTopLeft, const FloatSize& innerT opRight, const FloatSize& innerBottomLeft, const FloatSize& innerBottomRight, co nst Color&); | 217 const FloatRect&, const FloatSize& innerTopLeft, const FloatSize& innerT opRight, const FloatSize& innerBottomLeft, const FloatSize& innerBottomRight, co nst Color&); |
| 217 void fillBetweenRoundedRects(const FloatRoundedRect&, const FloatRoundedRect &, const Color&); | 218 void fillBetweenRoundedRects(const FloatRoundedRect&, const FloatRoundedRect &, const Color&); |
| 218 | 219 |
| 219 void drawPicture(const SkPicture*); | 220 void drawPicture(const SkPicture*); |
| 220 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr c, SkXfermode::Mode); | 221 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr c, SkXfermode::Mode); |
| 221 | 222 |
| 222 void drawImage(Image*, const IntPoint&, SkXfermode::Mode = SkXfermode::kSrcO ver_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 223 void drawImage(Image*, const IntPoint&, SkXfermode::Mode = SkXfermode::kSrcO ver_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 223 void drawImage(Image*, const IntRect&, SkXfermode::Mode = SkXfermode::kSrcOv er_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation); | 224 void drawImage(Image*, const IntRect&, SkXfermode::Mode = SkXfermode::kSrcOv er_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 224 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, SkXfermode::Mode = SkXfermode::kSrcOver_Mode, RespectImageOrientationEnum = DoNo tRespectImageOrientation); | 225 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, SkXfermode::Mode = SkXfermode::kSrcOver_Mode, RespectImageOrientationEnum = DoNo tRespectImageOrientation); |
| 225 | 226 |
| 226 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin t, const IntSize& tileSize, | 227 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin t, const IntSize& tileSize, |
| 227 SkXfermode::Mode = SkXfermode::kSrcOver_Mode, const IntSize& repeatSpaci ng = IntSize()); | 228 SkXfermode::Mode = SkXfermode::kSrcOver_Mode, const IntSize& repeatSpaci ng = IntSize()); |
| 228 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, | 229 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, |
| 229 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch Tile, Image::TileRule vRule = Image::StretchTile, | 230 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch Tile, Image::TileRule vRule = Image::StretchTile, |
| 230 SkXfermode::Mode = SkXfermode::kSrcOver_Mode); | 231 SkXfermode::Mode = SkXfermode::kSrcOver_Mode); |
| 231 | 232 |
| 232 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec t* srcRect = 0, SkXfermode::Mode = SkXfermode::kSrcOver_Mode); | 233 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec t* srcRect = 0, SkXfermode::Mode = SkXfermode::kSrcOver_Mode); |
| 233 | 234 |
| 234 // These methods write to the canvas. | 235 // These methods write to the canvas. |
| 235 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou ndedRect | 236 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou ndedRect |
| 236 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); | 237 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); |
| 237 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP aint* = 0); | 238 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP aint* = 0); |
| 238 void drawOval(const SkRect&, const SkPaint&); | 239 void drawOval(const SkRect&, const SkPaint&); |
| 239 void drawPath(const SkPath&, const SkPaint&); | 240 void drawPath(const SkPath&, const SkPaint&); |
|
f(malita)
2015/04/02 15:23:01
... except we already have an SkPath version! :)
fs
2015/04/03 18:19:44
So many methods...
fs
2015/04/07 12:03:56
Using these three.
f(malita)
2015/04/07 12:44:30
Hopefully we get rid of all the fill/stroke varian
| |
| 240 void drawRect(const SkRect&, const SkPaint&); | 241 void drawRect(const SkRect&, const SkPaint&); |
| 241 | 242 |
| 242 void clip(const IntRect& rect) { clipRect(rect); } | 243 void clip(const IntRect& rect) { clipRect(rect); } |
| 243 void clip(const FloatRect& rect) { clipRect(rect); } | 244 void clip(const FloatRect& rect) { clipRect(rect); } |
| 244 void clipRoundedRect(const FloatRoundedRect&, SkRegion::Op = SkRegion::kInte rsect_Op); | 245 void clipRoundedRect(const FloatRoundedRect&, SkRegion::Op = SkRegion::kInte rsect_Op); |
| 245 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); } | 246 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); } |
| 246 void clipOut(const FloatRect& rect) { clipRect(rect, NotAntiAliased, SkRegio n::kDifference_Op); } | 247 void clipOut(const FloatRect& rect) { clipRect(rect, NotAntiAliased, SkRegio n::kDifference_Op); } |
| 247 void clipOut(const Path&); | 248 void clipOut(const Path&); |
| 248 void clipOutRoundedRect(const FloatRoundedRect&); | 249 void clipOutRoundedRect(const FloatRoundedRect&); |
| 249 void clipPath(const Path&, WindRule = RULE_EVENODD, AntiAliasingMode = AntiA liased); | 250 void clipPath(const Path&, WindRule = RULE_EVENODD, AntiAliasingMode = AntiA liased); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 float m_deviceScaleFactor; | 452 float m_deviceScaleFactor; |
| 452 | 453 |
| 453 unsigned m_accelerated : 1; | 454 unsigned m_accelerated : 1; |
| 454 unsigned m_printing : 1; | 455 unsigned m_printing : 1; |
| 455 unsigned m_antialiasHairlineImages : 1; | 456 unsigned m_antialiasHairlineImages : 1; |
| 456 }; | 457 }; |
| 457 | 458 |
| 458 } // namespace blink | 459 } // namespace blink |
| 459 | 460 |
| 460 #endif // GraphicsContext_h | 461 #endif // GraphicsContext_h |
| OLD | NEW |