| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // for example must be applied atomically during the final fill/composite ph
ase). | 236 // for example must be applied atomically during the final fill/composite ph
ase). |
| 237 GraphicsContext recordingContext(nullptr, nullptr); | 237 GraphicsContext recordingContext(nullptr, nullptr); |
| 238 recordingContext.beginRecording(spacedTile); | 238 recordingContext.beginRecording(spacedTile); |
| 239 // When generating an expanded tile, make sure we don't draw into the spacin
g area. | 239 // When generating an expanded tile, make sure we don't draw into the spacin
g area. |
| 240 if (tile != spacedTile) | 240 if (tile != spacedTile) |
| 241 recordingContext.clipRect(tile); | 241 recordingContext.clipRect(tile); |
| 242 drawForContainer(&recordingContext, containerSize, zoom, tile, srcRect, Comp
ositeSourceOver, | 242 drawForContainer(&recordingContext, containerSize, zoom, tile, srcRect, Comp
ositeSourceOver, |
| 243 blink::WebBlendModeNormal); | 243 blink::WebBlendModeNormal); |
| 244 RefPtr<Picture> tilePicture = recordingContext.endRecording(); | 244 RefPtr<Picture> tilePicture = recordingContext.endRecording(); |
| 245 | 245 |
| 246 // FIXME: SkPictureShader ignores the picture offset - so we must compensate
here. | |
| 247 SkRect tileRect = SkRect::MakeXYWH(-spacedTile.x(), -spacedTile.y(), | |
| 248 spacedTile.width(), spacedTile.height()); | |
| 249 SkMatrix patternTransform; | 246 SkMatrix patternTransform; |
| 250 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced
Tile.y()); | 247 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced
Tile.y()); |
| 251 RefPtr<SkShader> patternShader = adoptRef(SkShader::CreatePictureShader( | 248 RefPtr<SkShader> patternShader = adoptRef(SkShader::CreatePictureShader( |
| 252 tilePicture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMod
e, | 249 tilePicture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMod
e, |
| 253 &patternTransform, &tileRect)); | 250 &patternTransform, nullptr)); |
| 254 | 251 |
| 255 SkPaint paint; | 252 SkPaint paint; |
| 256 paint.setShader(patternShader.get()); | 253 paint.setShader(patternShader.get()); |
| 257 paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode
)); | 254 paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode
)); |
| 258 paint.setColorFilter(context->colorFilter()); | 255 paint.setColorFilter(context->colorFilter()); |
| 259 context->drawRect(dstRect, paint); | 256 context->drawRect(dstRect, paint); |
| 260 } | 257 } |
| 261 | 258 |
| 262 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
oatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) | 259 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
oatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) |
| 263 { | 260 { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 437 |
| 441 return m_page; | 438 return m_page; |
| 442 } | 439 } |
| 443 | 440 |
| 444 String SVGImage::filenameExtension() const | 441 String SVGImage::filenameExtension() const |
| 445 { | 442 { |
| 446 return "svg"; | 443 return "svg"; |
| 447 } | 444 } |
| 448 | 445 |
| 449 } | 446 } |
| OLD | NEW |