| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. 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 are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 { | 247 { |
| 248 if (!isValid()) | 248 if (!isValid()) |
| 249 return; | 249 return; |
| 250 | 250 |
| 251 const SkBitmap& bitmap = *m_context->bitmap(); | 251 const SkBitmap& bitmap = *m_context->bitmap(); |
| 252 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); | 252 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); |
| 253 context->drawImage(image.get(), destRect, srcRect, op, blendMode, DoNotRespe
ctImageOrientation, useLowQualityScale); | 253 context->drawImage(image.get(), destRect, srcRect, op, blendMode, DoNotRespe
ctImageOrientation, useLowQualityScale); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect
, const FloatSize& scale, | 256 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect
, const FloatSize& scale, |
| 257 const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect) | 257 const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, Bl
endMode blendMode) |
| 258 { | 258 { |
| 259 if (!isValid()) | 259 if (!isValid()) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 const SkBitmap& bitmap = *m_context->bitmap(); | 262 const SkBitmap& bitmap = *m_context->bitmap(); |
| 263 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); | 263 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); |
| 264 image->drawPattern(context, srcRect, scale, phase, op, destRect); | 264 image->drawPattern(context, srcRect, scale, phase, op, destRect, blendMode); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstCo
lorSpace) | 267 void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstCo
lorSpace) |
| 268 { | 268 { |
| 269 if (srcColorSpace == dstColorSpace) | 269 if (srcColorSpace == dstColorSpace) |
| 270 return; | 270 return; |
| 271 | 271 |
| 272 // only sRGB <-> linearRGB are supported at the moment | 272 // only sRGB <-> linearRGB are supported at the moment |
| 273 if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceDevi
ceRGB) | 273 if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceDevi
ceRGB) |
| 274 || (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceD
eviceRGB)) | 274 || (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceD
eviceRGB)) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 489 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
| 490 return "data:,"; | 490 return "data:,"; |
| 491 | 491 |
| 492 Vector<char> base64Data; | 492 Vector<char> base64Data; |
| 493 base64Encode(encodedImage, base64Data); | 493 base64Encode(encodedImage, base64Data); |
| 494 | 494 |
| 495 return "data:" + mimeType + ";base64," + base64Data; | 495 return "data:" + mimeType + ";base64," + base64Data; |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace WebCore | 498 } // namespace WebCore |
| OLD | NEW |